问题描述
我正在尝试使用 rest-api-sdk-ruby gem (https://github.com/paypal/rest-api-sdk-ruby),但找不到足够的信息或好的教程来支持我.上面提供的描述虽然提供了必要的代码,但没有展示如何处理周围的方法或每个方法应该转到哪些文件.
Im trying to integrate paypal with my ruby on rails application using the rest-api-sdk-ruby gem (https://github.com/paypal/rest-api-sdk-ruby), but could not find enough information around or a good tutorial to back me up.The description provided above, although providing the necessary code, does not show how to handle the methods around or in which files should each method go to.
谁能给我一个起点或给我一个好的教程?
Could anyone give me a starting point here or point me to a good tutorial?
我使用的是 Rails 版本 4.
I am using rails version 4.
非常感谢.
推荐答案
Standard PayPal Integration with Rails app Active Merchant gem
步骤 1
在 您的 Gemfile 中添加
gem 'activemerchant'
运行
捆绑安装
转到developer.paypal.com"并创建一个帐户(也称为商家帐户)) 与美国地址详细信息.
Go to "developer.paypal.com" and create an account (also known as Merchant Account) with US address details.
它会在sandbox.paypal.com"中创建两个虚拟测试账户,买方和卖方(又名服务商)各一个.要查看测试帐户详细信息,请单击仪表板 -> 帐户"
It will create two dummy test accounts, one each for the buyer and the seller (a.k.a. facilitator), in "sandbox.paypal.com". To see test accounts details Click on "Dashboard -> Accounts"
现在点击个人资料链接为两个测试帐户设置密码.
Now set the password for both test accounts by clicking on the profile link.
转到卖家帐户(即服务商)个人资料详细信息并复制 API 凭据,即用户名、密码和签名.例如:
Go to seller account (i.e. facilitator) profile details and copy the API Credentials, i.e. username, password and signature. For example:
Username: naveengoud-facilitator_api1.gamil.com Password: VSPALJ5ALA5YY9YJ Signature: AVLslxW5UGzEpaDPEK4Oril7Xo4IAYjdWHD25HhS8a8kqPYO4FjFhd6A
在config/environments/development.rb"中设置这些 API 凭据,如下所示:
Set these API Credentials in "config/environments/development.rb" as follows:
config.after_initialize do ActiveMerchant::Billing::Base.mode = :test ::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new( login: "merchant_api1.gotealeaf.com", password: "2PWPEUKZXAYE7ZHR", signature: "AFcWxV21C7fd0v3bYYYRCpSSRl31A-dRI5VpyF4A9emruhNYzlM8poc0" ) end
这篇关于如何将 Paypal 与 Ruby on Rails 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!