在我的信用卡处理文件中,我有:
response = PaymentGateway.pay_pal.authorize(
foreign_currency_amount_in_cents,
credit_card,
:email => email_address,
:order_id => invoice_number,
:description => item_id,
:ip => ip_address,
:currency => foreign_currency.name,
:custom_code => credit_card.type
)
在payment_gateway.rb
,我有
class PaymentGateway
class << self
def pay_pal
@pay_pal ||= ActiveMerchant::Billing::PaypalGateway.new(:login => AppConfig.pay_pal[:login], :password => AppConfig.pay_pal[:password])
end
end
在我的environments/production.rb
中,我为pay_pal配置分配了更多变量,具体来说:
signature: "somesignature"
login: "my.name_api1.mysite.com"
password: "SOMEPASSWORD"
business: "my.name@mysite.com"
business_id: "BUSINESSID"
cert_id: "SOMECERTID"
private_key: |
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAA...
-----END RSA PRIVATE KEY-----
public_key: |
-----BEGIN CERTIFICATE-----
MIIDGD...
-----END CERTIFICATE-----
我正在尝试切换PayPal帐户并创建了一个新的PayPal帐户。我真的需要在环境文件中切换凭据吗?如果是这样,我使用哪些凭证?登录不是电子邮件地址,我用来登录PayPal的是电子邮件地址。
答案 0 :(得分:1)
观看此视频:
http://railscasts.com/episodes/144-active-merchant-basics
它提供了有关如何获取和设置ActiveMerchant的PayPal API凭据的分步说明。
PayPal也为您提供信息 MyAccount - &gt;个人资料 - &gt; API访问 - &gt;请求API凭据
有关详情,请参阅: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/apicertificates