Trigger a sandbox event API
Environment: Live
Send any event to the sandbox wallet, or settle pending records on demand.
# Trigger a sandbox event API
Send an event to your sandbox wallet, signed like a live one: as a webhook when the wallet has webhooks on, and as a callback for the events that have one. With an id it acts on a real sandbox record: a pending payment or payout settles that way (balance, status and event agree) and a bulk batch finishes. Without an id it sends a sample event and does not touch the balance. Sandbox only.
## Endpoint
- **Method**: POST
- **URL**: https://sandbox.moolre.com/open/sandbox/trigger
## Headers
| Header | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| X-API-USER | string | Yes | Your Moolre username. |
| X-API-KEY | string | Yes | Your wallet private API key. A public key is refused. |
## Request Body
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| accountnumber | string | Yes | Your sandbox wallet account number. |
| event | string | Yes | The event to send. |
| externalref | string | No | externalref of a payment or payout to settle or re-send. |
| transactionid | string | No | Alternative to externalref. |
| batchid | string | No | For bulk_payout.completed: the batch to finish. |
| invoiceid | string | No | For invoice.paid, which is an action, not an event: pays this sandbox invoice and sends nothing. |
| amount | string | No | A sample amount, or a part payment for invoice.paid. |
| reason | string | No | The failure reason for payment.failed. |
| final | string | No | For bulk_payout.completed: how pending items settle. |
## Response (200 Success)
The event was sent. data.delivered says whether your endpoint answered 2xx. data.webhook and data.callback show each delivery (null when it was not sent).
```json
{
"status": 1,
"code": "SBX01",
"message": "Event sent.",
"data": {
"event": "payment.succeeded",
"transactionid": "1001",
"event_id": "evt_0123456789abcdef01234567",
"delivered": true,
"state": "delivered",
"http": 200,
"error": null,
"webhook": {
"event_id": "evt_0123456789abcdef01234567",
"delivered": true,
"state": "delivered",
"http": 200,
"error": null
},
"callback": null
},
"go": null,
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Response (200 (HTTP 422 in strict mode) Nothing to send to)
The sandbox wallet has webhooks off, and no callback URL for an event that has a callback. Set them with Update Account.
```json
{
"status": 0,
"code": "SBX02",
"message": "Webhooks are off on this sandbox wallet. Turn them on with POST /open/account/update (webhook_url and webhook 1).",
"data": "webhook_url",
"go": null,
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Errors
| Code | Meaning |
| --- | --- |
| SBX02 | Webhooks are off, and no callback URL for an event that has one (422) |
| SBX03 | Bad event or parameter (400) |
| SBX04 | Batch or invoice not found (404) |
| SBX05 | Contradictory request, for example asking for the opposite outcome of a finished payment (409) |
| SBX06 | The record cannot be settled (409) |
| SBX10 | Wallet not found (404) |
| SBX13 | A public key was used (403) |
## Fields every response can carry
These fields are additive: existing fields keep their names, order and types.
| Field | Meaning |
| :--- | :--- |
| meta | Always present, last in the object. meta.replayed is true only when the response is the stored answer to a repeated Idempotency-Key (absent otherwise). meta.requestid is the unique id of the request (also the X-Request-Id response header): quote it when you contact support. meta.notices is always an array, empty when there is nothing to report; each notice is { code, message, docs? }, for example that a deprecated way of sending credentials was used. See [Deprecations](https://docs.moolre.com/guides/deprecations). |
There is no outcome field. Decide the result from status, code and, on payment and transfer endpoints, data.txstatus (0 pending, 1 succeeded, 2 failed). These codes mean the result is unknown and may still succeed, so treat them as pending and check the status: PY01, PY02, TR01, TR02, TP11, TP18, APY10, APY16, ASL06, IS30, SYS500. Status 1 with TR08, OBGH01, OTGH01, OBNG01, GHQ03 or OM03 is final success; any other status 1 is an accepted, unfinished request.
Send X-Moolre-Http-Status: strict to receive real HTTP status codes (400, 401, 403, 404, 409, 422, 429, 5xx) instead of HTTP 200. See [Responses and request IDs](https://docs.moolre.com/guides/responses).