PayPal Express(checkout.js):防止出现框

时间:2019-02-19 23:09:59

标签: javascript paypal

在设置某些条件之前,如何防止PayPal Express框弹出?换句话说,除非JavaScript变量具有特定值,否则我希望将其禁用。我需要添加验证功能。链接在这里: https://s.codepen.io/nedhulton/debug/KJEQBO/dGkXWdqVjwoA

这是我的代码:

    paypal.Button.render({

    env: 'production', // Or 'sandbox'

   style: {
        label: 'paypal',
        size:  'responsive',    // small | medium | large | responsive
        shape: 'rect',     // pill | rect
        color: 'black',     // gold | blue | silver | black
        tagline: false    
    },

    client: {
        sandbox:    'xxxxxxxxx',
        production: 'AWSMEY2BF_EaVad_Y-4HubBOhtEM3826dOxPa-ovvlt5MLHB5aA_1VN8pfoj3FnF5wLspP0emRwv9oZL'
    },

    commit: true, // Show a 'Pay Now' button

    payment: function(data, actions) {
        return actions.payment.create({
            payment: {
                transactions: [
                    {
                        amount: { total: 0.01, currency: 'USD' }, description:'', custom: 'New York'
                    }
                ]
            },

            experience: {
                input_fields: {
                    no_shipping: 1
                }
            }
        });
    },

onCancel:函数(数据,操作){

    },

    onAuthorize: function(data, actions) {
        return actions.payment.execute().then(function(payment) {





        });
    }

}, '#paypal-button');

0 个答案:

没有答案