简体   繁体   English

带有Braintree插件的PayPal

[英]PayPal with Braintree Drop-In

I'm trying to get PayPal payments to work with my Braintree dropin integration on my website. 我正在尝试使PayPal付款与我的网站上的Braintree dropin集成一起使用。

I am 100% sure that I'm doing it completely wrong. 我100%确信自己做错了。

The Braintree docs can get a little bit confusing at times. Braintree文档有时会有些混乱。

What happens is that nothing shows up in my Braintree vault when completing the PayPal payment. 发生的情况是,完成PayPal付款后,我的Braintree保管库中什么都没有显示。

braintree.dropin.create({
        authorization: 'TOKEN_GOES_HERE',
        container: '#dropin-container',
        paypal: {
                    flow: 'vault',
                    amount: '1.00',
                    currency: 'EUR'
                }
    },

    function (createErr, instance) {
        doPay.on('click', function () {
            requestPayment(instance);
        });
});

function requestPayment(instance){
    instance.requestPaymentMethod(function (err, payload) {
       var data = { reqPay: payload.nonce
                  }
       $.ajax({ type: 'POST', url: 'buyThing.php', data: data, success:
           function (response) {
               console.log("DONE!");
           }
       });
    });
}

Braintree drop-in doesn't create customer in the vault, all it does is create a payment nonce. Braintree插件不会在金库中创建客户,它所做的只是创建付款随机数。 You need to send the nonce generated by the drop-in along with customer info to the backend and do Braintree_Customer::find() , if customer doesn't exist in vault then do Braintree_Customer::create() to create. 您需要将插件生成的随机数与客户信息一起发送到后端,然后执行Braintree_Customer :: find() ,如果Vault中不存在客户,请执行Braintree_Customer :: create()创建。 After that it's to use the customer paymentMethods from the customer create call to create transaction. 之后,使用客户create调用中的客户paymentMethods创建交易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM