> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Structure and Events

⏳...

## General Structure

Every webhook event for a resource is wrapped in the following structure:

```json theme={null}
{
  "apiVersion": "2024-08-01", // The API version of the webhook event payload.
  "event": {
    "id": "<webhook-event-id>", // The unique ID for the event; remains the same during reties.
    "name": "<webhook-event-name", // The name of the event in the format <resource-type>.<event_name>, eg. payment_code.expired.
    "timestamp": "1725018144" // The timestamp in Unix seconds when the event was fired.
  },
  "object": {
    "id": "<resource-id>", // The id of the resource for which the event was triggered
    "type": "<resource-type>" // The unique string representing the resource
  },
  "data": {} // Resource definition. (The payment code object)
}
```

⏳...

## Payment Code

⏳...

#### Supported Events

<Tabs>
  <Tab title="payment_code.created">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-e8daf2bdea9f5e8587388a3a30b1efc6",
            "name": "payment_code.created",
            "timestamp": "1725018090"
        },
        "object": {
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "createTime": "2024-08-30T11:41:30.513423582Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T11:46:30.513451171Z",
            "financialTarget": null,
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "progress": {
                "isCompleted": false,
                "totalPaymentCount": 0,
                "totalPaymentSum": null
            },
            "status": "pending",
            "ussdCode": "*715*1*7344331308#"
        }
    }
    ```
  </Tab>

  <Tab title="payment_code.expired">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-63e45a9f1e9652ed8419cc33abf13542",
            "name": "payment_code.expired",
            "timestamp": "1725022085"
        },
        "object": {
            "id": "pmc-YhTQVSnJTHiiUqzzKXBBg2wJz",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
        },
            "createTime": "2024-08-30T12:45:04.967509Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T12:48:04.967536489Z",
            "financialTarget": null,
            "id": "pmc-YhTQVSnJTHiiUqzzKXBBg2wJz",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "progress": {
                "isCompleted": false,
                "totalPaymentCount": 0,
                "totalPaymentSum": null
            },
            "status": "expired",
            "ussdCode": "*715*1*3836223839#"
        }
    }
    ```
  </Tab>

  <Tab title="payment_code.processed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object) with
    the addition of the `paymentData` object holding the information of the processed payment.

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-37b29f69ad8b560994aba0cb0a5a6d1c",
            "name": "payment_code.processed",
            "timestamp": "1725018144"
        },
        "object": {
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "createTime": "2024-08-30T11:41:30.513423Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T11:46:30.513451171Z",
            "financialTarget": null,
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "paymentData": {
                "amount": {
                    "currency": "SLE",
                    "value": 100
                },
                "channelData": {
                    "accountId": "232783****7",
                    "providerId": "m17",
                   "transactionReference": "MP240830.1142.B79174"
                },
               "metadata": {
                    "providerKey": "71e2b193-de88-5b83-99ae-662abfdb05e4"
                },
                "orderId": "ord-YhNdfzSsTYdAzPswmDHU4Siwe",
                "orderNumber": "808956084535",
                "paymentId": "spm-YhNdgPdTrrSi2PJD45Dg5Vp3X",
                "transactionReference": "20240830-114224065-VNAEFR"
            },
            "progress": {
                "isCompleted": false,
                "totalPaymentCount": 0,
                "totalPaymentSum": null
            },
            "status": "processing",
            "ussdCode": "*715*1*7344331308#"
        }
    }
    ```
  </Tab>

  <Tab title="payment_code.completed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-afd41c1aa68d555b8c7be85bb4a15e7f",
            "name": "payment_code.completed",
            "timestamp": "1725018144"
        },
        "object": {
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "createTime": "2024-08-30T11:41:30.513423Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T11:46:30.513451171Z",
            "financialTarget": null,
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "progress": {
                "isCompleted": true,
                "totalPaymentCount": 1,
                "totalPaymentSum": {
                    "currency": "SLE",
                    "value": 100
                }
            },
            "status": "completed",
            "ussdCode": "*715*1*7344331308#"
        }
    }
    ```
  </Tab>
</Tabs>

## Payout

⏳...

#### Supported Events

