我试图配置我的paypal网关和激活帮助下的铁路教程,但我有点困惑,因为网关信息已经改变。
这是教程中的旧配置:
gateway = ActiveMerchant::Billing::PaypalGateway.new(
login: "...",
password: "...",
signature: "..."
)在我的PaypalSandbox账户里,我只有这个:
正确的配置是什么?
发布于 2013-03-16 20:12:32
您的网关需要的是经典的凭证。为了得到你的这些,你必须首先创建一个贝宝沙箱帐户,将作为您的卖家。确保它是一个商业/商人类型的帐户。
一旦您这样做,然后单击该帐户的“配置文件”链接,请在选项卡"API凭据“下面查看。上面会列出你需要的所有信息。
发布于 2018-07-11 22:30:35
从头开始测试
首先,您必须进入Paypal开发者网站并创建和帐户
然后生成沙箱用户类型business,然后单击Profile选项,然后单击API Credentials选项卡,您将最终获得所需的数据,如登录/用户名、密码/密码、签名/签名。

发布于 2018-07-12 12:59:53
require 'active_merchant'
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
login: "activemerchant-test_api1.example.com",
password: "HBC6A84QLRWC923A",
signature: "AFcWxV21C7fd0v3bYYYRCpSSRl31AC-11AKBL8FFO9tjImL311y8a0hx"
}
@gateway = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
response = @gateway.setup_purchase(50,
ip: request.remote_ip,
return_url: "http://local.mywebdomain.com:3000/mylocalhostpaymentsucceed",
cancel_return_url: "http://local.mywebdomain.com:3000/seeyouagain",
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: "1", amount: 50}]
)
redirect_to @gateway.redirect_url_for(response.token)另一个技巧是如何将本地主机设置为local.mywebdomain.com。只需将机器的.host文件夹中的system32文件编辑为
127.0.0.1 local.mywebdomain.comhttps://stackoverflow.com/questions/15453597
复制相似问题