Escolar Documentos
Profissional Documentos
Cultura Documentos
Create a payment gateway client which initiates payment request and returns the
result of the transactions. Unlike the conventional payment gateway this payment
gateway directly debits the amount from the consumer account and credits it into
merchants account and returns the result of transactions.
Step2:
Create SHA1 digest of above string and append it to the above string like
bank_ifsc_code=icci0000000bank_account_number=111111111amount=10000.00
merc hant_transaction_ref=txn0001transaction_date=2014-1114payement_gateway_merchant_reference=merc001hash=asdfasdf01293949dfsdf
sd1
lets call it payment_with_sha)
Step3:
Then encrypt the string using AES128CBC Algorithm of openssl and encode it using
BASE64Encoding (lets call it payload_to_pg).You will need a KEY to use AES128
which is also with the payment gateway. Use this key:
Q9fbkBF8au24C9wshGRW9ut8ecYpyXye5vhFLtFdGjRg3a4HxPYRfQaKutZx5N4
payload_to_pg=BASE64ENCODE (AES128CBC(payload_with_sha))
Step4:
Now we pass this to payment gateway server using any HTTP client as post
parameter named msg.
Step 5:
After successful or failed payment, the payment gateway gives us a response which
is encrypted the same way we have created and encrypted the request.
The correct order to read the response is:
1) Decode using Base64Decode
2) Decrypt using AES128CBC and your key
3) Verify the response (generate the hash for the rest of the string and verify with
given hash)
The payment gateway response contain the following details
txn_status=success or failure
amount
merchant_transaction_ref
transaction_date
payment_gateway_merchant_reference
payment_gateway_transaction_reference=pg_txn0001