---
page_source: https://juspay.io/sea/docs/hyper-checkout-sea/react-native/mandates-subscriptions/mandate-execution-auto-debit-of-subscription
page_title: Mandate Execution (Auto debit of Subscription)
---


# Mandate Execution(Auto debit of Subscription)



After successful mandate registration, the next step is auto debit of the subscription for next renewal cycle. You need to call the Mandate Execute API at least 25 hours before the auto debit date. Post that, bank will notify the user about the debit via SMS. Follow the steps mentioned below to integrate Mandate Execution successfully.


### Step 2.0. Updated Mandate Status


This is an optional but recommended step. It’s always better to know the status of the Mandate before calling the Execution API, to avoid calling revoked or expired mandates. There are multiple ways to know the mandate Status 

1. Consume Mandate Status Webhooks
2. Use **Mandate Status Check API**  - This API can be called to get the status of a particular mandate setup with us; we will sync with PGs to get the latest Mandate Status value and update back in our response, or share the latest Mandate Status stored with us in DB.
3. Use [List Mandate API](https://docs.juspay.in/hyper-checkout/web/mandates-subscriptions/list-mandate-api) - This API can be called to get the list of all the mandates that a customer has with them. The list will have the revoked, expired and failed mandates too.




### Step 2.1. Call Mandate Execution API


Call **Mandate Execution API** (Server to Server call) to initiate a recurring debit transaction.After the successful Mandate registration, Merchant will receive a mandate_id, mandate_token from Juspay that should be stored against a customer at their end. For the subsequent charge transactions, this API need to be called which will create an order and perform a transaction with PG based on the mandate_id passed in the request.

> **Warning**
> Call this API atleast 25 hrs. prior to the execution date. Always use a unique new order_id for the recurring payment in this API.






### Step 2.2. Consume Notification Webhooks


Once the Execution API is successfully hit, Juspay will initiate the transaction with the underlying PG. Subsequently, the bank will notify the user of the debit via SMS. To track the notification status, you need to consume the Notification Webhook.

If the notification is successful, Juspay will trigger a Notification Success webhook, and the amount will be debited from the user's account accordingly.

However, if the notification fails, Juspay will initiate a Notification Failure webhook. In this scenario, the Mandate Execution API must be re-initiated.

Check out the [Flow Diagram](/hyper-checkout/web/mandates-subscriptions/mandate-integration-architecture) to know in detail about handling the Notification webhook.

> **Warning**
> Till the notification and execution takes place, transaction status will be Pending. According to RBI, notification will be triggered for cards and UPI only.






### Step 2.3. Handle Mandate Execution Response


To determine the status of the transaction (whether it's a success, failure, or pending), call the [Order Status API](/hyper-checkout/web/base-sdk-integration/order-status-api) and consume[Webhooks](https://docs.juspay.in/resources/docs/common-resources/mandate-webhook). You will receive a mandate block in the response.



## Sample Code Snippets:
### Top Header:

#### Mandate Status Check Request Code Snippet:

```mandate status check request
curl --location 'https://sandbox.juspay.in/mandates/hyhTD5Ga4jJ2KXZwwnyh4A' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-routing-id: customer_1122'\
--header 'Authorization: your api key' \
--data-urlencode 'command=check_status'

```

#### Mandate Status Check Response Code Snippet:

```mandate status check response
{
  "order_id": "juspayKTestTxns849",
  "frequency": "ASPRESENTED",
  "end_date": "2633068438",
  "status": "ACTIVE",
  "activated_at": "2023-06-09T07:59:32Z",
  "last_activated_at": "2023-06-09T07:59:32Z",
  "amount_rule": "VARIABLE",
  "last_updated": "2023-06-09T07:59:32Z",
  "start_date": "1686293709",
  "mandate_debit_token": "tkn_88620327ecf64826ad5cea548a1554d4",
  "customer_id": "cst_z1fsoxwyhvp5gj13",
  "mandate_id": "hyhTD5Ga4jJ2KXZwwnyh4A",
  "block_fund": false,
  "currency": "INR",
  "max_amount": 20,
  "mandate_token": "4a1d3fd9727e4b95bdc5cfd60aa12530",
  "revokable_by_customer": true,
  "payment_info": {
    "payment_method": "PAY",
    "payment_method_type": "UPI"
  },
  "mandate_type": "EMANDATE"
}

```

### Bottom Header:

#### Mandate Execution Request:
```json
curl --location 'https://api.juspay.in/txns' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic <base64 of key:>' \
--data-urlencode 'order.order_id=unique_order_id' \
--data-urlencode 'order.amount=1.00' \
--data-urlencode 'order.customer_id=customer_id' \
--data-urlencode 'merchant_id=merchantid' \
--data-urlencode 'mandate_id=mandate_id' \
--data-urlencode 'mandate.execution_date=1622369936' \
--data-urlencode 'format=json'
```

#### Mandate Execution Response:
```plaintext
{
  "txn_uuid": "eulmN9X8JpeC7qK6AJq",
  "txn_id": "merchant_id-order_id-1",
  "status": "PENDING_VBV",
  "payment": {
    "authentication": {
      "url": "https://api.juspay.in/v2/pay/finish/merchant_id/eulmN9X8JpeCxxxxxJq/2621",
      "method": "GET"
    }
  },
  "order_id": "order_id"
}
```

