Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.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
Javascript Paypal sandbox买方账户未借记,卖方账户未贷记,使用[客户端快速结帐使用REST]_Javascript_Rest_Paypal_Paypal Sandbox_Paypal Rest Sdk - Fatal编程技术网

Javascript Paypal sandbox买方账户未借记,卖方账户未贷记,使用[客户端快速结帐使用REST]

Javascript Paypal sandbox买方账户未借记,卖方账户未贷记,使用[客户端快速结帐使用REST],javascript,rest,paypal,paypal-sandbox,paypal-rest-sdk,Javascript,Rest,Paypal,Paypal Sandbox,Paypal Rest Sdk,问题在于,PayPal沙盒买方账户未借记,卖方账户未贷记,使用[客户端快速结帐使用REST] 存在类似的问题,但使用不同的方法: 所以在这种情况下没有用 下面是我正在使用的代码: <!DOCTYPE html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width,

问题在于,PayPal沙盒买方账户未借记,卖方账户未贷记,使用[客户端快速结帐使用REST]

存在类似的问题,但使用不同的方法: 所以在这种情况下没有用

下面是我正在使用的代码:

<!DOCTYPE html>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>

<body>
<div id="paypal-button-container"></div>

<script>
    paypal.Button.render({

        env: 'sandbox', // sandbox | production

        // PayPal Client IDs - replace with your own
        // Create a PayPal app: https://developer.paypal.com/developer/applications/create
        client: {
            sandbox:    'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
            production: '<insert production client id>'
        },

        // Show the buyer a 'Pay Now' button in the checkout flow
        commit: true,

        // payment() is called when the button is clicked
        payment: function(data, actions) {

            console.log(data);
            // Make a call to the REST api to create the payment
            return actions.payment.create({
                payment: {
                    transactions: [
                        {
                            amount: { total: '5', currency: 'USD' }
                        }
                    ]
                }
            });
        },

        // onAuthorize() is called when the buyer approves the payment
        onAuthorize: function(data, actions) {
            console.log(data);
            // Make a call to the REST api to execute the payment
            return actions.payment.execute().then(function() {
                window.alert('Payment Complete!');
            });
        }

    }, '#paypal-button-container');

</script>
</body>

如果有人没有答案,有人能告诉我我做得对还是错?我的意思是,这是实现PayPal结账的正常方式吗?如果我们收到paymentID作为回应,那么这是否意味着付款完成?如果有人没有答案,有人能告诉我我这样做是对的还是错的吗?我的意思是,这是实现PayPal结账的正常方式吗?如果我们收到paymentID作为响应,那么这是否意味着付款完成?
{paymentToken: "EC-9KH619457W604780E", payerID: "QDUVETXZHS6Q6", paymentID: "PAY-5EM20515GN939974CLILPZ7Q", intent: "sale", returnUrl: "http://localhost/?paymentId=PAY-5EM20515GN939974CL…&token=EC-9KH619457W604780E&PayerID=QDUVETXZHS6Q6"}