<Tabs>
  <Tab title="payout.failed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/payout/the-payout-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-1890fe24fa7457698c8ea20944403e4b",
            "name": "payout.failed",
            "timestamp": "1725022815"
        },
        "object": {
            "id": "pyt-YhUZVFtffj6JSbxpv9puNzYkE",
            "type": "payout"
        },
        "data": {
            "amount": {
                "currency": "SLE",
                "value": 10000
            },
            "charges": [],
            "createTime": "2024-08-30T13:00:15.220463Z",
            "destination": {
                "accountId": "+23278341807",
                "providerCode": "m17",
                "transactionReference": null
            },
            "failureDetail": {
                "code": "fundInsufficient",
                "explanation": "Financial account has insufficient funds."
            },
            "id": "pyt-YhUZVFtffj6JSbxpv9puNzYkE",
            "metadata": null,
            "source": {
                "financialAccountId": "fac-EBNBbzJXihwSFPcubG2v61YJH",
                "transactionReference": null
            },
            "status": "failed"
        }
    }
    ```
  </Tab>

  <Tab title="payout.completed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/payout/the-payout-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-8f2287f0f68b53adbd57f1f0662757c2",
            "name": "payout.completed",
            "timestamp": "1725023198"
        },
        "object": {
            "id": "pyt-YhV3cLZ3bLsiEi3t14A6bFa42",
            "type": "payout"
        },
        "data": {
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "charges": [
                {
                    "name": "Base",
                    "amount": {
                        "currency": "SLE",
                        "value": 1
                    },
                    "metadata": null
                }
            ],
            "createTime": "2024-08-30T13:06:37.3016Z",
            "destination": {
                "accountId": "+23278341807",
                "providerCode": "m17",
                "transactionReference": "CI240830.1306.B90450"
            },
            "failureDetail": null,
            "id": "pyt-YhV3cLZ3bLsiEi3t14A6bFa42",
            "metadata": null,
            "source": {
                "financialAccountId": "fac-EBNBbzJXihwSFPcubG2v61YJH",
                "transactionReference": "20240830-130637332-MRTMCV"
            },
            "status": "completed"
        }
    }
    ```
  </Tab>
</Tabs>

# Checkout Session

⏳...

#### Supported Events

<Tabs>
  <Tab title="checkout_session.expired">
    Coming soon... ⏳
  </Tab>

  <Tab title="checkout_session.cancelled">
    Coming soon... ⏳
  </Tab>

  <Tab title="checkout_session.completed">
    Coming soon... ⏳
  </Tab>
</Tabs>

## =======

title: Structure and Events
sidebarTitle: Structure and Events
icon: "brackets-curly"
iconType: "solid"
-----------------

⏳...

## General Structure

Every webhook event for a resource is wrapped in the following structure:

```json theme={null}
{
  "apiVersion": "2024-08-01", // The API version of the webhook event payload.
  "event": {
    "id": "<webhook-event-id>", // The unique ID for the event; remains the same during reties.
    "name": "<webhook-event-name", // The name of the event in the format <resource-type>.<event_name>, eg. payment_code.expired.
    "timestamp": "1725018144" // The timestamp in Unix seconds when the event was fired.
  },
  "object": {
    "id": "<resource-id>", // The id of the resource for which the event was triggered
    "type": "<resource-type>" // The unique string representing the resource
  },
  "data": {} // Resource definition. (The payment code object)
}
```

⏳...

## Payment Code

⏳...

#### Supported Events

<Tabs>
  <Tab title="payment_code.created">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-e8daf2bdea9f5e8587388a3a30b1efc6",
            "name": "payment_code.created",
            "timestamp": "1725018090"
        },
        "object": {
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "createTime": "2024-08-30T11:41:30.513423582Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T11:46:30.513451171Z",
            "financialTarget": null,
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "progress": {
                "isCompleted": false,
                "totalPaymentCount": 0,
                "totalPaymentSum": null
            },
            "status": "pending",
            "ussdCode": "*715*1*7344331308#"
        }
    }
    ```
  </Tab>

  <Tab title="payment_code.expired">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-63e45a9f1e9652ed8419cc33abf13542",
            "name": "payment_code.expired",
            "timestamp": "1725022085"
        },
        "object": {
            "id": "pmc-YhTQVSnJTHiiUqzzKXBBg2wJz",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
        },
            "createTime": "2024-08-30T12:45:04.967509Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T12:48:04.967536489Z",
            "financialTarget": null,
            "id": "pmc-YhTQVSnJTHiiUqzzKXBBg2wJz",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "progress": {
                "isCompleted": false,
                "totalPaymentCount": 0,
                "totalPaymentSum": null
            },
            "status": "expired",
            "ussdCode": "*715*1*3836223839#"
        }
    }
    ```
  </Tab>

  <Tab title="payment_code.processed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object) with
    the addition of the `paymentData` object holding the information of the processed payment.

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-37b29f69ad8b560994aba0cb0a5a6d1c",
            "name": "payment_code.processed",
            "timestamp": "1725018144"
        },
        "object": {
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "createTime": "2024-08-30T11:41:30.513423Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T11:46:30.513451171Z",
            "financialTarget": null,
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "paymentData": {
                "amount": {
                    "currency": "SLE",
                    "value": 100
                },
                "channelData": {
                    "accountId": "232783****7",
                    "providerId": "m17",
                   "transactionReference": "MP240830.1142.B79174"
                },
               "metadata": {
                    "providerKey": "71e2b193-de88-5b83-99ae-662abfdb05e4"
                },
                "orderId": "ord-YhNdfzSsTYdAzPswmDHU4Siwe",
                "orderNumber": "808956084535",
                "paymentId": "spm-YhNdgPdTrrSi2PJD45Dg5Vp3X",
                "transactionReference": "20240830-114224065-VNAEFR"
            },
            "progress": {
                "isCompleted": false,
                "totalPaymentCount": 0,
                "totalPaymentSum": null
            },
            "status": "processing",
            "ussdCode": "*715*1*7344331308#"
        }
    }
    ```
  </Tab>

  <Tab title="payment_code.completed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/paymentcode/the-payment-code-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-afd41c1aa68d555b8c7be85bb4a15e7f",
            "name": "payment_code.completed",
            "timestamp": "1725018144"
        },
        "object": {
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "type": "payment_code"
        },
        "data": {
            "allowedProviders": [],
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "createTime": "2024-08-30T11:41:30.513423Z",
            "customerTarget": null,
            "expireTime": "2024-08-30T11:46:30.513451171Z",
            "financialTarget": null,
            "id": "pmc-YhNZjnLJR4fY7T3GXAXJrQmLY",
            "isActive": true,
            "metadata": null,
            "mode": "oneTime",
            "name": "Topup",
            "progress": {
                "isCompleted": true,
                "totalPaymentCount": 1,
                "totalPaymentSum": {
                    "currency": "SLE",
                    "value": 100
                }
            },
            "status": "completed",
            "ussdCode": "*715*1*7344331308#"
        }
    }
    ```
  </Tab>
