活跃的红宝石商人

发布于 2024-12-05 15:54:01 字数 2131 浏览 3 评论 0原文

可能的重复:
Paypal with Rails 中的商家配置无效

我正在使用活跃商人宝石。我使用 Railscast(144) 并创建了一个 ruby文件 (credit_card.rb):

require "rubygems"
require "active_merchant"

ActiveMerchant::Billing::Base.mode = :test

gateway = ActiveMerchant::Billing::PaypalGateway.new(
  :login => "seller_1316503855_biz_api1.agileblaze111.com",
  :password => "********",
  :signature => "A5llddES-nIiDc8WBuZMOtm6yM2oANQrerVY20ty0ZxeN-izmKjwDtR0"
)

credit_card = ActiveMerchant::Billing::CreditCard.new(
  :type               => "visa",
  :number             => "4234609806354393",
  :verification_value => "123",
  :month              =>  '9',
  :year               =>  '2016',
  :first_name         => "shamith",
  :last_name          => "c"
)

billing_address = { 
    :name     => "John Smith",
    :address1 => '123 First St.',
    :address2 => '33333',
    :city     => 'Los Angeles',
    :state    => 'CA',
    :country  => 'US',
    :zip      => '90068',
    :phone    => '310-555-1234'
}

 billing_address1 = {
    :name => 'Test User',
    :company => '',
    :address1 => '123 S Main St',
    :address2 => '',
    :city => 'Akron',
    :state => 'OH',
    :country => 'US',
    :zip => '44333',
    :phone => '(310)555-5555'
  } 


if credit_card.valid?
  puts "Credit Card is valid"
  response=gateway.purchase(1000,credit_card,:ip=>"127.0.0.1",:billing_address=>billing_address1)
  if response.success?
     puts "Purchased"
  else
     puts "Error:#{response.message}"
  end
else
  puts "Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}"end

我执行 $ ruby​​credit_card.rb 并收到以下错误:

Error: This transaction cannot be processed due to an invalid merchant configuration.

Possible Duplicate:
An invalid merchant configuration in Paypal with rails

I am playing with the Active Merchant gem. I used Rails cast(144) and I created a ruby file (credit_card.rb):

require "rubygems"
require "active_merchant"

ActiveMerchant::Billing::Base.mode = :test

gateway = ActiveMerchant::Billing::PaypalGateway.new(
  :login => "seller_1316503855_biz_api1.agileblaze111.com",
  :password => "********",
  :signature => "A5llddES-nIiDc8WBuZMOtm6yM2oANQrerVY20ty0ZxeN-izmKjwDtR0"
)

credit_card = ActiveMerchant::Billing::CreditCard.new(
  :type               => "visa",
  :number             => "4234609806354393",
  :verification_value => "123",
  :month              =>  '9',
  :year               =>  '2016',
  :first_name         => "shamith",
  :last_name          => "c"
)

billing_address = { 
    :name     => "John Smith",
    :address1 => '123 First St.',
    :address2 => '33333',
    :city     => 'Los Angeles',
    :state    => 'CA',
    :country  => 'US',
    :zip      => '90068',
    :phone    => '310-555-1234'
}

 billing_address1 = {
    :name => 'Test User',
    :company => '',
    :address1 => '123 S Main St',
    :address2 => '',
    :city => 'Akron',
    :state => 'OH',
    :country => 'US',
    :zip => '44333',
    :phone => '(310)555-5555'
  } 


if credit_card.valid?
  puts "Credit Card is valid"
  response=gateway.purchase(1000,credit_card,:ip=>"127.0.0.1",:billing_address=>billing_address1)
  if response.success?
     puts "Purchased"
  else
     puts "Error:#{response.message}"
  end
else
  puts "Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}"end

I execute $ ruby credit_card.rb and get the following error:

Error: This transaction cannot be processed due to an invalid merchant configuration.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧时浪漫 2024-12-12 15:54:01

您的 ActiveMerchant::Billing::PaypalGateway 线路有问题。我最近也经历过这个,并遇到了这个问题。

我发布了

我的沙盒帐户类型不正确并且没有正确的凭据,因此遇到了多个问题。

我最终发现的一件有用的事情是,在开发人员网站上,您可以创建新的沙箱帐户等,左侧有一个链接,您可以在其中查看沙箱帐户生成的任何 API 凭据。当我发现该链接时,我的链接是空白的,这导致我创建一个新的沙箱帐户并按照 Paypal 文档方法获取凭据。

如果这有帮助或没有帮助,请发帖,因为我仍在学习如何使用 active_merchant 和 Paypal 沙箱,并且需要我能得到的所有练习。

Something is incorrect with your ActiveMerchant::Billing::PaypalGateway line. I recently went through this as well, and hit that problem.

I posted this link to the Paypal documentation in the comments to that episode. There they describe the current process to get the API credentials you need, as the rails cast is about two years old and slightly out of date.

I had multiple problems with my sandbox account not being the correct type and not having the correct credentials.

One helpful thing I eventually found was, on the developers site, where you can create new sandbox accounts and such, there's a link on the left-hand side where you can view any API credentials that your sandbox accounts have generated. Mine were blank when I found that link, which is what lead me to creating a new sandbox account and following the Paypal documentation method to getting credentials.

Please post if this helps or if it doesn't, as I'm still learning how to use active_merchant and the Paypal sandbox and need all the practice I can get.

萌梦深 2024-12-12 15:54:01

您需要使用 Website Payments Pro 设置卖家帐户。

  1. 使用预配置选项创建您的销售测试帐户。
  2. 帐户类型下,选择网站付款专业版

祝你好运!

You need to have a seller account set up with Website Payments Pro.

  1. Create your selling test account using the Preconfigured option.
  2. Under Account Type, select Website Payments Pro.

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文