尝试使沙盒贝宝与Rails一起工作时出错? [英] error trying to make sandbox paypal to work with rails?

查看:103
本文介绍了尝试使沙盒贝宝与Rails一起工作时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将Paypal付款网关与Rails集成时遇到问题.我将在下面解释我的步骤.

I am having problems integrating paypal payment gateway with rails. I will explain below the steps i did.

我首先去了 developer.paypal.com

我创建了两个沙箱帐户,一个用于买方,一个用于商业帐户.

I created two sandbox accounts one for buyer and one for business account.

我已将企业帐户更改为Business-Pro

I changed business account to Business-Pro

然后我将活跃商人的宝石安装在导轨中.

I then installed activemerchant gem in rails.

在config/environments/development.rb文件中,我粘贴了以下代码块

In config/environments/development.rb i pasted the following chunk

  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

然后在控制器中,我创建了一种测试方法并粘贴了代码以进行结帐

Then in controller i created a test method and pasted code to do 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

当我执行控制器方法时,出现以下错误

when i execute the controller method i get the following error

此交易无法处理.商家的帐户不是 能够处理交易.

This transaction cannot be processed. The merchant's account is not able to process transactions.

我想知道此错误的原因.

I am wondering the reason for this error.

我使用了我在上面创建的买方沙盒帐户中的信用卡号和有效日期.

I used credit card number and exp date from the buyer sandbox account i created above.

我非常感谢您的帮助!

I appreciate any help!

推荐答案

位于他们的

10548无法处理此事务.商家的帐户无法处理交易.尝试进行交易的商家帐户不是PayPal上的企业帐户.检查您的帐户设置.

10548 This transaction cannot be processed. The merchant's account is not able to process transactions. The merchant account attempting the transaction is not a business account at PayPal. Check your account settings.

-

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

10549 This transaction cannot be processed. The merchant's account is not able to process transactions. The merchant account attempting the transaction is not able to process Direct Payment transactions. Contact PayPal for more information.

我会检查您的帐户状态,并确保已将其绝对用于业务.在那里戳一戳,让我知道你过得如何!

I'd check the status of your account and ensure it's definitely switched to business. Have a poke around it there and let me know how you get on!

这篇关于尝试使沙盒贝宝与Rails一起工作时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