Paypal未来付款

时间:2017-04-03 21:21:21

标签: ruby-on-rails ember.js paypal

我在ember应用程序中使用paypal checkout.js。我使用以下代码创建付款:

paypal.Button.render({
    env: 'sandbox', // sandbox | production
    payment: function() {
        return paypal.request.post('http://localhost:3000/paypal/create').then(function(res) {
            console.log('res')
            console.log(res);
            return res.payToken;
        });
    },
    onAuthorize: function(data, actions) {
        return paypal.request.post('http://localhost:3000/paypal/execute', {
            payToken: data.paymentID,
            payerId: data.payerID
        }).then(function (res) {
            console.log(res)
            document.querySelector('#paypal-button-container').innerText = 'Payment Complete!';
        });
    }

}, '#paypal-button-container');

在后端,我用了

def create
    authorization_code = ''
    correlation_id = ''
end

现在问题是我无法获得authorization_codecorrelation_id,当我搜索到这一点时,我发现大多数解决方案都是这种付款仅适用于移动应用。那么,这是真的吗?我不能将未来的付款用于前端吗?

谢谢。

1 个答案:

答案 0 :(得分:1)

Future Payments是PayPal REST API方法中的一项功能,此类方法仅适用于PayPal Mobile SDK 2.0。您的客户可以在未注册其PayPal帐户的情况下,允许多次向您收费。

你可以阅读它here