Webhooks are sent out of SmarterPay Cloud as a JSON array. The JSON Syntax Rules are:
The Webhook contains information about the Webhook and a list of, one or more, Events. The structure, using three events as an example, looks like this:
| Start of the Webhook object | { | |
| “id”: “OM01L45YJ67Q1ER78Z2D”, | ||
| “idempotency_key”: 8586bda6-52d6-474a-a31d-86f45b7b86f9, | ||
| “sent_at”: “2022-11-21T14:33:42Z”, | ||
| “client”: { | ||
| “id”: “CL01LG420EJ9DP1VQWR9” | ||
| }, | ||
| Start of the Events array | “events”: [ | |
| Start of the 1st Event object | { | |
| “id”: “BA010000000000000000”, | ||
| “created_at”: “2022-11-21T14:33:41Z”, | ||
| “enabled”: true, | ||
| “event_type”: “bank_account.create”, | ||
| … | ||
| End of the 1st Event object | }, | |
| Start of the 2nd Event object | { | |
| “id”: “M010000000000000000”, | ||
| “created_at”: “2022-11-21T14:33:42Z”, | ||
| “status”: “new instruction”, | ||
| “event_type”: “mandate.create”, | ||
| … | ||
| End of the 2nd Event object | }, | |
| Start of the 3rd Event object | { | |
| “id”: “P010000000000000000”, | ||
| “created_at”: “2022-11-21T14:33:42Z”, | ||
| “status”: “pending_submission”, | ||
| “event_type”: “payment.create”, | ||
| … | ||
| End of the 3rd Event object | } | |
| End of the Events array | ] | |
| End of the Webhook object | } |
{
"id": "OM01L45YJ67Q1ER78Z2D",
"idempotency_key": 8586bda6-52d6-474a-a31d-86f45b7b86f9,
"sent_at": "2022-11-21T14:33:42Z",
"client": {
"id": "CL01LG420EJ9DP1VQWR9"
},
"events": [
{
"id": "BA010000000000000000",
"created_at": "2022-11-21T14:33:41Z",
"enabled": true,
"event_type": "bank_account.create",
...
},
{
"id": "M010000000000000000",
"created_at": "2022-11-21T14:33:42Z",
"status": "new instruction",
"event_type": "mandate.create",
...
},
{
"id": "P010000000000000000",
"created_at": "2022-11-21T14:33:42Z",
"status": "pending_submission",
"event_type": "payment.create",
...
}
]
}
| Property | Format | Description |
|---|---|---|
| id | string | ID of the record |
| idempotency_key | string | Unique key that can be used to avoid duplication of actions |
| sent_at | datetime (ISO8601) | Date and time the Webhook was sent |
| client | object | Object containing the client information, see below |
| Property | Format | Description |
|---|---|---|
| id | string | ID of the record |
For the Event fields please see the relevant object event information