我正在尝试实现PayPal信用卡的功能在Laravel。我收到了"PAYEE_ACCOUNT_INVALID“错误。知道我做错什么了吗?任何帮助都会很感激的。我尝试过使用PayPal通过卡片生成器模拟提供的不同测试卡号。
谢谢。
这是我的代码片段。
public function payment()
{
$gateway = Omnipay::create('PayPal_Rest');
// Initialise the gateway
$gateway->initialize(array(
'clientId' => env('PAYPAL_SANDBOX_CLIENT_ID'),
'secret' => env('PAYPAL_SANDBOX_CLIENT_SECRET'),
'testMode' => true,
));
#### Direct Credit Card Payment
// Create a credit card object
// DO NOT USE THESE CARD VALUES -- substitute your own
// see the documentation in the class header.
$card = new CreditCard([
'firstName' => 'Example',
'lastName' => 'User',
'number' => '4111111111111111',
'expiryMonth' => '01',
'expiryYear' => '2027',
'cvv' => '123',
]);
// Do a purchase transaction on the gateway
try {
$transaction = $gateway->purchase([
'amount' => '1.00',
'currency' => 'AUD',
'description' => 'This is a test purchase transaction.',
'card' => $card,
]);
$response = $transaction->send();
$data = $response->getData();
echo "Gateway purchase response data == " . print_r($data, true) . "\n";
if ($response->isSuccessful()) {
echo "Purchase transaction was successful!\n";
}
} catch (Exception $e) {
echo "Exception caught while attempting authorize.\n";
echo "Exception type == " . get_class($e) . "\n";
echo "Message == " . $e->getMessage() . "\n";
}
}发布于 2022-02-13 11:02:22
受款人帐户无效意味着接收帐户无法处理事务。这很可能是一种不推荐的集成方法,尽管很难不看到实际的API请求和响应。
当前处理信用卡的方法是使用PayPal签出SDK,它有一个黑色的借记卡或信用卡按钮,可以在您的站点上扩展表单。另外,还可以添加一个高级集成,用于以更自定义的方式显示卡片字段;这需要更多的工作来实现。
https://stackoverflow.com/questions/71099553
复制相似问题