从Paypal客户端REST集成按钮返回客户信息

时间:2017-11-07 23:46:52

标签: rest paypal paypal-rest-sdk paypal-buttons

我使用checkout.js(https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/client-side-REST-integration/

使用“客户端REST集成”

有没有办法在授权后返回客户的信息(姓名+电子邮件地址)并关闭PayPal窗口?

或许在下面的某个地方?

onAuthorize: function(data, actions) {

    // Make a call to the REST api to execute the payment
    return actions.payment.execute().then(function() {
    window.alert('Payment Complete!');
 });

由于

1 个答案:

答案 0 :(得分:1)

自己回答: actions.payment.execute()。then()返回带有此信息的付款对象

onAuthorize: function(data, actions) {

    return actions.payment.execute().then(function(payment) {
        console.log(payment.payer.payer_info);
    });
}