- Copy the 'samplekit' folder in document root of your server (like /var/www/html)
- The 'samplekit' folder is having the following files:
- TxnTest.html - Testing transaction through Paytm gateway.
- generate_checksum.rb - This file has the logic of checksum generation and passing all required parameters to Paytm PG.
- verify_checksum.rb - This file has the logic for processing PG response after the transaction processing.
- paytm/encryption_new_pg.rb - This is the library file.
- Open generate_checksum.rb file from the folder and update the below values (these can be downloaded from the Paytm portal. One time downloadable).
- PAYTM_MERCHANT_KEY = ""
- WEBSITE = ""
- MID = ""
- INDUSTRY_TYPE_ID = ""
- CHANNEL_ID = ""
- Provide the required values by running the TxnTest.html file and click on the 'submit' button to process a test transaction.
- Create an associative array with key value pair of following paytm parameters (MID, ORDER_ID, CUST_ID, INDUSTRY_TYPE_ID, CHANNEL_ID, TXN_AMOUNT, EMAIL, WEBSITE)
- To generate checksum, call the following method. This function returns the checksum as a string. new_pg_checksum(paytmparams, merchant key).gsub("\n",'') where,
- 'paytmparams' is an associative array containing Paytm parameters.
- 'merchant key' is the Paytm Merchant Key provided by Paytm.
- Get all the parameters received from Paytm and put them in an associative array (“key => value” pair).
- Get the CHECKSUMHASH parameter value received from Paytm store in a variable and remove the parameter from the array
- To verify checksum call the following function. This function returns a Boolean (true/false) new_pg_verify_checksum(paytmparams, check_sum, merchant_key) where,
- 'paytmparams': is a parameter array which was created in step 1 of this section (NOTE: Do not include the CHECKSUMHASH parameter)
- 'check_sum' : Is the CHECKSUMHASH parameter as received in step 2.
- 'merchant_key': Is the merchant key received from Paytm
- Create an associative array with key value pair of following paytm parameters (MID, ORDERID, TXNTYPE, REFUNDAMOUNT, TXNID, REFID)
- To generate checksum, call the following method. This function returns the checksum as a string. new_pg_refund_checksum(paytmparams, merchant key).gsub("\n",'') where,
- 'paytmparams' is an associative array containing Paytm parameters.
- 'merchant key' is the Paytm Merchant Key provided by Paytm.