I have used this in my project, hoping to integrate paypal express.
but I've got this error:
You do not have permissions to make this API call
here is my controller:
public function index()
{
$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername('xxxxxx');
$gateway->setPassword('xxxxxx');
$formData = [
'number' => '4242424242424242',
'expiryMonth' => '6',
'expiryYear' => '2016',
'cvv' => '123'
];
$response = $gateway->purchase(
[
'amount' => '1.00',
'currency' => 'USD',
'card' => $formData,
'returnUrl' => '/checkout/',
'cancelUrl' => '/cancel/',
]
)->send();
// Process response
if ($response->isSuccessful()) {
// Payment was successful
print_r($response);
} elseif ($response->isRedirect()) {
// Redirect to offsite payment gateway
$response->redirect();
} else {
// Payment failed
echo $response->getMessage();
}
}
I have enabled api access in my paypal account but got same result. I assume the gateway login details for setUsername
and setPassword
are the details provided by paypal after setting up the api. I have also changed these details with my paypal login but I've got the same result.