Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel使用paypal进行信用卡支付时返回未经授权的支付_Php_Laravel_Paypal - Fatal编程技术网

Php Laravel使用paypal进行信用卡支付时返回未经授权的支付

Php Laravel使用paypal进行信用卡支付时返回未经授权的支付,php,laravel,paypal,Php,Laravel,Paypal,我正在尝试将Paypal作为支付网关集成到我的Laravel5.8网站中。为了做到这一点,我正在使用的软件包提供了Omnipay集成到Laravel 至于我的Paypal商业帐户,我已经设置了我的凭据。将paypal沙箱与以下代码一起使用是可行的: Route::get('paypal', function() { $gateway = Omnipay::create('PayPal_Rest'); $gateway->initialize(array(

我正在尝试将Paypal作为支付网关集成到我的Laravel5.8网站中。为了做到这一点,我正在使用的软件包提供了Omnipay集成到Laravel

至于我的Paypal商业帐户,我已经设置了我的凭据。将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";
    }
});
然而,当我尝试使用自己的信用卡进行实时支付时。我不能接受未经授权的付款。错误我使用的代码与上面相同,我只是用我的live沙盒凭据替换clientId和secret


如何对RESTAPI进行实时调用。我需要进行一笔1美元的交易,这样我才能测试卡是否有效。

根据paypal文档, 发生未经授权的支付错误时

未经账户所有者许可,从借记卡或信用卡、银行账户或贝宝账户进行的任何付款均为未经授权的付款

当PayPal认为付款未经授权时,我们会暂停付款。在我们确定付款是否得到授权之前,不能取款

如果付款未经授权,则将款项退还给发件人的帐户。符合贝宝卖家保护资格准则的卖家将受到保护

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

我正在使用他们的Rest API进行直接信用卡支付,我没有使用需要Paypal帐户授权的Checkout。