---
page_source: https://juspay.io/sea/docs/hyper-checkout-sea/react-native/mandates-subscriptions/mandate-registration-setting-up-a-subscription
page_title: Mandate Registration (Setting up a subscription)
---


# 1. Mandate Registration(Setting up a subscription)



To register a subscription, pass subscription related parameters in the Session API to open the HyperCheckout screen with the subscription supported Payment Methods. Post transaction completion, use Order Status API and Webhooks to capture mandate registration details.


### Step 1.1. Open the Hypercheckout Screen with Mandate Details


Pass mandate related parameters in **Session** **API** . Make sure all the required fields for mandates are passed correctly.**Mandate related parameters to be passed** 


### Payload
- **Options.create_mandate**:
  - Description: Enum: 'REQUIRED' , "OPTIONAL'.
    
    Defines what kind mandate support is available during a session. 
    
      * Chose between the follow values based upon requirements :-REQUIRED : Mandate is must for completing transaction. Only instruments which support Mandate will be shown
      * OPTIONAL : Mandate is a user choice for completing transaction.
  - Tags: String, Mandatory
- **Mandate.max_amount**:
  - Description: This is the maximum amount which can be debited via mandate. Please be informed that the value assigned to "**mandate.max_amount** " will be displayed to the user when they open any UPI apps for payment. The value assigned to "**amount** " field will be used to show the amount on our Hypercheckout page
  - Tags: String, Mandatory
- **Mandate.start_date**:
  - Description: Mandate start date in UNIX EPOCH timestamp (UTC timezone).**Default** : will be today’s date
  - Tags: String
- **Mandate.end_date**:
  - Description: Mandate end date in UNIX EPOCH timestamp (UTC timezone). Post end date, mandate will move to **EXPIRED**  state and recurring mandate will not be allowed.**Default:**  will be Mandate start date + 30 years
  - Tags: String
- **Mandate.frequency**:
  - Description: Defines the frequency of mandate execution, how often a customer should be charged.Data type **ENUM:** **ONETIME (Supported only by UPI), DAILY, WEEKLY, FORTNIGHTLY, MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY, YEARLY, ASPRESENTED** 
    
    **Default:** `ASPRESENTED`
    
    **Note:** 1. Daily is not supported by Billdesk and Paytm (For cards)2. In UPI AutoPay, ONETIME frequency, Mandate is valid only for 90 Days
  - Tags: String
- **Mandate.rule_value**:
  - Description: When frequency is passed as WEEKLY, FORTNIGHTLY, MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY, or YEARLY then is it required that the exact day of the period should be passed.1-7 when frequency is WEEKLY. In weekly, serial numbers start from Monday. Monday represents 1 and Sunday represents 7.
    
    1-16 when frequency is FORTNIGHTLY. This mandate is executed twice a month. First day of the month is represented by value '1' and ends with '15' on 15th day of the month. Then again starts with '1' for 16th of the month and ends with the last day of the month.
    
    1-31 when frequency is MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY, or YEARLY.
    
    Not required when frequency is ONETIME, DAILY, ASPRESENTED.For Razorpay, rule_value will be considered as the last date of the week/month/year. For Paytm, rule_value will be considered as today's date/day
  - Tags: String
- **Mandate.amount_rule**:
  - Description: Data type **ENUM: FIXED, VARIABLE** .By default, it is considered as VARIABLE. In case of FIXED **amount_rule**
  - Tags: String
- **Mandate.block_funds**:
  - Description: Set to `true` if funds have to be blocked while a mandate is being created. Should be true for **ONETIME**  and false for **Recurring** . By default value will be **TRUE**  for ONETIME and **FALSE**  for Recurring.
  - Tags: String





### Step 1.2 Handle Payment Response with Mandate Details


Post the transaction is completed, it is mandatory to do a Server-to-Server **Order Status API**  call to determine the final payment status.Please ensure that you verify the order ID and amount transaction. 

In the response of the request, you will receive a Mandate  block, which will contain important parameters like `mandate_id` and `mandate_status`to know the actual status of the particular mandate.

