如何使用新的PayPal JavaScript SDK关闭送货

时间:2019-03-11 00:10:48

标签: javascript paypal

我正在https://developer.paypal.com/docs/checkout/reference/customize-sdk

处使用新的PayPal Javascript SDK按钮

我们的应用程序出售数字商品,不需要送货地址。有什么办法可以关闭它吗?

// render paypal buttons
paypal.Buttons({
    createOrder: function (data, actions) {
        // Set up the transaction
        return actions.order.create({
            purchase_units: [{
                amount: {
                    value: $scope.total
                }
            }],
            application_context: {
                shipping_preference: "NO_SHIPPING"
            }
        });
    },
    onApprove: function (data, actions) {
        // Capture the funds from the transaction
        return actions.order.capture().then(function (details) {
            // Show a success message to your buyer
            alert('Transaction completed by ' + details.payer.name.given_name + ' order ID: ' + data.orderID);


        });
    }
}).render('#paypal-button-container');

0 个答案:

没有答案