Webhook notifications

Listen for events from your inai account and build behaviors.

inai notifies you with webhooks when an event happens.

📘

What are webhooks

Webhooks are custom callbacks over HTTP. The format is usually JSON. The request is done as an HTTP POST request. Wikipedia says, "these callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application."

On the dashboard web hooks are listed under Settings > Webhooks

Webhook event types

The webhooks currently supported by inai are listed below. See below for sample webhook payloads.

Webhook Event Type

Comment

transaction.success

Sent when a transaction is successful.

transaction.failed

Sent when a transaction has failed. See the error_code in the response body to understand the error cause. The full list of errors is listed on our Payment Errors page.

transaction.pending

Sent for our asynchronous payments. We typically listen to the Payment Processor's webhooks for any updates to the transaction. When we get a webhook, we send it out as a webhook.

Payloads

Transactions Payload

transaction.success

{
  "event_type": "transaction.success",
  "transaction": {
    "transaction_id": "txn_X75fnbHceR",
    "type": "CHARGE", // CHARGE or REFUND
    "amount": "3.14",
    "currency": "USD",
    "status": "SUCCESS",
    "rail": "card",
    "provider": {
      "alias": "stripe-usa",
      "name": "stripe"
    },
    "transaction_time": "2021-08-09T07:06:08.802Z",
    "customer": {},             // customer details
    "order_id": "",             // if it was a one time payment
    "subscription_id": "",      // if it was a subscription
    "order_type": "string",
    "error_code": "",
    "refund_reason": "" // if the transaction type is REFUND.
  }
}

transaction.failed

{
  "event_type": "transaction.failed",
  "transaction": {
    "transaction_id": "txn_2GbWQ19tB",
    "amount": "2.71",
    "type": "CHARGE",
    "currency": "USD",
    "status": "FAILED",
    "rail": "CREDIT_CARD",
    "provider": {
      "alias": "braintree-usa",
      "name": "Braintree"
    },
    "transaction_time": "2021-10-29T12:01:53+00:00",
    "customer": {
      "contact_email": "[email protected]",
    },
    "order_id": "ord_BNNoshAG",
    "subscription_id": "",
    "order_type": "REGULAR",
    "error_code": "CARD_EXPIRED"
  }
}

transaction.pending

{
  "event_type": "transaction.pending",
  "transaction": {
    "transaction_id": "txn_2XCpu78mG",
    "amount": "2.71",
    "type": "CHARGE",
    "currency": "SGD",
    "status": "PENDING",
    "rail": "CREDIT_CARD",
    "provider": {
      "alias": "rapyd-sgn",
      "name": "Rapyd"
    },
    "transaction_time": "2021-11-04T06:02:00+00:00",
    "customer": {
      "customer_id": "cust_2MHiHywk3",
      "contact_email": "[email protected]",
    },
    "order_id": "ord_2R2FeMge5",
    "order_type": "REGULAR",
  }
}