我在我的项目中使用this,希望整合paypal express。
但是我遇到了这个错误:
您无权进行此API调用
这是我的控制器:
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();
}
}
我在paypal帐户中启用了api访问权限,但结果相同。我假设setUsername
和setPassword
的网关登录详细信息是paypal在设置api后提供的详细信息。我也用paypal登录更改了这些细节,但我得到了相同的结果。