</Tabs>

## Payout

⏳...

#### Supported Events

<Tabs>
  <Tab title="payout.failed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/payout/the-payout-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-1890fe24fa7457698c8ea20944403e4b",
            "name": "payout.failed",
            "timestamp": "1725022815"
        },
        "object": {
            "id": "pyt-YhUZVFtffj6JSbxpv9puNzYkE",
            "type": "payout"
        },
        "data": {
            "amount": {
                "currency": "SLE",
                "value": 10000
            },
            "charges": [],
            "createTime": "2024-08-30T13:00:15.220463Z",
            "destination": {
                "accountId": "+23278341807",
                "providerCode": "m17",
                "transactionReference": null
            },
            "failureDetail": {
                "code": "fundInsufficient",
                "explanation": "Financial account has insufficient funds."
            },
            "id": "pyt-YhUZVFtffj6JSbxpv9puNzYkE",
            "metadata": null,
            "source": {
                "financialAccountId": "fac-EBNBbzJXihwSFPcubG2v61YJH",
                "transactionReference": null
            },
            "status": "failed"
        }
    }
    ```
  </Tab>

  <Tab title="payout.completed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/payout/the-payout-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-8f2287f0f68b53adbd57f1f0662757c2",
            "name": "payout.completed",
            "timestamp": "1725023198"
        },
        "object": {
            "id": "pyt-YhV3cLZ3bLsiEi3t14A6bFa42",
            "type": "payout"
        },
        "data": {
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "charges": [
                {
                    "name": "Base",
                    "amount": {
                        "currency": "SLE",
                        "value": 1
                    },
                    "metadata": null
                }
            ],
            "createTime": "2024-08-30T13:06:37.3016Z",
            "destination": {
                "accountId": "+23278341807",
                "providerCode": "m17",
                "transactionReference": "CI240830.1306.B90450"
            },
            "failureDetail": null,
            "id": "pyt-YhV3cLZ3bLsiEi3t14A6bFa42",
            "metadata": null,
            "source": {
                "financialAccountId": "fac-EBNBbzJXihwSFPcubG2v61YJH",
                "transactionReference": "20240830-130637332-MRTMCV"
            },
            "status": "completed"
        }
    }
    ```
  </Tab>

  <Tab title="payout.delayed">
    The structure of the data field is the same as the object structure in the [Rest
    API](https://docs.monime.io/apis2/2024-08-01/resources/payout/the-payout-object)

    Below is a sample:

    ```json theme={null}
    {
        "apiVersion": "2024-08-01",
        "event": {
            "id": "wke-8f2287f0f68b53adbd57f1f0662757c2",
            "name": "payout.delayed",
            "timestamp": "1725023198"
        },
        "object": {
            "id": "pyt-YhV3cLZ3bLsiEi3t14A6bFa42",
            "type": "payout"
        },
        "data": {
            "amount": {
                "currency": "SLE",
                "value": 100
            },
            "charges": [],
            "createTime": "2024-08-30T13:06:37.3016Z",
            "destination": {
                "accountId": "+23278341807",
                "providerCode": "m17"
            },
            "failureDetail": null,
            "failureDetail": null,
            "id": "pyt-YhV3cLZ3bLsiEi3t14A6bFa42",
            "metadata": null,
            "source": {
                "financialAccountId": "fac-EBNBbzJXihwSFPcubG2v61YJH",
                "transactionReference": "20240830-130637332-MRTMCV"
            },
            "status": "delayed",
            "delayedReason": "Provider state is ambiguous",
        }
    }
    ```
  </Tab>
</Tabs>

# Checkout Session

⏳...

#### Supported Events

<Tabs>
  <Tab title="checkout_session.expired">
    Coming soon... ⏳
  </Tab>

  <Tab title="checkout_session.cancelled">
    Coming soon... ⏳
  </Tab>

  <Tab title="checkout_session.completed">
    Coming soon... ⏳
  </Tab>
</Tabs>

> > > > > > > 8c11980ce072affe07883ed5e3140c5dd3b920e3
