POSTSave Card API
Use Case
This API is used to save the cards along with the card details for a given user of Merchant.
Request Attributes
Head
Attribute | Description |
---|---|
version string mandatory | Version of the API. Example: v1 |
requestId string mandatory | Unique reference ID which is given in request payload |
requestTimestamp string mandatory | EPOCH timestamp of the time at which request is being sent. |
token string mandatory | Authorization string corresponding to the tokenType used. Example: 739816707d7444XXXXXXXX6cb4264d0a1590145379323 |
tokenType string mandatory | This parameter identifies whether the API works on checksum authentication. The value to be sent in tokenType is 'JWT' for this API. |
Body
Attribute | Description | ||||||
---|---|---|---|---|---|---|---|
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 | ||||||
custId string mandatory | Unique user ID maintained by the merchant | ||||||
mcin string optional | Unique Reference ID of a card maintained by the merchant/Paytm. | ||||||
encryptedCardNumber string mandatory | Encrypted card number | ||||||
expiryYear string mandatory | Card expiry year. Format: YYYY | ||||||
expiryMonth string mandatory | Card Expiry Month Format: MM, Example: 01, 02 ,12 | ||||||
customerName object optional | Name of the card holder | ||||||
CustomerName +
|
Response Attributes
Head
Attribute | Description |
---|---|
version string | Version of the API passed in the request. |
responseTimeStamp string | EPOCH timestamp of the time at which response is being sent. |
Body
Attribute | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
resultInfo string | This parameter gives the information about the result of the API response | ||||||||
ResultInfo +
| |||||||||
cardIndexNumber string | Unique Card Index Number of a card generated by Paytm. |
Payload for JWT Token
{
"mid": "{mid}",
"custId": "CUST_001",
"requestId": "1234",
"encryptedCardNumber": "GGjcqXXXXXXXXdjSxx",
"expiryYear": "2023",
"expiryMonth": "02",
"iat": {current-unix-epoch-time}
}
Error Codes and Messages
ErrorCode | ErrorStatus | ErrorMsg |
---|---|---|
0000 | S | Success |
4001 | F | Card doesn't exist for given parameters |
4002 | F | MID doesn't exist |
4003 | F | JWT Token is invalid |
4004 | F | Request Parameters are not valid |
4005 | F | Mandatory Parameters missing |
4006 | F | Update on card not supported |
4007 | F | Card Decryption failed |
4008 | F | Internal Server error |
4009 | F | Card already exists |
4100 | F | Either mcin or cin should be passed. |
4101 | F | System error |
4102 | F | Mid/RequestId in the query param doesn't match with the Mid/RequestId send in the request. |
00000900 | U | Unknown Error |
curl --location --request POST 'https://securegw-stage.paytm.in/savedcardservice/vault/cards/saveCard?mid={mid}&requestId=1234' \
--header 'Content-Type: application/json' \
--data-raw '{
"head": {"version": "v1","requestTimestamp": "1544614590000","requestId":"1234","token": "eyJhbGciOiJIUzI1NiIsInR5cXXXXXXXXXXXXXXXXXXXljbWL7BshADPIWYxo_cC_JEaTenhOrs","tokenType": "JWT"},
"body": {"mid":"{mid}","custId":"CUST_001","mcin":"1234","encryptedCardNumber":"obkE6ByZHmXYXXXXXXXXXXXX+OB1AmU5USgGw==","expiryYear":"2025","expiryMonth":"04","customerName":{"firstName":"test", "lastName":"user"}}}'