Skip to content

Instantly share code, notes, and snippets.

@aguayma
Created July 6, 2018 15:52
Show Gist options
  • Save aguayma/9bcd087135424d24d93b1b8e4a44b1b2 to your computer and use it in GitHub Desktop.
Save aguayma/9bcd087135424d24d93b1b8e4a44b1b2 to your computer and use it in GitHub Desktop.
PSIGate Response
gateway = ActiveMerchant::Billing::PsigateGateway.new(login: ENV['STORE_ID'],password: ENV['STORE_PWD'])
credit_card = ActiveMerchant::Billing::CreditCard.new(
first_name: 'John',
last_name: 'Doe',
number: '4111111111111111',
month: '12', year: '2019',
verification_value: '123'
)
billing_details = {
address1: '123 Fake St',
address2: '',
city: 'Riverside',
state: 'New York',
zip: '11722',
country: 'Canada'
}
purchase_options = {
order_id: Time.now.to_i,
billing_address: billing_details,
email: 'email@email.com',
sub_total: 602
}
response = gateway.purchase(602, credit_card, purchase_options)
<ActiveMerchant::Billing::Response:0x00007fe642f8a838 @params={
"message"=>"Global Error Receipt", "complete"=>false, "transtime"=>"Fri Jul 06 11:41:23 EDT 2018",
"orderid"=>"1530891635", "transactiontype"=>"SALE", "approved"=>"APPROVED", "returncode"=>"Y:419173:2357434:M:Y:NNN",
"errmsg"=>nil, "taxtotal"=>"0.00", "shiptotal"=>"0.00", "subtotal"=>"6.02", "fulltotal"=>"6.02",
"paymenttype"=>"CC", "cardnumber"=>"......1111", "transrefnumber"=>"1c01a08764e2b50f",
"cardidresult"=>"M", "avsresult"=>"Y", "cardauthnumber"=>"419173", "cardrefnumber"=>"2357434",
"cardtype"=>"VISA", "ipresult"=>"NNN", "ipcountry"=>nil, "ipregion"=>nil, "ipcity"=>nil}, @message="Success",
@success=true, @test=true, @authorization="1530891635;1c01a08764e2b50f", @fraud_review=nil, @error_code=nil,
@emv_authorization=nil, @avs_result={"code"=>"Y", "message"=>"Street address and 5-digit postal code match.",
"street_match"=>"Y", "postal_match"=>"Y"}, @cvv_result={"code"=>"M", "message"=>"CVV matches"}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment