ActiveMerchant:买方帐户余额不会减少 [英] ActiveMerchant: Buyer Account Balance Doesn't Decrease

查看:117
本文介绍了ActiveMerchant:买方帐户余额不会减少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将ActiveMerchant gem与Ruby 1.9.3和Rails 3.1一起使用

I'm using ActiveMerchant gem with Ruby 1.9.3 and Rails 3.1

我已经使用WebPayments Pro在PayPal上设置了买方虚拟帐户和卖方虚拟帐户。当我运行此脚本并查看我的Paypal沙箱时,我的卖方帐户已正确存入10美元的资金。

I already set up a buyer dummy account and a seller dummy account on PayPal using WebPayments Pro. When I run this script and look in my paypal sandbox, my seller account is deposited $10 in funds correctly.

问题是当我为买方查看沙箱时帐户,余额不会减少。我的卖家从哪里得到钱?

The problem is that when I look at the sandbox for my buyer account, the balance does not decrease. Where is my seller getting the money from?

我的代码在这里:

require "rubygems"
require "active_merchant"

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

gateway = ActiveMerchant::Billing::PaypalGateway.new(
  :login => "seller_1328509472_biz_api1.gmail.com",
  :password => "*******",
  :signature => "******"
)

credit_card ||= ActiveMerchant::Billing::CreditCard.new(
  :type               => "visa",
  :number             => "4193536536887351",
  :verification_value => "123",
  :month              => 2,
  :year               => 2017,
  :first_name         => "TESTING",
  :last_name          => "BUYER"
)

if credit_card.valid?
  response = gateway.authorize(1000, credit_card, :ip => "98.248.144.120", :billing_address => { :name => 'Test User', :company => '', :address1 => '1 Main St', :address2 => '', :city => 'San Jose', :state => 'CA', :zip => '95131'})
  if response.success?
    gateway.capture(1000, response.authorization)
  else
    puts "Response Unsuccessful Error: #{response.message}"
  end
else
  puts "Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}"
end

请帮助我!我已经坚持了很久了,我很困惑。

Please help me! I have been stuck on this for ages, and I am very confused.

推荐答案

因为您直接指定了信用卡,没有这样的帐户可以从中提取资金。
您使用的API方法DoDirectPayment直接向信用卡收费。它没有连接到PayPal帐户,也没有使用PayPal帐户的余额。

Because you're specifying a credit card directly, there is no 'account' as such that it takes the funds from. The API method you're using, DoDirectPayment, charges a credit card directly. It is not connected to a PayPal account, nor does it use the balance of a PayPal account.

如果您想使用PayPal帐户而非信用卡付款,请使用PayPal Express Checkout: http://railscasts.com/episodes/146-paypal-express-checkout

If you want to charge a PayPal account rather than a credit card, use PayPal Express Checkout: http://railscasts.com/episodes/146-paypal-express-checkout

这篇关于ActiveMerchant:买方帐户余额不会减少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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