[英]error trying to make sandbox paypal to work with rails?
我在将Paypal付款网关与Rails集成时遇到问题。 我将在下面解释我的步骤。
我首先去了developer.paypal.com
我创建了两个沙箱帐户,一个用于买方,一个用于商业帐户。
我已将企业帐户更改为Business-Pro
然后,我将activemerchant gem安装在导轨中。
在config / environments / development.rb中,我粘贴了以下块
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
login: "aGthYkgkYXVA_api1.gmail.com",
password: "DH2RB21WR2EWNSTM",
signature: "ApBHX2qbpxJW-Ll3oP22LSao0WeuAT.A.uNyDDqIArQeMLYzMTqsZnCW"
}
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(paypal_options)
end
然后在控制器中,我创建了一个测试方法并粘贴了代码以进行结帐
# ActiveMerchant accepts all amounts as Integer values in cents
amount = 1000 # $10.00
# The card verification value is also known as CVV2, CVC2, or CID
credit_card = ActiveMerchant::Billing::CreditCard.new(
:brand => 'visa',
:first_name => 'Bob',
:last_name => 'Bobsen',
:number => '4132033791119477',
:month => 3,
:year => 2022,
:verification_value => '123')
# Validating the card automatically detects the card type
if credit_card.validate.empty?
# Capture $10 from the credit card
response = GATEWAY.purchase(amount, credit_card, :ip => '128.1.1.1')
if response.success?
puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}"
else
raise StandardError, response.message
end
end
当我执行控制器方法时,出现以下错误
此交易无法处理。 商家的帐户无法处理交易。
我想知道这个错误的原因。
我使用了我在上面创建的买方沙盒帐户中的信用卡号和有效日期。
感谢您的帮助!
在他们的文档中 :
10548无法处理此事务。 商家的帐户无法处理交易。 尝试进行交易的商家帐户不是PayPal上的企业帐户。 检查您的帐户设置。
--
10549无法处理此事务。 商家的帐户无法处理交易。 尝试进行交易的商家帐户无法处理直接付款交易。 有关更多信息,请联系PayPal。
我会检查您的帐户状态,并确保将其绝对用于业务。 在那里戳一戳,让我知道你过得如何!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.