I cannot seem to run a test transaction with the Payeezy ruby gem. I also tried without the gem and it isn't working. Below is my code, which is basically derived from the tests in the gem repo.
require 'payeezy'
def primary_tx_payload
credit_card = {}
payload = {}
payload[:merchant_ref] = 'Astonishing-Sale'
payload[:amount]='1200'
payload[:currency_code]='USD'
payload[:method]='credit_card'
credit_card[:type] = 'visa'
credit_card[:cardholder_name] = 'John Smith'
credit_card[:card_number] = '4788250000028291'
credit_card[:exp_date] = '1020'
credit_card[:cvv] = '123'
payload[:credit_card] = credit_card
payload
end
options = {}
options[:url] = 'https://api-cert.payeezy.com/v1/transactions'
options[:tokenURL] = 'https://api-cert.payeezy.com/v1/transactions/tokens'
options[:apikey] = Hidden but from API part of Sandbox (starts with 'YVbV')
options[:apisecret] = Hidden but from API part of Sandbox (starts with '79e3')
options[:token] = Hidden but from Merchant part of Sandbox/dasbhoard (starts w/'fdoa')
@payeezy = Payeezy::Transactions.new options
@payeezy.transact(:purchase, primary_tx_payload)
=> {"correlation_id"=>"228.1456272226956", "Error"=>{"messages"=>[{"code"=>"401", "description"=>"Access denied"}]}}
Mohith,
Typically the 401 error occurs when the API credentials or Merchant token or js_security_key is incorrect:
Did you take a look at our ruby sample code in Github? I ran the payeezy_test file in the repository and it worked fine for the purchase transaction. Please have a look - https://github.com/payeezy/payeezy_direct_API/tree/master/payeezy_ruby/example
Regards,
Payeezy team
I got a approved response when i used the same code above, But later when i added the new merchant(demo account) however i got the approved response and transaction was success, but could find any transaction list in the merchant account. Could you please help me out.
Please provide the correlation ID in the response for further review. It sounds like you may be using the default Acme Socks sandbox merchant and not the newly added demo merchant.
Initially i tested it with Acme Socks, Later steps
Selected Add a Demo Merchant
Added Merchant ID(MID) - 9780278580
Added Gateway ID - FHXXXX-70
Added Gateway Password
Added HMAC KEY
Got created Merchant with status: Approved.
===
Response:
{"correlation_id"=>"124.0883298028356", "transaction_status"=>"approved", "validation_status"=>"success", "transaction_type"=>"purchase", "transaction_id"=>"ET175050", "transaction_tag"=>"2225244452", "method"=>"credit_card", "amount"=>"120", "currency"=>"USD", "cvv2"=>"M", "token"=>{"token_type"=>"FDToken", "token_data"=>{"value"=>"9552139365918291"}}, "card"=>{"type"=>"visa", "cardholder_name"=>"John Smith", "card_number"=>"8291", "exp_date"=>"1020"}, "bank_resp_code"=>"100", "bank_message"=>"Approved", "gateway_resp_code"=>"00", "gateway_message"=>"Transaction Normal"}
====
Unable to track this transaction.
In Demo Account Under terminal of ECOMM the API access is mentioned as
Request URI: /transaction/v12
Request Content Type: SOAP.
I am using payeezy gem.
I see the transaction record with the correlation ID provided.
====== TRANSACTION RECORD ========== InmateAid DEMO0245 HSR Bangalore 560034 India TYPE: Purchase ACCT: Visa $ 1.20 USD CARDHOLDER NAME : John Smith CARD NUMBER : ############8291 DATE/TIME : 24 Oct 17 04:16:20 REFERENCE # : 03 000002 T AUTHOR. # : ET175050 TRANS. REF. : IA-Sale Approved - Thank You 100 Please retain this copy for your records. Cardholder will pay above amount to card issuer pursuant to cardholder agreement.
Keep in mind the transaction/v12 endpoint is for our Webservice API and NOT the Payeezy Developer APIs.