POSTInitiate Subscription API
Use Case
- To create a subscription with required subscription details like upfront transaction amount, frequency, subscription amount type etc. A subscription ID is provided in return which needs to be stored and passed in corresponding payment collection and cancellation requests.
- To generate a transaction token. This token is valid for 15 minutes from the time of its creation. This token enables you to call all the subsequent APIs while creation of subscription from your client.
Request Attributes
Head
Attribute | Description |
---|---|
clientId string optional | Paytm use the merchant key on the basis of clientId parameter value. It requires only if the merchant has more than one key. Example: C11 |
version string optional | Version of the API. Example: v1 |
requestTimestamp string optional | EPOCH timestamp of the time at which request is being sent. |
channelId string optional | The parameter value identifies the Channel for which API call is initiated. Possible values:
WEB
,
For websites, the value to be passed should be "WEB"
WAP
For Mobile websites/App, the value to be passed should be "WAP"
|
signature string mandatory | Paytm validates the request and ensures that parameters are not tempered by verifying the signature in the request. For creating the checksum (signature) refer to the steps given in Checksum Logic. |
Body
Attribute | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
requestType string mandatory | This parameter is used to identify the transaction flow. Its value shall be as mentioned below: 'NATIVE_SUBSCRIPTION' for 'Subscription'. | ||||||||||||
mid string mandatory | Paytm provides MID as a unique identifier to each merchant. For your staging MID, click here. You get the production MID post the account activation. Example: INTEGR7769XXXXXX9383 | ||||||||||||
orderId string(50) mandatory | The Unique reference ID of the Order. It is alphanumeric and special characters allowed are “@” “-” “_” “.”. | ||||||||||||
websiteName string mandatory | This is provided by Paytm and it defines the static response URL. | ||||||||||||
txnAmount object mandatory | The first payment amount to be charged to the customer at the time of subscription creation. Example: {"value" : "1.00", "currency" : "INR"} | ||||||||||||
TxnAmount +
| |||||||||||||
userInfo object mandatory | User information contains user details like customer ID, email, phone number etc. | ||||||||||||
UserInfo +
| |||||||||||||
paytmSsoToken string optional | This is a unique token linked with user's Paytm wallet and is provided in the response while linking user's Paytm wallet. Example: eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..xxxxxxxxxxx.9iHTtWbCZ0I6qbn2sUnyz5siw1fqbmtEnFMFE7nSIX-yrwCkiGfAC6QmPr9q-tw8LMPOh5-3UXRbpeVZEupQd3wNyaArWybRX2HAxJDRD8mxJ_wxzJM6GZ1ov4O3EIsx2Y_Zr0aHCd3VbnTjRUnlVdxXJPFG8QZs0b_2TVdoAX3_QjZS8_dwcmIWoH8ebDzOIs7MJacETfMtyFGAo8Xc0LjznToUWvTsTbIXQoF1yB0.1fZFAYJVsY61BTv2htLcXQ8800/ | ||||||||||||
callbackUrl string optional | Paytm sends the response of transaction on the URL which comes in the callbackUrl parameter. Note: If not passed, the transaction response will be sent to the url configured against the parameter passed in websiteName. If the payment option is BANK_MANDATE, the response will be sent to configured BM URL but not the websiteName parameter. | ||||||||||||
extendInfo object optional | Merchant can pass any order specific information that is required to be passed here. | ||||||||||||
ExtendInfo +
| |||||||||||||
subscriptionAmountType string mandatory | The amount to be charged in each frequency cycle can be fixed or capped to max amount. Possible values are :
| ||||||||||||
subscriptionMaxAmount string conditional | Maximum amount that can be charged to the customer in each frequency cycle. Mandatory: Only if subscriptionAmountType is VARIABLE. | ||||||||||||
renewalAmount string conditional | Amount to be charged to the customer in each frequency cycle. | ||||||||||||
autoRenewal boolean optional | Preference to enable auto renewal for this subscription. Possible values:
true
,
To enable Autorenewal
false
Else
| ||||||||||||
autoRetry boolean optional | Preference to enable auto retry for failed collect transactions. Possible values:
true
,
To enable Autoretry
false
Else
| ||||||||||||
communicationManager boolean optional | Preference to enable sending notification to customers for the subscription events. | ||||||||||||
subscriptionFrequencyUnit string mandatory | This, combined with interval, defines the frequency. The values supported for this attribute currently are: weekly, monthly, bimonthly, quarterly, semi-annually, yearly and on-demand (as presented). If the billing cycle is of 2 months, the value for this attribute would be BI_MONTHLY. | ||||||||||||
subscriptionStartDate string mandatory | This is the date when first payment collection can be charged to the customer. Subsequent payment collectionscan be charged by customer after a definite period defined with subscriptionFrequency and subscriptionFrequencyUnit. Format of date is YYYY-MM-DD | ||||||||||||
subscriptionGraceDays string conditional | Number of days after payment collection due date for which merchant can send renewal request. Mandatory if subscriptionStartDate is sent in request. Not supported for eNACH | ||||||||||||
subscriptionExpiryDate string mandatory | Date when subscription will expire. Payment collection request will not be allowed after the expiry date. Format should be YYYY-MM-DD. | ||||||||||||
subscriptionEnableRetry string mandatory | Merchant can retry a transaction in case of failure from bank/wallet Not supported for eNACH | ||||||||||||
subscriptionRetryCount string optional | Count of payment collection retries allowed in case of failure of collection request .
Not supported for eNACH | ||||||||||||
appInvokeDevice string conditional | For App Invoke Device (Payment via Paytm app). Possible values:
3P
,
By Default
DEEPLINKQR
Payment By QR
| ||||||||||||
mandateType string conditional | Required in Bank Mandate Possible Values: E_MANDATE, PAPER_MANDATE | ||||||||||||
mandateAccountDetails object optional | Mandate Account Detail - For Stardard Checkout (Redirection Flow) | ||||||||||||
MandateAccountDetails +
| |||||||||||||
enablePaymentMode Array of objects optional | List of the payment modes which needs to enable. If the value provided then only listed payment modes are available for transaction. | ||||||||||||
PaymentMode +
| |||||||||||||
disablePaymentMode Array of objects optional | List of the payment modes which need to disable. If the value provided then all the listed payment modes are unavailable for transaction. | ||||||||||||
PaymentMode +
|
Response Attributes
Head
Attribute | Description |
---|---|
clientId string(3) | Paytm use the merchant key on the basis of clientId parameter value. It requires only if the merchant has more than one key. Example: C11 |
version string(2) | Version of the API passed in the request. |
responseTimestamp string(15) | EPOCH timestamp of the time at which response is being sent. |
signature string(108) | You should validate the parameter values by verifying the signature comes in the response. It ensures that parameter values not tempered. Signature string can be verified by using Paytm checksum library. |
Body
Attribute | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
resultInfo object | This parameter gives the information about the result of the API response | ||||||||
ResultInfo +
| |||||||||
txnToken string | Paytm security token for a transaction valid for either one transaction or for 15 minutes. All subsequent API calls in creation will require this token.
| ||||||||
subscriptionId string | Unique subscription Id generated by Paytm for identifying a subscription. | ||||||||
authenticated boolean | True when ssoToken is provided in request and it is valid. |
Response Codes & Messages
resultCode | resultStatus | resultMsg |
---|---|---|
0000 | S | Subscription initiated successfully |
900 | U | System error |
1007 | F | Missing mandatory element |
1008 | F | Pipe character is not allowed |
2004 | F | SSO Token is invalid |
2005 | F | Checksum provided is invalid |
2007 | F | Txn amount is invalid |
2009 | F | Duplicate request, with same orderId is already in progress |
2013 | F | Mid in the query param doesn’t match with the Mid send in the request |
2014 | F | OrderId in the query param doesn’t match with the OrderId send in the request |
2022 | F | Invalid Subs payment mode |
2022 | F | Paymode selected is not enabled for your merchant account. Please reach out to support teams to enable |
4001 | F | Invalid Subscription start date. |
4001 | F | Invalid Frequency Unit |
4001 | F | Invalid Subscription Amount Type |
4001 | F | Invalid Max Amount |
4001 | F | Grace days cannot be greater than the frequency set against the subscription |
4001 | F | Txn Amount can not be non-zero in case of Bank Mandates |
4001 | F | Invalid AppInvokeDevice |
4001 | F | Grace days value is mandatory |
4004 | F | Max amount is greater than the permissible amount limit for available paymodes |
4006 | F | Add and Pay Payments are not allowed for this subscription |
00000900 | F | Transaction amount cannot be greater than the max amount set against the subscription |
curl -X POST 'https://securestage.paytmpayments.com/subscription/create?mid={mid}&orderId=ORDERID_98765' \
--header 'Content-Type: application/json' \
--data '{"body":{"requestType":"NATIVE_SUBSCRIPTION","mid":"{mid}","websiteName":"WEBSTAGING","orderId":"ORDERID_98765","subscriptionAmountType":"FIX","subscriptionEnableRetry":"1","subscriptionFrequencyUnit":"MONTH","subscriptionExpiryDate":"2031-05-20","txnAmount":{"value":"10.00","currency":"INR"},"userInfo":{"custId":"CUST_001"},"callbackUrl":"https://merchant.com/callback"},"head":{"signature":"{signature}"}}'