0
することができます私はactivemerchetを使用してPayPalの支払いゲートウェイを実装しようとしたが、エラー・フィールドを取得しています長かったか、サーバーが取得中にエラー - フィールドは、長いか短いサーバ以外だっ
私を可能にするより短いですプロ口座の信用証明書を使用しています。私は他のSOの質問を見ましたが、それは私が
gateway = ActiveMerchant::Billing::PaypalGateway.new
に
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new
を変更し、それがうまく働いた
require 'rubygems'
require 'active_merchant'
ActiveMerchant::Billing::Base.mode = :test
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
:login => '[email protected]',
:password => 'my_password',
:signature => 'my_signature')
credit_card = ActiveMerchant::Billing::CreditCard.new(
:first_name => 'f_name',
:last_name => 'l_name',
:number => '4032034467080704',
:month => '9',
:year => '2021',
:verification_value => '123',
:brand => 'VISA'
)
AMOUNT = 1000
def purchase_options
{
ip: "127.0.0.1",
billing_address: {
name: "Flaying Cakes",
address1: "123 5th Av.",
city: "New York",
state: "NY",
country: "US",
zip: "10001"
}
}
end
if credit_card.validate.empty?
response = gateway.purchase(AMOUNT, credit_card, purchase_options)
if response.success?
puts "Successfully charged to the credit card #{credit_card.display_number}"
else
raise StandardError, response.message
end
else
puts "credit card is not valid #{credit_card.errors.full_messages.join(". ")}"
end