ruby-on-rails - Paypal future 付款

标签 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 当我搜索它时,我发现大多数解决方案都是这种付款方式仅适用于移动应用程序。那么,这是真的吗?我不能在前端使用 future 付款吗?

谢谢。

最佳答案

Future Payments 是 PayPal REST API 方法中的一项功能,这种方法仅适用于 PayPal Mobile SDK 2.0。您的客户可以允许在未来多次付款而无需登录他们的 PayPal 帐户。

你可以读一下here .

关于ruby-on-rails - Paypal future 付款,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43194507/

相关文章:

ember.js - Ember 无法将路由操作传递给组件

javascript - Rails 3 从另一个站点拉取数据

ruby-on-rails - rspec 中的上下文

ruby-on-rails - cat ~/.gemrc 结果为 "no such file or directory"

json - 使用自定义 Ember-Data REST 适配器的 PUT 请求

javascript - 加税 - Paypal 变量

sql - 在 ActiveRecord 的 WHERE 语句中使用 array_length

jquery-ui - 如何在 Ember 中创建像对话框这样的控件?

Paypal 沙箱帐户失败

paypal - 客户 Payum/paypal-express-checkout-nvp 无法确认创建结算协议(protocol)