【发布时间】:2014-05-02 10:47:07
【问题描述】:
我觉得很多关于这方面的文档都已经过时了,但这是我迄今为止一直在尝试的:
我正在使用ActiveMerchant::Billing::PaypalExpressGateway 网关。
首先我设置购买并将用户重定向到 Paypal:
response = gateway.setup_purchase price,
return_url: <confirm url>,
cancel_return_url: <cancel url>,
items: [
{
name: 'My Item',
quantity: 1,
description: "My Item Description",
amount: price
}
]
redirect_to gateway.redirect_url_for(response.token)
这行得通,我可以作为沙盒买家登录并确认付款,这让我从上面回到<confirm url>。在确认中,我这样做:
response = gateway.recurring price, nil,
token: params[:token],
period: 'Year',
frequency: 1,
start_date: Time.now,
description: 'My Item Subscription'
执行此操作时,我在 response 变量中收到来自 Paypal 的无效令牌错误。令牌似乎很好,当我返回确认 URL 时,它出现在 URL 中。然后我直接把它(params[:token])发回Paypal。
我做错了什么吗?就像我说的那样,这种类型的流程的很多文档似乎已经过时了(或者我正在尝试的是过时的东西......)
【问题讨论】:
-
我们没有设置定期付款,但我们有 Paypal express gateway 为 ActiveMerchant 在firststopcosmeticshop.co.uk(开发应用程序)工作 -> 你要我粘贴代码吗?跨度>
-
@RichPeck:我正在尝试快速结帐,但我遇到了this 问题。你能帮忙吗
标签: ruby-on-rails paypal activemerchant