Sample Code for Mandate Setup
You can download the below sample code and fast track your development for setting up mandates
The code samples shared here are for your reference. For further details on how the API orchestration is done can be found in the API Explorer section. Click here to access the API Explorer section.
1. Create Transaction with Mandate Setup - Sample
1.1 Create Transaction Object
{
"mercid": "BDMERICD",
"orderid": "unique order id",
"amount": "1.00",
"itemcode": "DIRECT",
"currency": "356",
"txn_process_type": "3ds",
"payment_method_type": "card",
"authentication_type": "3ds2",
"3ds_parameter": "merchant",
"device": {
"init_channel": "internet",
"ip": "<customer ip>",
"browser_ip": "<browser ip>",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; WOW64)",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"browser_tz": "-330",
"browser_color_depth": "32",
"browser_java_enabled": "false",
"browser_screen_height": "601",
"browser_screen_width": "657",
"browser_language": "en-US",
"browser_user_agent": "Mozilla/5.0 (Windows NT 10.0; WOW64)",
"browser_javascript_enabled": "true"
},
//Below mentioned object can be card, avs or upi (depending upon the selected payment method type)
"card": {
"number": "4242xxxxxxxx1234",
"expiry_month": "12",
"expiry_year": "2029",
"holder_name": "JohnDoe",
"cvv": "123"
},
"mandate": {
"mercid": "BDMERCID",
"customer_refid": "CUST614514520010012",
"subscription_refid": "SUB614514510012",
"subscription_desc": "Unlimited Plan",
"start_date": "2023-03-14",
"end_date": "2050-12-22",
"amount": "774.00",
"currency": "356",
"frequency": "adho",
"amount_type": "max"
},
"ru": "merchant return URL",
"additional_info": {
"additional_info1": "Sample1",
"additional_info2": "Sample2"
}
}{
"objectid": "transaction",
"transactionid": "U4560001100006",
"orderid": "ORDERID14032023006",
"mercid": "BDMERCID",
"transaction_date": "2023-03-14T15:42:58+05:30",
"amount": "2.00",
"surcharge": "0.00",
"discount": "0.00",
"charge_amount": "2.00",
"currency": "356",
"mandate": {
"objectid": "mandate",
"mercid": "BDMERCID",
"customer_refid": "CUST614514520010012",
"subscription_refid": "SUB614514510012",
"subscription_desc": "Unlimited Plan",
"amount": "774.00",
"amount_type": "maximum",
"start_date": "2023-03-14",
"end_date": "2050-12-22",
"frequency": "adho",
"payment_method_type": "card",
"currency": "356",
"status": "pending",
"mandateid": "MA25BF00176344",
"createdon": "2023-03-14T15:48:27+05:30",
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful"
},
"ru": "https://www.merchanturl.com/response.jsp",
"authentication_type": "3ds2",
"authentication_status": "pending",
"next_step": "3ds2_challenge",
"bankid": "456",
"itemcode": "DIRECT",
"auth_status": "0002",
"transaction_error_code": "TRP0000",
"transaction_error_desc": "Transaction Pending",
"transaction_error_type": "pending",
"payment_method_type": "card",
"card": {
"masked_value": "xxxxxxxxxxxx0005",
"type": "CREDIT",
"card_end": "0005",
"network": "MASTER",
"issuer": "SBI",
"coft_consent": "true"
},
"links": [
{
"href": "https://www.issuerurl.com/page",
"rel": "redirect",
"method": "post",
"parameters": {
"valid_till": "2023-02-16T11:43:28+05:30",
"creq": "5a7e8901aa256b4f5012355dc4b12f7bb474be6d7f09232639220163cfb1eb7e36ac8594c92379254.70675f706172616d5f656e6333"
}
}
]
}
NoteTransaction object for mandate setup above only mentions a sample code with card object with
payment_method_typeascard.Transaction + mandate setup can be initiated by passing
• network_token
• altid_token,
• cardaccountid (part of card object),
• bankaccount
• upiwithin the transaction object. Details of each object is mentioned in the below sections.
1.2 Create Transaction with card object
"card": {
"number": "4242420000001234",
"expiry_month": "12",
"expiry_year": "2029",
"holder_name": "JohnDoe",
"cvv": "123"
}1.3 Create Transaction with token object
"card": {
"network_token": {
"token_value": "1234383920541234",
"token_cryptogram": "/1234AAASMuXoH8AmglY1234=",
"token_expiry_month": "12",
"token_expiry_year": "2029"
},
"card_end": "0004",
"cvv": "123",
"holder_name": "John Doe"
}1.4 Create Transaction with cardaccountid
"card": {
"cardaccountid": "CA0AAEF9000000000123",
"cvv": "123",
"card_end": "0055",
"holder_name": "John Doe"
}1.5 Create Transaction with bankaccount object
"bankaccount": {
"number": "9000000000123",
"ifsc": "ICIC000123",
"holder_name": "John Doe"
}1.6 Create Transaction with upi object
"upi": {
"vpa": "billdesk@upi"
}1.7 Create Transaction with alt id token object
"card": {
"altid_token": {
"altid_value": "1234383920541234",
"altid_cryptogram": "/1234AAASMuXoH8AmglY1234=",
"altid_expiry_month": "12",
"altid_expiry_year": "2029"
},
"card_end": "0004",
"cvv": "123",
"holder_name": "John Doe"
}2. Update Transaction - Sample
2.1 Update Transaction
{
"mercid": "BDMERCID",
"transactionid": "X4560477641875",
"response_parameters": {
"cres": "eJytmVnTosjSgO/5FR19Lo0eVgUm7PdEsSOLoOx3bLKDAAAAAAAAAAAAAAAAAAA=="
},
"payment_method_type": "card",
//Below mentioned object can be card, avs or upi (depending upon the selected payment method type)
"card": {
"number": "4242420000001234",
"expiry_month": "12",
"expiry_year": "2029",
"cvv": "123",
"holder_name": "John Doe"
}
}{
"objectid": "transaction",
"transactionid": "U4560000467579",
"orderid": "ODR00002100001",
"mercid": "BDMERCID",
"transaction_date": "2022-03-30T00:54:25+05:30",
"amount": "2.00",
"surcharge": "0.00",
"discount": "0.00",
"charge_amount": "2.00",
"currency": "356",
"ru": "https://www.merchanturl.com/response.jsp",
"txn_process_type": "3ds",
"bankid": "456",
"itemcode": "DIRECT",
"bank_ref_no": "233317",
"auth_status": "0300",
"transaction_error_code": "TRS0000",
"transaction_error_desc": "Transaction Successful",
"transaction_error_type": "success",
"eci": "05",
"payment_method_type": "card",
"card": {
"type": "DEBIT",
"card_end": "1234",
"network": "VISA",
"issuer": "ABC Bank"
},
"mandate": {
"objectid": "mandate",
"mercid": "BDMERCID",
"customer_refid": "CUST00000101",
"subscription_refid": "SUBREF10001",
"subscription_desc": "Plan Details",
"amount": "54.00",
"amount_type": "maximum",
"start_date": "2022-03-30",
"end_date": "2050-10-22",
"frequency": "adho",
"payment_method_type": "card",
"currency": "356",
"status": "active",
"mandateid": "MA1E1700088019",
"createdon": "2022-03-30T00:54:25+05:30",
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful"
}
}3. Mandate Setup Only (without Transaction)
3.1 Create Mandate with card object
{
"mercid": "BDMERCID",
"customer_refid": "CSREF00001",
"subscription_refid": "SCREF00001",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "899.00",
"amount_type": "maximum",
"authentication_type": "3ds2",
"3ds_parameter": "merchant",
"payment_method_type": "card",
"card": {
"number": "4242420000001234",
"expiry_month": "12",
"expiry_year": "2029",
"holder_name": "John Doe",
"cvv": "123"
},
"currency": "356",
"frequency": "adho",
"device": {
"init_channel": "internet",
"ip": "<customer’s ip>",
"user_agent": "Mozilla/5.0(WindowsNT10.0;WOW64;)Gecko/20100101Firefox/51.0",
"accept_header": "application/xml;q=0.9,image/webp,image/apng,*/*;v=b3;q=0.9",
"browser_tz": "-330",
"browser_color_depth": "32",
"browser_java_enabled": "false",
"browser_screen_height": "601",
"browser_screen_width": "657",
"browser_language": "en-US",
"browser_javascript_enabled": "true"
},
"ru": "https://www.merchanturl.com/response.jsp"
}{
"objectid": "mandate",
"mandateid": "MA19E400049927",
"mercid": "BDMERCID",
"customer_refid": "CSREF00001",
"subscription_refid": "SCREF00001",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "899.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "pending",
"createdon": "2021-05-08T16:03:39+05:30",
"payment_method_type": "card",
"ru": "https://www.merchanturl.com/response.jsp",
"card": {
"masked_value": "xxxxxxxxxxxx1234",
"holder_name": "John Doe"
},
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful",
"next_step": "3ds2_challenge",
"links": [
{
"href": "https://www.issuerurl.com/page",
"rel": "redirect",
"method": "post",
"parameters": {
"valid_till": "2023-02-16T11:43:28+05:30",
"creq": "5a7e8901aa256b4f5012355dc4b12f7bb474be6d7f09232639220163cfb1eb7e36ac8594c92379254.70675f706172616d5f656e6333"
}
}
]
}3.2 Create Mandate with bankaccount object
{
"mercid": "BDMERCID",
"customer_refid": "CSREF00001",
"subscription_refid": "SCREF00001",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "899.00",
"amount_type": "maximum",
"authentication_type": "3ds2",
"3ds_parameter": "merchant",
"payment_method_type": "bankaccount",
//Below mentioned object can be card, avs or upi (depending upon the selected payment method type)
"bankaccount": {
"number": "53450000001234",
"ifsc": "ICIC000454"
},
"currency": "356",
"frequency": "adho",
"device": {
"init_channel": "internet",
"ip": "<customer’s ip>",
"user_agent": "Mozilla/5.0(WindowsNT10.0;WOW64;rv: 51.0)Gecko/20100101Firefox/51.0",
"accept_header": "application/xml;q=0.9,image/webp,image/apng,*/*;v=b3;q=0.9",
"browser_tz": "-330",
"browser_color_depth": "32",
"browser_java_enabled": "false",
"browser_screen_height": "601",
"browser_screen_width": "657",
"browser_language": "en-US",
"browser_javascript_enabled": "true"
},
"ru": "https://www.merchanturl.com/response.jsp"
}{
"objectid": "transaction",
"mercid": "BDMERCID",
"mandateid": "MA19E400049927",
"customer_refid": "CSREF00001",
"subscription_refid": "SUBREF101",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "2400.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "string",
"createdon": "string",
"payment_method_type": "card",
"ru": "https://www.merchant.com",
"card": {
"type": "debit, credit, prepaid",
"masked_value": "string",
"network": "VISA, MASTER",
"issuer": "string"
},
"verification_error_code": "string",
"verification_error_type": "string",
"verification_error_desc": "string",
"next_step": "redirect",
"links": {
"links": [
{
"href": "string",
"rel": "string",
"method": "string",
"parameters": {
"creq": "string",
"pareq": "string",
"valid_till": "string",
"AccuGuid": "string",
"AccuRequestId": "string",
"AccuCardholderId": "string",
"AccuReturnURL": "string",
"session": "string",
"TermUrl": "string",
"cardend": "string",
"MandateReqDoc": "string",
"MerchantID": "string",
"CheckSumVal": "string",
"BankID": "string",
"AuthMode": "string",
"uniqueID": "string"
}
}
]
},
"additional_info": {
"additional_info1": "Details1",
"additional_info2": "Details2",
"additional_info3": "Details3",
"additional_info4": "Details4",
"additional_info5": "Details5",
"additional_info6": "Details6",
"additional_info7": "Details7",
"additional_info8": "Details8",
"additional_info9": "Details9",
"additional_info10": "Details10"
},
"customer": {
"first_name": "John",
"last_name": "Doe",
"mobile": "9022979988",
"mobile_alt": "9022979982",
"email": "[email protected]",
"email_alt": "[email protected]"
},
"qrImage": "string",
"intent": "string",
"bank_umrn": "130a977ccabb11e7abc4cec278b6b50a@mypsp",
"bank_rrn": "string",
"valid_date": "string",
"customer_message": "capture_otp",
"avs": {
"bankaccount": [
{
"number": "12233445566",
"ifsc": "IDBK10000002",
"name": "John Doe"
}
],
"account_matched": "true",
"name_matched": "true"
}
}3.3 Create Mandate with upi object
{
"mercid": "BDMERCID",
"customer_refid": "CSREF00001",
"subscription_refid": "SCREF00001",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "899.00",
"amount_type": "maximum",
"authentication_type": "3ds2",
"3ds_parameter": "merchant",
"payment_method_type": "bankaccount",
"upi": {
"vpa": "billdesk@upi"
},
"currency": "356",
"frequency": "adho",
"device": {
"init_channel": "internet",
"ip": "<customer’s ip>",
"user_agent": "Mozilla/5.0(WindowsNT10.0;WOW64;rv: 51.0)Gecko/20100101Firefox/51.0",
"accept_header": "application/xml;q=0.9,image/webp,image/apng,*/*;v=b3;q=0.9",
"browser_tz": "-330",
"browser_color_depth": "32",
"browser_java_enabled": "false",
"browser_screen_height": "601",
"browser_screen_width": "657",
"browser_language": "en-US",
"browser_javascript_enabled": "true"
},
"ru": "https://www.merchanturl.com/response.jsp"
}{
"objectid": "transaction",
"mercid": "BDMERCID",
"mandateid": "MA19E400049927",
"customer_refid": "CSREF00001",
"subscription_refid": "SUBREF101",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "2400.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "string",
"createdon": "string",
"payment_method_type": "card",
"ru": "https://www.merchant.com",
"card": {
"type": "debit, credit, prepaid",
"masked_value": "string",
"network": "VISA, MASTER",
"issuer": "string"
},
"verification_error_code": "string",
"verification_error_type": "string",
"verification_error_desc": "string",
"next_step": "redirect",
"links": {
"links": [
{
"href": "string",
"rel": "string",
"method": "string",
"parameters": {
"creq": "string",
"pareq": "string",
"valid_till": "string",
"AccuGuid": "string",
"AccuRequestId": "string",
"AccuCardholderId": "string",
"AccuReturnURL": "string",
"session": "string",
"TermUrl": "string",
"cardend": "string",
"MandateReqDoc": "string",
"MerchantID": "string",
"CheckSumVal": "string",
"BankID": "string",
"AuthMode": "string",
"uniqueID": "string"
}
}
]
},
"additional_info": {
"additional_info1": "Details1",
"additional_info2": "Details2",
"additional_info3": "Details3",
"additional_info4": "Details4",
"additional_info5": "Details5",
"additional_info6": "Details6",
"additional_info7": "Details7",
"additional_info8": "Details8",
"additional_info9": "Details9",
"additional_info10": "Details10"
},
"customer": {
"first_name": "John",
"last_name": "Doe",
"mobile": "9022979988",
"mobile_alt": "9022979982",
"email": "[email protected]",
"email_alt": "[email protected]"
},
"qrImage": "string",
"intent": "string",
"bank_umrn": "130a977ccabb11e7abc4cec278b6b50a@mypsp",
"bank_rrn": "string",
"valid_date": "string",
"customer_message": "capture_otp",
"avs": {
"bankaccount": [
{
"number": "12233445566",
"ifsc": "IDBK10000002",
"name": "John Doe"
}
],
"account_matched": "true",
"name_matched": "true"
}
}4. Update Mandate - Sample
4.1 Update Mandate
{
"mandateid": "MA19E400049927",
"mercid": "BDMERCID",
"card": {
"number": "4242420000001234",
"expiry_month": "12",
"expiry_year": "2029",
"holder_name": "John Doe",
"cvv": "123"
},
"response_parameters": {
"cres": "eJytmFmvo8iSgN/5Fa26j1Y3qxdariMlO9hgsy8vIwyYfTGLWX794HP6VFXX1Ghujy7S0UmCzM"
}
}{
"objectid": "mandate",
"mandateid": "MA199000042326",
"mercid": "BDMERCID",
"customer_refid": "CUREF01112020001",
"subscription_refid": "SUBS01112020001",
"subscription_desc": "Unlimited Plan",
"start_date": "2020-11-03",
"end_date": "2021-10-10",
"amount": "500.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "active",
"createdon": "2020-11-03T21:34:41+05:30",
"payment_method_type": "card",
"ru": "https://www.merchanturl.com/response.jsp",
"card": {
"masked_value": "xxxxxxxxxxxx6633",
"type": "CREDIT",
"card_end": "6633",
"network": "VISA",
"issuer": "RBL Bank",
"cardaccountid": "CA07BBAA000012341234"
},
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful"
}
NoteTo manage mandates at your end you can integrate below mentioned APIs. The APIs that are listed below are
• Invoice
• Retrieve Mandate
• List of Mandates
• Modify Mandate
• Delete Mandate
5. Invoice - Sample
5.1 Invoice
{
"mercid": "BDMERCID",
"customer_refid": "CUST00D2D",
"subscription_refid": "SUBDR00DD0",
"invoice_number": "INC130230006",
"invoice_display_number": "DISP06",
"invoice_date": "2023-05-10",
"duedate": "2023-05-15",
"debit_date": "2023-05-13",
"amount": "2.00",
"net_amount": "2.00",
"currency": "356",
"mandateid": "MA099500198358",
"description": "May 2023"
}{
"invoice_number": "INC13023000006",
"objectid": "invoice",
"invoice_display_number": "DISP06",
"mercid": "BDMERCID",
"subscription_refid": "SUBDR00DD0",
"customer_refid": "CUST00D2D",
"invoice_date": "2023-05-10",
"duedate": "2023-05-15",
"debit_date": "2023-05-13",
"amount": "2.00",
"net_amount": "2.00",
"currency": "356",
"mandateid": "MA099500198358",
"description": " May 2023",
"status": "unpaid",
"invoice_id": "IA11B200076834",
"verification_error_code": "INS0000",
"verification_error_type": "Invoice Successful",
"verification_error_desc": "success",
"createdon": "2023-05-13T19:49:23+05:30"
}6. Retrieve Mandate - Sample
6.1 Retrieve Mandate
{
"mandateid": "MA19E400049927",
"mercid": "BDMERCID"
}{
"objectid": "mandate",
"mandateid": "MA199000042326",
"mercid": "BDMERCID",
"customer_refid": "CUREF01112020001",
"subscription_refid": "SUBS01112020001",
"subscription_desc": "Unlimited Plan",
"start_date": "2020-11-03",
"end_date": "2021-10-10",
"amount": "500.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "active",
"createdon": "2020-11-03T21:34:41+05:30",
"payment_method_type": "card",
"card": {
"objectid": "card",
"masked_value": "xxxxxxxxxxxx6633",
"type": "CREDIT",
"card_end": "6633",
"network": "VISA",
"issuer": "RBL Bank"
},
"ru": "https://www.merchanturl.com/response.jsp",
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful"
}7. List of Mandates - Sample
7.1 List of Mandates
{
"mercid": "BDMERCID",
"customer_refid": "CUST123456"
}{
"objectid": "list",
"mandates": [
{
"objectid": "mandate",
"mandateid": "BDMD000001",
"mercid": "BDMERCID",
"customer_refid": "CUST123456",
"subscription_refid": "1234567",
"subscription_desc": "Plan",
"start_date": "2019-12-22",
"end_date": "2022-12-22",
"amount": "500.00",
"amount_type": "max",
"currency": "356",
"frequency": "adho",
"status": "active",
"createdon": "2019-12-22T11:26:14+05:30",
"payment_method_type": "card",
"card": {
"masked_value": "xxxxxxxxxxxx1234",
"name": "John Doe"
}
}
]
}8. Modify Mandate - Sample
8.1 Modify Mandate
{
"mercid": "BDMERCID",
"mandateid": "MA178F00042312",
"end_date": "2028-12-10",
"amount": "2500.00",
"payment_method_type": "card",
"card": {
"number": "4242420000001234",
"expiry_month": "12",
"expiry_year": "2029",
"holder_name": "John Doe",
"cvv": "111"
}
}{
"objectid": "mandate",
"mandateid": "MA19E400049927",
"mercid": "BDMERCID",
"customer_refid": "CSREF00001",
"subscription_refid": "SCREF00001",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "899.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "pending",
"createdon": "2021-05-08T16:03:39+05:30",
"payment_method_type": "card",
"ru": "https://www.merchanturl.com/response.jsp",
"card": {
"masked_value": "xxxxxxxxxxxx1234",
"holder_name": "John Doe"
},
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful",
"next_step": "3ds2_challenge",
"links": [
{
"href": "https://www.issuerurl.com/page",
"rel": "redirect",
"method": "post",
"parameters": {
"valid_till": "2023-02-16T11:43:28+05:30",
"creq": "5a7e8901aa256b4f5e36ac8594c92379254.70675f706172616d5f656e6333"
}
}
]
}9. Delete Mandate - Sample
9.1 Delete Mandate
{
"mercid": "BDMERCID",
"mandateid": "MA239C00049928",
"payment_method_type": "card"
}{
"objectid": "mandate",
"transactionid": "MT210508002262",
"mandateid": "MA239C00049928",
"mercid": "BDMERCID",
"customer_refid": "CSREF00002",
"subscription_refid": "SCREF00002",
"subscription_desc": "Unlimited Plan",
"start_date": "2021-05-08",
"end_date": "2059-12-31",
"amount": "899.00",
"amount_type": "maximum",
"currency": "356",
"frequency": "adho",
"status": "deleted",
"createdon": "2021-05-08T17:38:07+05:30",
"deletedon": "2021-05-08T17:38:07+05:30",
"payment_method_type": "card",
"ru": "https://www.merchanturl.com/response.jsp",
"card": {
"masked_value": "xxxxxxxxxxxx1234",
"holder_name": "John Doe"
},
"verification_error_code": "TRS0000",
"verification_error_type": "success",
"verification_error_desc": "Transaction Successful"
}Updated 6 months ago
