---
page_source: https://docs.juspay.io/upi-autopay/docs/how-to-integrate/webhooks
page_title: Webhooks
---


# Webhooks: 




## For Transaction Status: 



For every transaction status update, we will provide a callback to the configured webhook URL.


#### Success Code Snippet:

```success
{
    "event_name": "ORDER_SUCCEEDED",
    "content": {
        "order": {
            "bank_pg": null,
            "payer_vpa": "test@upi",
            "payment_method": "COLLECT",
            "customer_phone": "9999999999",
            "payment_gateway_response": {
                "txn_id": "123-1",
                "rrn": "22222",
                "debit_amount": "100.0",
                "auth_id_code": "",
                "resp_message": "",
                "epg_txn_id": "3333333",
                "resp_code": "captured",
                "created": "2024-01-01T07:51:04Z"
            },
            "txn_id": "123-1",
            "order_id": "123",
            "maximum_eligible_refund_amount": "FILTERED",
            "udf9": "FILTERED",
            "txn_detail": {
                "txn_id": "123-1",
                "order_id": "123",
                "error_code": "",
                "source_object": "MANDATE",
                "txn_flow_type": "FILTERED",
                "txn_object_type": "FILTERED",
                "status": "CHARGED",
                "express_checkout": false,
                "gateway_id": 100,
                "error_message": "",
                "tax_amount": null,
                "currency": "INR",
                "source_object_id": "FILTERED",
                "txn_amount": 100,
                "created": "2024-01-23T07:50:20Z",
                "gateway": "RAZORPAY",
                "surcharge_amount": null,
                "txn_uuid": "mozazudkjpCkZWKNfxo",
                "net_amount": 100,
                "redirect": true
            },
            "customer_id": "001",
            "amount": 100,
            "amount_debited": "FILTERED",
            "status": "CHARGED",
            "status_id": 21,
            "offers": [],
            "product_id": "",
            "refunded": false,
            "gateway_id": 100,
            "date_created": "2024-01-01T07:50:20Z",
            "id": "ordeh_123",
            "merchant_id": "juspay",
            "return_url": "https://returnurl.com",
            "effective_amount": 100,
            "currency": "INR",
            "auth_type": "",
            "customer_email": "abc@gmail.com",
            "upi": "FILTERED",
            "payment_method_type": "UPI",
            "txn_uuid": "asdfghjkl",
            "mandate": {
                "max_amount": 500,
                "mandate_id": "zxcv123",
                "start_date": "1605996220",
                "frequency": "ASPRESENTED",
                "mandate_type": "EMANDATE",
                "mandate_token": "FILTERED",
                "revokable_by_customer": true,
                "amount_rule": "VARIABLE",
                "block_fund": false,
                "mandate_status": "ACTIVE",
                "end_date": "2119493800"
            },
            "payment_links": {
                "mobile": "https://api.juspay.in/orders/ordeh_123/payment-page",
                "web": "https://api.juspay.in/orders/ordeh_123/payment-page",
                "iframe": "https://api.juspay.in/orders/ordeh_123/payment-page"
            },
            "amount_refunded": 0,
            "bank_error_code": "",
            "bank_error_message": ""
        }
    }

```

#### Failure  Code Snippet:

```failure 
{
    "event_name": "ORDER_FAILED",
    "content": {
        "order": {
            "bank_pg": null,
            "payer_vpa": "test@upi",
            "payment_method": "COLLECT",
            "customer_phone": "9999999999",
            "payment_gateway_response": {
                "txn_id": "123-1",
                "rrn": "",
                "debit_amount": "100.0",
                "auth_id_code": "",
                "resp_message": "Payment was unsuccessful",
                "epg_txn_id": "asdfghjkl",
                "resp_code": "failed",
                "created": "2024-01-01T08:48:50Z"
            },
            "txn_id": "123-1",
            "order_id": "123",
            "gateway_reference_id": null,
            "txn_detail": {
                "txn_id": "123-1",
                "order_id": "123",
                "error_code": "failed",
                "source_object": "MANDATE",
                "txn_flow_type": "FILTERED",
                "txn_object_type": "FILTERED",
                "status": "AUTHORIZATION_FAILED",
                "express_checkout": false,
                "gateway_id": 100,
                "error_message": "Payment was unsuccessful",
                "tax_amount": null,
                "currency": "INR",
                "source_object_id": "FILTERED",
                "txn_amount": 100,
                "created": "2024-01-01T08:38:46Z",
                "gateway": "DUMMY",
                "surcharge_amount": null,
                "txn_uuid": "zxcvb",
                "net_amount": 100,
                "redirect": true
            },
            "customer_id": "001",
            "amount": 100,
            "amount_debited": "FILTERED",
            "status": "AUTHORIZATION_FAILED",
            "status_id": 27,
            "offers": [],
            "product_id": "",
            "refunded": false,
            "gateway_id": 23,
            "date_created": "2024-01-23T08:38:46Z",
            "id": "ordeh_123",
            "merchant_id": "juspay",
            "return_url": "https://returnurl.com",
            "effective_amount": 100,
            "currency": "INR",
            "auth_type": "",
            "customer_email": "abc@gmail.com",
            "upi": "FILTERED",
            "payment_method_type": "UPI",
            "txn_uuid": "zxcvb",
            "mandate": {
                "max_amount": 500,
                "mandate_id": "ads123",
                "start_date": "1705998943",
                "frequency": "ASPRESENTED",
                "mandate_type": "EMANDATE",
                "mandate_token": "FILTERED",
                "pg_response": {FILTERED},
                "revokable_by_customer": true,
                "amount_rule": "VARIABLE",
                "block_fund": false,
                "mandate_status": "FAILURE",
                "end_date": "2184690143"
            },
            "payment_links": {
                "mobile": "https://api.juspay.in/orders/ordeh_123/payment-page",
                "web": "https://api.juspay.in/orders/ordeh_123/payment-page",
                "iframe": "https://api.juspay.in/orders/ordeh_123/payment-page"
            },
            "amount_refunded": 0,
            "bank_error_code": "failed",
            "bank_error_message": "Payment was unsuccessful"
        }
    }

```



