使用[客户端快速结账使用REST]未借记Paypal沙箱买家帐户且未记入卖家帐户

时间:2017-11-23 17:40:20

标签: javascript rest paypal paypal-sandbox paypal-rest-sdk

问题是PayPal沙盒买家帐户未使用[使用REST进行客户端快速结账]而未记入借方和卖家帐户

存在类似问题,但它使用的方法不同:Paypal Sandbox Business Account not credited and Buyer is not debited 所以在这种情况下没用。

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

<!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>

如果我查看Sandbox API通话记录,则会显示以下呼叫:

enter image description here

我在这里检查借记和贷记,它总是一样的。

enter image description here

这是我付款后收到的回复:

enter image description here

{paymentToken: "EC-9KH619457W604780E", payerID: "QDUVETXZHS6Q6", paymentID: "PAY-5EM20515GN939974CLILPZ7Q", intent: "sale", returnUrl: "http://localhost/?paymentId=PAY-5EM20515GN939974CL…&token=EC-9KH619457W604780E&PayerID=QDUVETXZHS6Q6"}

0 个答案:

没有答案