尝试使沙盒paypal与rails一起工作时出错?

我在将paypal支付网关与rails集成时遇到问题。 我将在下面解释我所做的步骤。

我第一次去了developer.paypal.com

我为买家创建了两个沙箱帐户,为企业帐户创建了一个沙箱帐户。

我将商业帐户更改为Business-Pro

然后我在rails中安装了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 

然后在控制器中我创建了一个测试方法并粘贴了代码来执行checkout

  # 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 

当我执行控制器方法时,我得到以下错误

此交易无法处理。 商家的帐户无法处理交易。

我想知道这个错误的原因。

我使用了上面创建的买家沙盒帐户中的信用卡号和exp日期。

我感谢任何帮助!

它在他们的文档中 :

10548无法处理此交易。 商家的帐户无法处理交易。 尝试交易的商家帐户不是PayPal的商家帐户。 检查您的帐户设置。

10549无法处理此交易。 商家的帐户无法处理交易。 尝试交易的商家帐户无法处理直接付款交易。 有关更多信息,请联系PayPal。

我会检查您帐户的状态,并确保它确实已切换为商家。 在那里捅一下,让我知道你是怎么过的!