• Getting Started
    • Website Integration
      Mobile Integration (Android/IOS)
      Enterprise Solutions
      Accept Payments
      Process Payments
      API References
      Other Processes

      Add money to your customer’s Paytm Wallet with Paytm Payment Gateway

      Overview of Add Money

      If a customer does not have enough balance for an order/ transaction on your website/app, you can trigger an add money request to Paytm so that you can complete the payment for your order. Customer can select a pre-set amount or enter a custom amount to add. After customer submits the request, you need to do the following:

      1. Create an order in your order system and generate checksumhash at your server end for payment request. Checksumhash is used for detecting errors or tampering introduced during transmission of request. Checksum is generated using Merchant Key which should be kept only on server side for security reasons. You have to send an additional parameter in the add money request:

      2. POST the payload and checksumhash in an HTML. This redirects the customer to Paytm's add money checkout page

      3. Customer fills payment details and completes the payment authentication. Once the payment is complete, response is posted in HTML form POST on your app/website's callback URL

      4. Verify checksumhash received in response to ensure that it has not been tampered with

      5. Customer will now have the money added to her Paytm Wallet and you can continue with checkout

      Steps in Add Money via Paytm Payment Gateway

      Step 1 :

      At the click of Add money button by customer on your website, create an order in your system and generate the required payload for payment request. Parameters of payload are provided below

      Request Attributes

      REQUEST_TYPE String(50) MandatoryTransaction Type: ADD_MONEY
      MID String(20) MandatoryThis is the “Merchant Identifier” that is issued by Paytm to the Merchant. This is unique for each merchant that integrates with Paytm
      ORDER_ID String(50) MandatoryThe “Order ID” is the Merchant’s Transaction ID which should be unique for every transaction. Duplicate order id will be rejected by the Paytm gateway
      CUST_ID String(64) MandatoryThe “Customer ID” is the customer identifier. This could be a unique user Id that the Merchant has assigned to its customers. This parameter is required for correlating the user to a transaction. Multiple transactions can have the same Application User Name if the same customer is performing multiple transactions. The Application User Name is used by Paytm’s fraud prevention engine for detecting fraudulent transactions/users. Special characters e.g @, ! ,_ $ are allowed
      TXN_AMOUNT String(10) MandatoryThis is the “Transaction Amount” that is to be charged the customer’s credit card /debit card /bank account / Paytm Wallet. Should contain digits up to two decimal points. Only special character allowed is (“.”) . Please ensure that the amount is in the same currency as defined for the Merchant ID being used.
      CHANNEL_ID String(3) MandatoryChannel ID need to pass in this parameter. Ex:
      1. WEB – for desktop websites
      2. WAP – for mobile websites
      INDUSTRY_TYPE_ID String(20) MandatoryIndustry type should pass here. This will be provided by Paytm. Ex: “Retail1”
      WEBSITE String(30) MandatoryWEBSITE Name should passed here. This will be provided by Paytm
      CHECKSUMHASH String(108) OptionalChecksum calculated based on pre-defined logic. Checksum is used to ensure data is not tempered when request is posted on the Paytm URLS. In case of checksum mismatch due to data tempering Paytm will reject the transaction.
      SSO_TOKEN String(36) MandatorySSO_TOKEN of user.
      CALLBACK_URL String(255) MandatoryOn completion of transaction, Paytm payment gateway will send the response on this URL. Sample URL is - https://merchant.com/callback/

      Step 2 :

      Generate checksumhash using Paytm library with parameters in key value pairs. Using the payload and checksumhash make an HTML form post and redirect customer to Paytm server. Code snippets and Github links for the checksum utility and HTML form post are provided below.

      /* initialize a TreeMap object */
      TreeMap<String, String> paytmParams = new TreeMap<String, String>();
      /* Find your MID in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */ paytmParams.put("MID", "YOUR_MID_HERE");
      /* this will be ADD_MONEY */ paytmParams.put("REQUEST_TYPE", "ADD_MONEY");
      /* Find your WEBSITE in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */ paytmParams.put("WEBSITE", "YOUR_WEBSITE_HERE");
      /* Find your INDUSTRY_TYPE_ID in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */ paytmParams.put("INDUSTRY_TYPE_ID", "YOUR_INDUSTRY_TYPE_ID_HERE");
      /* WEB for website and WAP for Mobile-websites or App */ paytmParams.put("CHANNEL_ID", "YOUR_CHANNEL_ID");
      /* Enter your unique order id */ paytmParams.put("ORDER_ID", "YOUR_ORDER_ID");
      /* unique id that belongs to your customer */ paytmParams.put("CUST_ID", "CUSTOMER_ID");
      /* customer's mobile number */ paytmParams.put("MOBILE_NO", "CUSTOMER_MOBILE_NUMBER");
      /* customer's email */ paytmParams.put("EMAIL", "CUSTOMER_EMAIL");
      /* this is an unique token linked to paytm user, provided by paytm */ paytmParams.put("SSO_TOKEN", "SSO_TOKEN_OF_USER");
      /** * Amount in INR that is needs to be added * this should be numeric with optionally having two decimal points */ paytmParams.put("TXN_AMOUNT", "ORDER_TRANSACTION_AMOUNT");
      /* on completion of transaction, we will send you the response on this URL */ paytmParams.put("CALLBACK_URL", "YOUR_CALLBACK_URL");
      /** * Generate checksum for parameters we have * You can get Checksum JAR from https://developer.paytm.com/docs/checksum/ * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys */ String checksum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum("YOUR_KEY_HERE", paytmParams);
      /* for Staging */ String url = "https://securegw-stage.paytm.in/order/process";
      /* for Production */ // String url = "https://securegw.paytm.in/order/process";
      /* Prepare HTML Form and Submit to Paytm */ StringBuilder outputHtml = new StringBuilder(); outputHtml.append("<html>"); outputHtml.append("<head>"); outputHtml.append("<title>Merchant Checkout Page</title>"); outputHtml.append("</head>"); outputHtml.append("<body>"); outputHtml.append("<center><h1>Please do not refresh this page...</h1></center>"); outputHtml.append("<form method='post' action='" + url + "' name='paytm_form'>");
      for(Map.Entry<String,String> entry : paytmParams.entrySet()) { outputHtml.append("<input type='hidden' name='" + entry.getKey() + "' value='" + entry.getValue() + "'>"); }
      outputHtml.append("<input type='hidden' name='CHECKSUMHASH' value='" + checksum + "'>"); outputHtml.append("</form>"); outputHtml.append("<script type='text/javascript'>"); outputHtml.append("document.paytm_form.submit();"); outputHtml.append("</script>"); outputHtml.append("</body>"); outputHtml.append("</html>");
      Staging: https://securegw-stage.paytm.in/order/process
      Production: https://securegw.paytm.in/order/process

      HTML Form Post

              <title>Merchant Check Out Page</title>
              <center><h1>Please do not refresh this page...</h1></center>
              <form method="post" action="https://securegw-stage.paytm.in/order/process?ORDER_ID=YOUR_ORDER_ID" name="paytm">
                  <table border="1">
                          <input type="hidden" name="MID" value="YOUR_MID_HERE">
                          <input type="hidden" name="WEBSITE" value="YOUR_WEBSITE_HERE">
                          <input type="hidden" name="REQUEST_TYPE" value="ADD_MONEY">
                          <input type="hidden" name="SSO_TOKEN" value="SSO_TOKEN_OF_USER">
                          <input type="hidden" name="ORDER_ID" value="YOUR_ORDER_ID">
                          <input type="hidden" name="CUST_ID" value="CUSTOMER_ID">
                          <input type="hidden" name="MOBILE_NO" value="CUSTOMER_MOBILE_NUMBER">
                          <input type="hidden" name="EMAIL" value="CUSTOMER_EMAIL">
                          <input type="hidden" name="INDUSTRY_TYPE_ID" value="YOUR_INDUSTRY_TYPE_ID_HERE">
                          <input type="hidden" name="CHANNEL_ID" value="YOUR_CHANNEL_ID">
                          <input type="hidden" name="TXN_AMOUNT" value="ORDER_TRANSACTION_AMOUNT">
                          <input type="hidden" name="CALLBACK_URL" value="YOUR_CALLBACK_URL">
                          <input type="hidden" name="CHECKSUMHASH" value="GENERATED_CHECKSUM_VALUE">
              <script type="text/javascript">

      Step 3 :

      Customer fills the payment details and is redirected to bank page for authorization. Once the transaction is authorized, Paytm receives the response from the bank and returns a status to your website via your callback URL. Response attributes description and sample HTML form post is provided below :

      Response Sent by Paytm

      MID String(20)This is a unique merchant Id provided to merchant by Paytm at the time of merchant creation
      TXNID String (length: upto 64 digits, datatype: long)This is a unique Paytm transaction Id that is issued by Paytm for each valid transaction request received from the merchant.
      ORDERID String(50)This is the application transaction Id that was sent by merchant to Paytm at the time of transaction request.
      BANKTXNID StringThe transaction Id sent by the bank/wallet (NULL or empty string if the transaction doesn't reaches to the bank).
      TXNAMOUNT String(10)The amount of the transaction.
      CURRENCY String(3)Currency used for transaction.
      STATUS String(20)This contains the transaction status and has only three values:
      RESPCODE String(10)Codes refer to a particular reason of payment failure/success. List in this PDF
      RESPMSG String(500)Description message is linked with each respcode. List in this PDF
      TXNDATE DateTimeDate of transaction.
      GATEWAYNAME String(15)Gateway used by Paytm (ICICI/CITI/WALLET etc)
      BANKNAME String(500)Bank name of the card issuing bank.
      PAYMENTMODE String(15)The payment mode used for transaction.
      CHECKSUMHASH String(108)Checksum calculated based on pre-defined logic
           <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
           <title>Paytm Secure Online Payment Gateway</title>
            <table align='center'>
                  <td><STRONG>Transaction is being processed,</STRONG></td>
                  <td><font color='blue'>Please wait ...</font></td>
                  <td>(Please do not press 'Refresh' or 'Back' button</td>
                  <input type='hidden' name='CURRENCY' value='PAYMENT_CURRENCY'>
                  <input type='hidden' name='CUST_ID' value='CUSTOMER_ID'>
                  <input type='hidden' name='GATEWAYNAME' value='GATEWAY_USED_BY_PAYTM'>
                  <input type='hidden' name='RESPMSG' value='PAYTM_RESPONSE_MESSAGE_DESCRIPTION'>
                  <input type='hidden' name='BANKNAME' value='BANK_NAME_OF_ISSUING_PAYMENT_MODE'>
                  <input type='hidden' name='PAYMENTMODE' value='PAYMENT_MODE_USED_BY_CUSTOMER'>
                  <input type='hidden' name='MID' value='YOUR_MID_HERE'>
                  <input type='hidden' name='RESPCODE' value='PAYTM_RESPONSE_CODE'>
                  <input type='hidden' name='TXNID' value='PAYTM_TRANSACTION_ID'>
                  <input type='hidden' name='TXNAMOUNT' value='ORDER_TRANSACTION_AMOUNT'>
                  <input type='hidden' name='ORDERID' value='YOUR_ORDER_ID'>
                  <input type='hidden' name='STATUS' value='PAYTM_TRANSACTION_STATUS'>
                  <input type='hidden' name='BANKTXNID' value='BANK_TRANSACTION_ID'>
                  <input type='hidden' name='TXNDATE' value='TRANSACTION_DATE_TIME'>
                  <input type='hidden' name='CHECKSUMHASH'  value='PAYTM_GENERATED_CHECKSUM_VALUE'>
       <script type="text/javascript">  document.forms[0].submit();</script>    

      Step 4 :

      Checksumhash received in response of transaction needs to be verified on merchant server using Paytm library with all the parameters in key value pairs. Code snippets and Github links for the checksum utility are provided here

      Step 5 :

      Customer will be able to see the added amount in his/her Wallet.