You will receive same details in 1. [Order Level Webhooks](https://docs.juspay.in/hyper-checkout/web/mandates-subscriptions/webhook-in-mandates#Order) - Details about the particular order created, will contain Mandate block containing Mandate Details2. [Mandate Level Webhooks](https://docs.juspay.in/resources/docs/common-resources/mandate-webhook) - Webhooks updating details about the Mandate Status, whenever the status will change at our end, a Mandate Level webhook will be triggered. 

![Image](/images/payment_status_handling.png)



**Mandate related parameters received in the order status response and webhooks** 


### Payload
- **Txn_object_type**:
  - Description: Type of the transaction. For mandate transaction below will be the enum values.**Enum values:**  Mandate_Register, Mandate_Payment, Emandate_Register, Emandate_Payment, TPV_Emandate_Register, TPV_Emandate_Payment
  - Tags: String
- **Mandate_status**:
  - Description: Status of the mandate.**Enum values:**  ACTIVE, FAILURE, REVOKE, PAUSED, CREATED
  - Tags: String
- **Mandate_id**:
  - Description: Unique ID generated by JusPay for the given mandate
  - Tags: String, Mandatory, Max Length : 255
- **Mandate_type**:
  - Description: Type of mandate based on the payment method.**Enum values** : Mandate, EMandate
  - Tags: String, Mandatory




## Sample Code Snippets:
### Step 1: Call Mandate Session API:

#### Request Code Snippet:

```request
curl --location --request POST 'https://api.juspay.in/session' \
    --header 'x-merchantid: yourMerchantId' \
    --header 'Authorization: Basic base64encodedkey==' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "amount":"10.00",
    "order_id":"yourUniqueOrderId",
    "customer_id":"yourUniqueCustId",
    "customer_phone":"customer_phone",
    "customer_email":"customer_email",
    "payment_page_client_id":"client_id",
    "return_url": "https://shop.merchant.com",
    "action":"paymentPage",
    "options.create_mandate":"OPTIONAL/REQUIRED",
    "mandate.max_amount":"1000.00",
}'

```

#### Response Code Snippet:

```response
{
  "status": "NEW",
  "id": "ordeh_1662a30d94224d4a9a2cdc4c26ee9f37",
  "order_id": "FC37B98B00",
  "payment_links": {
    "web": 
    "https://api.juspay.in/orders/ordeh_1662a30d94224d4a9a2cdc4c26ee9f37/payment-page"
  },
  "sdk_payload": {
    "requestId": "76a19a48b9344be683430a99fde5fd8f",
    "service": "in.juspay.hyperpay",
    "payload": {
      "options.createMandate": "REQUIRED",
      "clientId": "client_id",
      "amount": "2.0",
      "merchantId": "merchant_id",
      "environment": "production",
      "mandate.maxAmount": "10.00",
      "mandate.endDate": "1646234827",
      "action": "paymentPage",
      "customerId": "yourUniqueCustId",
      "returnUrl": "http://localhost:3111/dashboard/systems/orderStatus",
      "mandate.startDate": "1644420442",
      "currency": "INR",
      "customerPhone": "9876543210",
      "customerEmail": "dummyemail@gmail.com",
      "orderId": "yourUniqueOrderId"
    }
  }
}

```

#### eNACH Request Code Snippet:

```enach request
curl --location --request POST 'https://api.juspay.in/session' \
    --header 'x-merchantid: yourMerchantId' \
    --header 'Authorization: Basic base64encodedkey==' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "amount":"10.00",
    "order_id":"yourUniqueOrderId",
    "customer_id":"yourUniqueCustId",
    "customer_phone":"9876543210",
    "customer_email":"dummyemail@gmail.com",
    "payment_page_client_id":"picasso",
    "return_url": "https://shop.merchant.com",
    "action":"enach",
    "service":"in.juspay.ec",
    "options.create_mandate":"REQUIRED",
    "mandate.max_amount":"1000.00",
    "mandate.start_date":"1644420442",
    "mandate.end_date":"1646234827"
}'
```

#### eNACH Response Code Snippet:

```enach response
{
    "status": "NEW",
    "id": "ordeh_7d32b2e428ba423f9d0ecf9575b23759",
    "order_id": "yourUniqueOrderId",
    "payment_links": {
        "web": "https://sandbox.juspay.in/orders/ordeh_7d32b2e428ba423f9d0ecf9575b23759/payment-page",
        "expiry": "2023-10-26T08:27:07Z"
    },
    "sdk_payload": {
        "requestId": "d9d65b3f4a6342559898ba6d20e88f93",
        "service": "in.juspay.hyperpay",
        "payload": {
            "options.createMandate": "REQUIRED",
            "clientId": "picasso",
            "amount": "10.0",
            "merchantId": "yourmerchantid",
            "clientAuthToken": "tkn_932acc174f4f4a5fbeeba72a7a1b8135",
            "service": "in.juspay.ec",
            "clientAuthTokenExpiry": "2023-10-26T08:27:07Z",
            "environment": "sandbox",
            "mandate.maxAmount": "1000.00",
            "mandate.endDate": "1646234827",
            "action": "enach",
            "customerId": "yourUniqueCustId",
            "returnUrl": "https://shop.merchant.com",
            "mandate.startDate": "1644420442",
            "currency": "INR",
            "customerPhone": "9876543210",
            "customerEmail": "dummyemail@gmail.com",
            "orderId": "yourUniqueOrderId"
        },
        "expiry": "2023-10-26T08:27:07Z"
    }
}
```

### Step 2: Get Mandate Order status:

#### Request:
```plaintext
curl GET 'https://api.juspay.in/orders/{{order_id}}' \
--header 'x-merchantid: merchant_id' \
--header 'Authorization: Basic <base64 of key:>'
--header 'version: 2020-12-31'
```

#### Response:
```plaintext
{
  "udf9": "",
  "udf8": "",
  "udf7": "",
  "udf6": "",
  "udf5": "",
  "udf4": "",
  "udf3": "",
  "udf2": "",
  "udf10": "",
  "udf1": "",
  "txn_uuid": "eulmyxQn6bQso6y1Syy",
  "txn_id": "juspay-234823498237423894273498-1",
  "txn_detail": {
    "txn_uuid": "eulmyxQn6bQso6y1Syy",
    "txn_object_type": "EMANDATE_REGISTER",
    "txn_id": "juspay-234823498237423894273498-1",
    "txn_amount": 1,
    "tax_amount": null,
    "surcharge_amount": null,
    "status": "CHARGED",
    "source_object_id": "91887",
    "source_object": "MANDATE",
    "redirect": true,
    "order_id": "234823498237423894273498",
    "net_amount": 1,
    "gateway_id": 19,
    "gateway": "PAYTM_V2",
    "express_checkout": false,
    "error_message": "",
    "error_code": "",
    "currency": "INR",
    "created": "2020-08-30T09:53:17Z"
  },
  "status_id": 21,
  "status": "CHARGED",
  "return_url": "https://api.juspay.in",
  "refunded": false,
  "product_id": "",
  "payment_method_type": "UPI",
  "payment_method": "UPI",
  "payment_links": {
    "web": "https://api.juspay.in/merchant/pay/ordeu_9a0929803da644df8036133cf14d0206"
  },
  "payment_gateway_response": {
    "txn_id": "juspay-234823498237423894273498-1",
    "rrn": "4299662",
    "resp_message": "Txn Success",
    "resp_code": "01",
    "epg_txn_id": "202008301131312168187301880189",
    "created": "2020-08-30T09:54:10Z",
    "auth_id_code": ""
  },
  "payer_vpa": "9999999999@paytm",
  "order_id": "234823498237423894273498",
  "metadata": {
    "PAYTM_V2:gateway_reference_id": "upimandate"
  },
  "merchant_id": "juspay",
  "mandate": {
    "start_date": "1598745600",
    "rule_value": 30,
    "rule_type": "AFTER",
    "revokable_by_customer": true,
    "max_amount": 1000,
    "mandate_type": "EMANDATE",
    "mandate_token": "ad1d28b13f460fb5d348487be790f3",
    "mandate_status": "ACTIVE",
    "mandate_id": "3XMEcS1z2212Gq7fbfVYbzj",
    "frequency": "MONTHLY",
    "end_date": "1606521610",
    "block_fund": false,
    "amount_rule": "VARIABLE"
  },
  "id": "ordeu_9a0929803da644df8036133cf14d0206",
  "gateway_reference_id": "upimandate",
  "gateway_id": 19,
  "date_created": "2020-08-30T09:47:46Z",
  "customer_phone": "9999999999",
  "customer_id": "cst_lz7zmpemoo5okv",
  "customer_email": "customer@gmail.com",
  "currency": "INR",
  "bank_error_message": "",
  "bank_error_code": "",
  "auth_type": "",
  "amount_refunded": 0,
  "amount": 1
}

```

#### Response (Mandate + TPV):
```json
{
    "customer_email": "dummyemail@gmail.com",
    "customer_phone": "9876543000",
    "customer_id": "cust*****de",
    "status_id": 27,
    "status": "CHARGED",
    "id": "ordeh_bh*****ke",
    "merchant_id": "merchant_id",
    "amount": 1,
    "currency": "INR",
    "order_id": "tpvflowtest",
    "date_created": "2023-11-27T11:24:00Z",
    "return_url": "https://mid.in",
    "product_id": "",
    "payment_links": {
        "iframe": "https://api.juspay.in/orders/ordeh_b******be/payment-page",
        "web": "https://api.juspay.in/orders/ordeh_b*******be/payment-page",
        "mobile": "https://api.juspay.in/orders/ordeh_b*****be/payment-page"
    },
    "udf1": "",
    "udf2": "",
    "udf3": "",
    "udf4": "",
    "udf5": "",
    "udf6": "",
    "udf7": "",
    "udf8": "",
    "udf9": "",
    "udf10": "",
    "txn_id": "mid-tpvflowtest-1",
    "payment_method_type": "UPI",
    "auth_type": "",
    "payment_method": "COLLECT",
    "refunded": false,
    "amount_refunded": 0,
    "effective_amount": 1,
    "mandate": {
        "mandate_token": "75********9",
        "mandate_status": "ACTIVE",
        "mandate_id": "i6********cy",
        "mandate_type": "EMANDATE",
        "start_date": "1701084291",
        "end_date": "2647855491",
        "revokable_by_customer": true,
        "block_fund": false,
        "max_amount": 1000,
        "frequency": "ASPRESENTED",
        "amount_rule": "VARIABLE"
    },
    "resp_code": null,
    "resp_message": null,
    "bank_error_code": "00",
    "bank_error_message": "Your transaction is successful",
    "txn_uuid": "mo****S",
    "txn_detail": {
        "txn_id": "mid-tpvflowtest-1",
        "order_id": "tpvflowtest",
        "status": "CHARGED",
        "error_code": "00",
        "net_amount": 1,
        "surcharge_amount": null,
        "tax_amount": null,
        "txn_amount": 1,
        "offer_deduction_amount": null,
        "gateway_id": 514,
        "currency": "INR",
        "express_checkout": false,
        "redirect": true,
        "txn_uuid": "mo*******S",
        "gateway": "YES_BIZ",
        "error_message": "Your transaction is successful",
        "txn_object_type": "TPV_EMANDATE_REGISTER",
        "source_object": "MANDATE",
        "source_object_id": "430400013",
        "created": "2023-11-27T11:24:50Z",
        "txn_flow_type": "COLLECT"
    },
    "payment_gateway_response": {
        "resp_code": "00",
        "rrn": "369779777323",
        "created": "2023-11-27T11:24:51Z",
        "epg_txn_id": null,
        "resp_message": "Your transaction is successful",
        "auth_id_code": null,
        "txn_id": "AX*******1",
        "gateway_response": {
            "amount": "1000.00",
            "gatewayReferenceId": "36*****3",
            "gatewayResponseCode": "00",
            "gatewayResponseMessage": "Your transaction is successful",
            "gatewayResponseStatus": "success",
            "merchantChannelId": "mid",
            "merchantId": "mid",
            "merchantRequestId": "AX*****1",
            "orgMandateId": "YJ*****S",
            "payeeMcc": "7322",
            "payeeVpa": "mid@yespay",
            "payerVpa": "your_vpa@id",
            "refUrl": "https://www.juspay.com/",
            "remarks": "Debit Money For UPI Autopay",
            "tpvValidationStatus": "SUCCESS",
            "umn": "9******i"
        }
    },
    "gateway_id": 514,
    "payer_vpa": "yourvpa@id",
    "upi": {
        "payer_vpa": "yourvpa@id",
        "txn_flow_type": "COLLECT"
    },
    "metadata": {
        "payment_page_sdk_payload": "{\"amount\":\"1.00\",\"orderType\":\"TPV_PAYMENT\",\"metadata.bankAccountDetails\":\"[{\\\"bank_account_number\\\":\\\"5****1\\\",\\\"bank_ifsc\\\":\\\"HDFC0000000\\\", \\\"bank_beneficiary_name\\\" : \\\"Your Name\\\"}]\",\"action\":\"paymentPage\",\"paymentFilter\":{\"allowDefaultOptions\":false,\"options\":[{\"paymentMethodType\":\"UPI\",\"enable\":true}]}}",
        "payment_page_client_id": "mid",
        "bank_account_details": "[{\"bank_account_number\":\"50*****1\",\"bank_ifsc\":\"HDFC0000000\", \"bank_beneficiary_name\" : \"Your Name\"}]"
    },
    "amount_debited": 1
}
```

