API reference
Webhooks
Payment provider callbacks.
Payment provider callback (test provider)#
POST/v1/webhooks/mockpay
Stand-in for Click, Payme and Stripe callbacks. Stored raw, deduplicated on providerEventId (a repeat returns duplicate: true and has no effect), written to the order timeline and forwarded to the booking. Real providers add signature checks.
Request body application/json required
| Field | Type | Description |
|---|---|---|
orderIdrequired | string | pattern: ^ord_[a-f0-9]{32}$ |
paymentIdrequired | string | length: 1–100 |
statusrequired | string | one of: "held", "declined" |
reason | string | max length: 300 |
providerEventIdrequired | string | length: 1–200 |
Example request body
{
"orderId": "ord_0d6c3f8a2b9e4c1d8f7a6b5c4d3e2f10",
"paymentId": "pay_112440045751",
"status": "held",
"providerEventId": "evt_01J…"
}Code samples
curl -X POST 'https://api.1fly.uz/v1/webhooks/mockpay' \
-H 'Content-Type: application/json' \
-d '{
"orderId": "ord_0d6c3f8a2b9e4c1d8f7a6b5c4d3e2f10",
"paymentId": "pay_112440045751",
"status": "held",
"providerEventId": "evt_01J…"
}'const res = await fetch('https://api.1fly.uz/v1/webhooks/mockpay', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"orderId": "ord_0d6c3f8a2b9e4c1d8f7a6b5c4d3e2f10",
"paymentId": "pay_112440045751",
"status": "held",
"providerEventId": "evt_01J…"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (request ${data.error.requestId})`);import requests
resp = requests.post(
"https://api.1fly.uz/v1/webhooks/mockpay",
json={
"orderId": "ord_0d6c3f8a2b9e4c1d8f7a6b5c4d3e2f10",
"paymentId": "pay_112440045751",
"status": "held",
"providerEventId": "evt_01J…",
},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")Responses
200Received.
Example response
{
"received": true,
"duplicate": false
}500Unexpected error on our side; quote the requestId.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
Response (generated from schema)
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}