【问题标题】:Laravel making credit card payment with paypal returns unauthorized paymentLaravel 使用 paypal 进行信用卡付款返回未经授权的付款
【发布时间】:2019-12-26 06:02:31
【问题描述】:

我正在尝试将 Paypal 作为支付网关集成到我的 Laravel 5.8 网站中。为此,我使用了 Laravel-Omnipay 包,它提供了 Omnipay 与 Laravel 的集成。

至于我的Paypal 企业帐户,我已经设置了我的凭据。使用带有以下代码的贝宝沙箱:

Route::get('paypal', function() {
    $gateway = Omnipay::create('PayPal_Rest');

    $gateway->initialize(array(
        'clientId' => 'MySandboxClientId',
        'secret'   => 'MySandboxSecret',
        'testMode' => true,
    ));
    $card = new CreditCard(array(
        'firstName' => 'first name',
        'lastName' => 'last name',
        'number' => '5498876202508868',
        'cvv' => '123',
        'expiryMonth'           => '09',
        'expiryYear'            => '2024',
        'billingAddress1'       => '1 Scrubby Creek Road',
        'billingCountry'        => 'AU',
        'billingCity'           => 'Scrubby Creek',
        'billingPostcode'       => '4999',
        'billingState'          => 'QLD',
    ));
    try {
        $transaction = $gateway->purchase(array(
            'amount'        => '10.00',
            'currency'      => 'USD',
            'description'   => 'This is a test purchase transaction.',
            'card'          => $card,
        ));
        $response = $transaction->send();
        $data = $response->getData();
        dd($data);
        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";
    }
});

但是,当我尝试使用自己的信用卡进行实时付款时。我可以Unauthorized payment. 错误。我使用的代码与上面相同,我只是将 clientId 和 secret 替换为我的实时沙箱凭据。

如何实时调用 REST Api。我需要进行一笔 1 美元的交易,以便测试该卡是否有效。

【问题讨论】:

    标签: php laravel paypal


    【解决方案1】:

    根据贝宝文档, 发生未经授权的付款错误时,

    未经帐户所有者许可,从借记卡或信用卡、银行帐户或 PayPal 帐户进行的任何付款都是未经授权的付款。

    当 PayPal 认为某笔付款未经授权时,我们会暂停付款。在我们确定付款是否获得授权之前,无法提取资金。

    如果付款未经授权,款项将退回到汇款人的账户。符合 PayPal 卖家保护下的资格准则的卖家受到保护。

    所以可能是信用卡的问题。尝试使用另一张信用卡或按照此处提到的说明进行操作。 Unauthorized error paypal

    【讨论】:

    • 我正在使用他们的 Rest API 进行信用卡直接付款,我没有使用需要 Paypal 帐户授权的 Checkout。
    猜你喜欢
    • 2019-01-28
    • 2013-09-24
    • 2015-11-11
    • 2023-03-08
    • 1970-01-01
    • 2018-04-12
    • 1970-01-01
    • 2015-07-15
    • 2013-05-31
    相关资源
    最近更新 更多