## For Mandate Status:



For every mandate status update, we will provide a callback to the configured webhook URL.


| Status  | Description |
|---|---|
| CREATED | Mandate has been created, but awaiting status from PG. |
| ACTIVE | When PG accepts the chosen mode of payment, the mandate is set to the active state. This is a terminal state until mandate expires or customer/merchant wants to revoke the mandate. |
| FAILURE | Mandate creation was unsuccessful. This is a terminal state, the merchant has to create a new mandate if failed. |



#### Created Code Snippet:

```created
{
  "id": "evt_V2_a2f864be94fb4fde88cd1056cbf88beb",
  "event_name": "MANDATE_CREATED",
  "date_created": "2021-12-18T10:15:35Z",
  "content": {
    "mandate": {
      "status": "CREATED",
      "start_date": "1639802535",
      "end_date": "3093465599",
      "revokable_by_customer": "true",
      "payment_info": {
        "upi": {
          "payer_vpa": "yourname@mypsp2" 
        },
        "payment_method_type": "UPI",
        "payment_method": "COLLECT/PAY/INAPP"
      },
      "order_id": "1631719633",
      "max_amount": "399",
      "mandate_type": "EMANDATE",
      "mandate_token": "82eef1552bb840a980f76dc78d3991b1",
      "mandate_id": "eBWQNiQgeG7fdrXPPXtVbL",
      "mandate_debit_token": "82eef1552bb840a980f76dc78d3991b1",
      "last_activated_at": "2020-04-18T10:16:02Z",
      "frequency": "MONTHLY",
      "customer_id": "cst_9uiehncjizlfcnps",
      "currency": "INR",
      "block_fund": false,
      "amount_rule": "VARIABLE",
      "activated_at": "2020-04-18T10:16:02Z"
    }
  }
}
```



#### Active Code Snippet:

```active
{
  "id": "evt_V2_a2f864be94fb4fde88cd1056cbf88beb",
  "event_name": "MANDATE_ACTIVATED",
  "date_created": "2021-12-18T10:15:35Z",
  "content": {
    "mandate": {
      "status": "ACTIVE",
      "start_date": "1639802535",
      "end_date": "3093465599",
      "revokable_by_customer": "true",
      "payment_info": {
        "upi": { 
          "payer_vpa": "yourname@mypsp2"
        },
        "payment_method_type": "UPI",
        "payment_method": "COLLECT/PAY/INAPP"
      },
      "order_id": "1631719633",
      "max_amount": "399",
      "mandate_type": "EMANDATE",
      "mandate_token": "82eef1552bb840a980f76dc78d3991b1",
      "mandate_id": "eBWQNiQgeG7fdrXPPXtVbL",
      "mandate_debit_token": "82eef1552bb840a980f76dc78d3991b1",
      "last_activated_at": "2020-04-18T10:16:02Z",
      "frequency": "MONTHLY",
      "customer_id": "cst_9uiehncjizlfcnps",
      "currency": "INR",
      "block_fund": false,
      "amount_rule": "VARIABLE",
      "activated_at": "2020-04-18T10:16:02Z"
    }
  }
}
```



#### Failure Code Snippet:

```failure
{
  "id": "evt_V2_a2f864be94fb4fde88cd1056cbf88beb",
  "event_name": "MANDATE_FAILED",
  "date_created": "2021-12-18T10:15:35Z",
  "content": {
    "mandate": {
      "status": "FAILURE",
      "start_date": "1639802535",
      "end_date": "3093465599",
      "revokable_by_customer": "true",
      "payment_info": {
        "upi": { 
          "payer_vpa": "yourname@mypsp2"
        },
        "payment_method_type": "UPI",
        "payment_method": "COLLECT/PAY/INAPP"
      },
      "order_id": "1631719633",
      "max_amount": "399",
      "mandate_type": "EMANDATE",
      "mandate_token": "82eef1552bb840a980f76dc78d3991b1",
      "mandate_id": "eBWQNiQgeG7fdrXPPXtVbL",
      "mandate_debit_token": "82eef1552bb840a980f76dc78d3991b1",
      "last_activated_at": "2020-04-18T10:16:02Z",
      "frequency": "MONTHLY",
      "customer_id": "cst_9uiehncjizlfcnps",
      "currency": "INR",
      "block_fund": false,
      "amount_rule": "VARIABLE",
      "activated_at": "2020-04-18T10:16:02Z"
    }
  }
}
```
