The REST base URL is https://api.paymentretryalert.com/v1. Append the operation paths below to this base URL. Use the paths as written, without a trailing slash. Interactive documentation is available at /v1/docs, and the OpenAPI schema is available at /v1/openapi.json. Both show the newest supported version.
See how the product works for the payment flow and the API integration guide for a complete integration.
Authentication and versions
Send these headers on every authenticated request:
| Header | Value |
|---|---|
Authorization | Bearer YOUR_API_KEY |
PaymentRetryAlert-Version | 2026-10-05, the currently supported version. Required; there is no implicit default. |
Content-Type | application/json when sending a JSON body. |
Idempotency-Key | Required on webhook endpoint creation and both simulation operations; optional on other POST operations. See idempotency. |
API keys beginning with pra_test_ belong to test organisations; pra_live_ keys belong to live organisations. The key selects the organisation, so resource paths do not contain an organisation ID. Keep keys in server-side secret storage and send them only in the authorization header. Keys in query parameters are rejected. A dashboard session does not authenticate REST requests.
A resource outside your key’s organisation returns the same 404 NOT_FOUND response as an unknown ID. Treat all IDs as opaque strings. Timestamps use ISO 8601 with a time zone; newly returned timestamps use UTC with milliseconds, such as 2026-10-20T10:00:00.000Z. Unknown request body fields and query parameters produce validation errors. Accept additional fields in responses so additive changes do not break your client.
The response echoes an accepted version in PaymentRetryAlert-Version. An event’s own api_version describes its snapshot format, including when the event predates the REST request’s version. See payload versions for webhook delivery versions.
Scopes
| Scope | Access |
|---|---|
enrolments:read | List and retrieve enrolments. |
enrolments:write | Create enrolments and request unenrolment; includes enrolment read access. |
alerts:read | List and retrieve alerts. |
alerts:write | Report retry outcomes; includes alert read access. |
events:read | List and retrieve every event type for the organisation. |
webhook_endpoints:read | Read endpoints, deliveries, and delivery attempts. |
webhook_endpoints:write | Create, update, and delete endpoints, and retry deliveries; includes webhook read access. |
simulations:write | Simulate enrolment status changes and alerts in test organisations. |
GET /me accepts any valid API key, including a key without scopes. Simulation access does not grant enrolment or alert read/write scopes.
Pagination and filters
List responses have the form:
{
"items": [],
"count": 0
}
count appears only when include_count=true; it is the number of matching objects before limit and offset are applied. An empty items array is a valid response.
| Query parameter | Type | Default and behavior |
|---|---|---|
limit | integer | 100; allowed range 1 through 100. |
offset | integer | 0; must be at least 0. |
sort | string | -created_at for newest first; use created_at for oldest first. Alerts also support transaction_time and -transaction_time. |
include_count | boolean | false; use true to include count. |
Sorting uses creation time and ID to resolve ties consistently. Increase offset by the number of returned items to read the next page. New objects can move offset pages; use the event polling cursor below when continuously consuming events.
Filters on different fields are combined with AND. Repeat a multi-value parameter to match any of its values, for example status=PENDING&status=ENABLED. Timestamp filters require a full date and time with a time zone, such as 2026-10-20T10:00:00Z. Both _gte and _lte bounds are inclusive at the timestamp precision shown in responses.
Key context
GET /me
Returns 200 with your key’s organisation and permissions. No scope is required. The secret is never returned.
{
"object": "api_key_context",
"organisation": {
"id": "org_example",
"name": "Example merchant",
"mode": "TEST"
},
"api_key": {
"id": "key_example",
"name": "Payments integration",
"scopes": ["alerts:write", "events:read"],
"source": "DASHBOARD",
"expires_at": null
}
}
organisation.mode is TEST or LIVE. api_key.source is DASHBOARD or CLI. expires_at is an ISO 8601 timestamp for CLI keys and null for dashboard keys. CLI keys expire after 90 days without use.
Enrolments
All successful operations return the enrolment object, except listing, which returns a page of those objects.
| Operation | Required scope | Success |
|---|---|---|
GET /enrolments | enrolments:read | 200 list. |
POST /enrolments | enrolments:write | 201 newly created enrolment. |
GET /enrolments/{id} | enrolments:read | 200 enrolment. |
DELETE /enrolments/{id} | enrolments:write | 200 updated enrolment. |
GET /enrolments
Supports common pagination, plus:
| Filter | Type | Behavior |
|---|---|---|
status | repeated string | Any listed enrolment status. See the enrolment object. |
mastercard_pop_mid | string | Exact MID match after trimming surrounding whitespace. |
POST /enrolments
The only body field is required:
{
"mastercard_pop_mid": "123456789012345"
}
Send the MID as a string to preserve leading zeros. Surrounding whitespace is removed; the remaining value must contain 1 through 255 characters. The enrolment starts in PENDING, and an enrolment.created event is recorded. Test enrolments are not submitted to Mastercard.
409 MID_ALREADY_ENROLLED means the MID is already in your organisation’s enrolment list. If a response was lost, retry with the original idempotency key or list enrolments with mastercard_pop_mid to find the result.
GET /enrolments/{id}
Retrieve the current enrolment by ID. Returns 404 NOT_FOUND if it cannot be found for your organisation.
DELETE /enrolments/{id}
Request unenrolment without a request body. A PENDING enrolment becomes CANCELLED immediately. Other test enrolments are normally unenrolled immediately. A live enrolment records unenrolment_requested_at and keeps its current status until unenrolment completes. Monitor enrolment.updated or retrieve the enrolment to observe completion.
Repeating a request while unenrolment is pending returns the enrolment without another change. Once an enrolment is UNENROLLED, FAILED, or CANCELLED, this operation returns 409 UNENROLMENT_CLOSED. This operation retains the enrolment record.
Alerts
| Operation | Required scope | Success |
|---|---|---|
GET /alerts | alerts:read | 200 page of alert objects. |
GET /alerts/{id} | alerts:read | 200 current alert. |
PATCH /alerts/{id} | alerts:write | 200 updated alert. |
GET /alerts
Supports common pagination, including transaction-time sorting, plus:
| Filter | Type | Behavior |
|---|---|---|
enrolment_id | string | Exact enrolment ID. |
enrolment_mid | string | Exact MID; includes alerts across enrolments when the MID has been enrolled again. |
network_transaction_id | string | Exact network transaction identifier. |
card_bin | string | Exact BIN. |
card_last_four | string | Exact last four digits. |
retry_outcome | repeated string | SUCCEEDED, FAILED, NOT_ATTEMPTED, or NONE. NONE matches a null outcome. |
transaction_time_gte, transaction_time_lte | timestamp | Inclusive original transaction-time range. |
created_at_gte, created_at_lte | timestamp | Inclusive alert creation-time range. |
GET /alerts/{id}
Retrieve the alert’s current state. Returns 404 NOT_FOUND if it cannot be found for your organisation.
PATCH /alerts/{id}
Report the result of your payment retry:
{
"retry_outcome": "SUCCEEDED"
}
retry_outcome is required and must be SUCCEEDED, FAILED, or NOT_ATTEMPTED. It cannot be cleared to null. Reporting the same value again changes nothing. A changed value records alert.updated; an outcome can be corrected later, including after the reporting timeout. This request records an outcome; your payment integration performs the payment retry separately.
Events
| Operation | Required scope | Success |
|---|---|---|
GET /events | events:read | 200 page of event envelopes. |
GET /events/{id} | events:read | 200 event envelope. |
GET /events
Returns events across all four event types. The event body is the same snapshot used by webhooks. Supports common pagination, plus:
| Filter | Type | Behavior |
|---|---|---|
type | repeated string | Any listed event type. |
created_at_gte, created_at_lte | timestamp | Inclusive event creation-time range. |
starting_after | string | Event ID for cursor-based polling; returns events after that event, oldest first. |
With starting_after, only events at least 30 seconds old are returned. Do not send offset or sort, even their default values, with the cursor; doing so returns 422 PARAMETER_CONFLICT. A cursor outside the organisation or an unknown ID returns 422 STARTING_AFTER_NOT_FOUND. The cursor can identify an event outside the selected filters. With cursor pagination, count counts matching events after the cursor that are currently old enough to return.
To start polling new events, request limit=1&created_at_lte=YOUR_UTC_TIME_30_SECONDS_AGO without a cursor. Keep the newest returned event ID as your initial cursor. If the list is empty, wait and try again. Then request starting_after=LAST_EVENT_ID, process the page in order, and advance to the final returned event’s ID only after saving that page. Keep the cursor when a page is empty. Start from an event at least 30 seconds old to avoid skipping events that become visible later. For historical recovery, read older pages as well before starting ongoing polling.
GET /events/{id}
Retrieve the original event snapshot. Its data.object describes the object when the event occurred; retrieve the enrolment or alert separately for its current state. Returns 404 NOT_FOUND when the event cannot be found for your organisation.
Webhook endpoint management
| Operation | Required scope | Success |
|---|---|---|
GET /webhook-endpoints | webhook_endpoints:read | 200 page of endpoint objects. |
POST /webhook-endpoints | webhook_endpoints:write | 201 endpoint with its signing secret. |
GET /webhook-endpoints/{id} | webhook_endpoints:read | 200 endpoint without its secret. |
PATCH /webhook-endpoints/{id} | webhook_endpoints:write | 200 updated endpoint without its secret. |
DELETE /webhook-endpoints/{id} | webhook_endpoints:write | 204 with no response body. |
Endpoint object
| Field | Type | Description |
|---|---|---|
id | string | Endpoint ID, prefixed with whep_. |
object | string | Always webhook_endpoint. |
url | string | Registered receiver URL. |
description | string | Description; an empty string when none is provided. |
event_types | array of strings | Subscribed event types, deduplicated and sorted. |
is_active | boolean | Whether the endpoint can receive deliveries. |
api_version | string | Payload version selected for new deliveries. |
disabled_reason | string or null | MANUAL or FAILING when disabled; otherwise null. |
disabled_at | timestamp or null | When the endpoint was disabled. |
created_at | timestamp | When the endpoint was created. |
secret | string | whsec_ signing secret. Returned only by creation and idempotent replays of that creation. |
GET /webhook-endpoints
Supports common pagination. Returns active and disabled endpoints, without signing secrets. Deleted endpoints are excluded.
POST /webhook-endpoints
Requires Idempotency-Key. Send:
{
"url": "https://payments.example.com/webhooks/paymentretryalert",
"description": "Payment retry notifications",
"event_types": ["alert.created", "alert.updated"]
}
| Body field | Required | Validation and default |
|---|---|---|
url | Yes | At most 2,048 characters; surrounding whitespace is trimmed. Must meet the endpoint requirements. |
event_types | Yes | At least one supported event type. |
description | No | At most 255 characters; defaults to "". |
The new endpoint is active. Its payload version is the request’s PaymentRetryAlert-Version. Save the returned secret before processing deliveries. Ordinary read responses never return it. Repeating the same creation with the same idempotency key returns the same secret and creates no second endpoint.
An organisation can have 20 endpoints. Exceeding that limit returns 409 ENDPOINT_LIMIT_REACHED. A disallowed receiver URL returns 422 ENDPOINT_URL_NOT_ALLOWED with path: "url".
GET /webhook-endpoints/{id}
Retrieve a current endpoint without its signing secret. Unknown or deleted endpoints return 404 NOT_FOUND.
PATCH /webhook-endpoints/{id}
Send any fields you want to change:
| Body field | Type | Behavior |
|---|---|---|
description | string | Up to 255 characters; send "" to clear it. |
event_types | array of strings | At least one supported event type; replaces the subscription list. |
is_active | boolean | Disable or enable delivery. |
api_version | string | A supported payload version, currently 2026-10-05. Affects new deliveries only. |
Omitted fields and fields set to null keep their current values. The URL cannot be changed; create a replacement endpoint for a new URL. Disabling cancels planned attempts; requests already in flight can arrive. Enabling starts a new failure-monitoring grace period but does not restart cancelled retries. Update your receiver before changing api_version.
DELETE /webhook-endpoints/{id}
Delete the endpoint and cancel planned attempts. The endpoint and its delivery records subsequently return 404 NOT_FOUND through this API. An in-flight request can still arrive.
Webhook deliveries
| Operation | Required scope | Success |
|---|---|---|
GET /webhook-endpoints/{id}/deliveries | webhook_endpoints:read | 200 page of delivery objects without attempts. |
GET /webhook-deliveries/{id} | webhook_endpoints:read | 200 delivery with attempts. |
POST /webhook-deliveries/{id}/retry | webhook_endpoints:write | 200 delivery with attempts. |
Delivery object
| Field | Type | Description |
|---|---|---|
id | string | Delivery ID, prefixed with whdl_; also the webhook request’s webhook-id. |
object | string | Always webhook_delivery. |
endpoint_id | string | Destination endpoint ID. |
event_id | string | Event ID; retrieve it with GET /events/{id}. |
event_type | string | The event’s type. |
status | string | PENDING, RETRYING, SUCCEEDED, FAILED, or CANCELLED. |
next_attempt_at | timestamp or null | Next scheduled attempt, or null when none is planned. |
api_version | string | Payload version that this delivery sends. |
created_at | timestamp | When the delivery was created. |
attempts | array of objects | Present on delivery retrieval and retry responses; ordered by attempt number. |
Attempt object
| Field | Type | Description |
|---|---|---|
id | string | Attempt ID, prefixed with what_. |
object | string | Always webhook_delivery_attempt. |
number | integer | Attempt number within the delivery. |
trigger | string | AUTOMATIC or MANUAL. |
status | string | PENDING, SENDING, SUCCEEDED, FAILED, or CANCELLED. |
scheduled_for | timestamp | Scheduled send time. |
started_at, finished_at | timestamp or null | Start and completion times, when available. |
response_status | integer or null | Receiver’s HTTP status, when a response was obtained. |
response_body | string | Captured receiver response, limited to its first 4,096 bytes and decoded as text. Can be empty. |
error | string | Explanation when no response was obtained; otherwise empty. |
duration_ms | integer or null | Request duration in milliseconds, when available. |
A delivery remains SUCCEEDED after any successful attempt, even if a later manual resend fails. Inspect attempts when checking a resend.
GET /webhook-endpoints/{id}/deliveries
Supports common pagination, plus a repeated status parameter with any delivery status. Returns deliveries for one endpoint, without attempt details. Unknown or deleted endpoints return 404 NOT_FOUND.
GET /webhook-deliveries/{id}
Retrieve a delivery and its attempt history. Unknown deliveries and deliveries belonging to deleted endpoints return 404 NOT_FOUND.
POST /webhook-deliveries/{id}/retry
Send no body or {}. This schedules delivery as soon as possible; the response is not confirmation that the receiver accepted it. Retrieve the delivery again to observe the attempt’s result.
If an automatic attempt is planned, it moves forward and the automatic retry sequence continues if it fails. Otherwise, one manual attempt is added without starting another automatic sequence. The webhook-id and event body stay the same. Use an idempotency key when retrying this REST request after a lost response so you don’t schedule another resend.
Returns 409 DELIVERY_NOT_RETRYABLE when the endpoint is disabled or an attempt is already being sent. Enable a disabled endpoint before retrying. Deleted endpoints’ deliveries return 404 NOT_FOUND.
Test simulations
Both simulation operations require a test organisation’s API key, simulations:write, and Idempotency-Key. Live keys receive 403 TEST_MODE_ONLY. Simulations change test resources and produce the same event types and signed webhook deliveries as the corresponding activity. They do not retry payments with your payment provider.
POST /simulations/enrolments/{id}/status
Returns 200 with the updated enrolment object.
{
"status": "ENABLED"
}
| Body field | Required | Behavior |
|---|---|---|
status | Yes | Any listed enrolment status. |
notes | For ACTION_REQUIRED | String with a nonblank explanation of the required action. Optional for other statuses; omission or null keeps the current notes. Whitespace is trimmed; "" clears notes for other statuses. |
Changing the status records enrolment.updated. Repeating the same status and notes changes nothing, and changing notes alone does not emit an update event. Missing or blank notes with ACTION_REQUIRED return 422 NOTES_REQUIRED. A conflicting MID returns 409 MID_CONFLICT; invalid enrolment values return 422 VALIDATION_VALUE_ERROR.
POST /simulations/enrolments/{id}/alerts
Returns 201 with a newly created alert object and records alert.created. The enrolment must be IN_PROGRESS or ENABLED; otherwise the response is 409 ENROLMENT_NOT_SIMULATABLE.
Send {} to use defaults, or provide test transaction details:
{
"transaction_amount_in_cents": 2150,
"transaction_currency": "USD",
"card_bin": "512345",
"card_last_four": "1234",
"network_transaction_id": "EXAMPLE123"
}
| Body field | Type | Validation and default |
|---|---|---|
transaction_time | timestamp | Time with a time zone in the last 30 days, not in the future. Defaults to a random time 1 through 72 hours ago. |
transaction_amount_in_cents | integer | Positive ISO 4217 minor-unit amount, up to the equivalent of 1,000,000 major units. Defaults to a random integer from 500 through 50,000 minor units. Booleans and fractional numbers are invalid. |
transaction_currency | string | USD, EUR, PLN, or JPY; defaults to USD. |
card_bin | string | 6 through 9 digits; defaults to 512345. |
card_last_four | string | Exactly 4 digits; defaults to a random value. |
network_transaction_id | string | 1 through 64 printable ASCII characters without spaces; defaults to a random UUID. |
All fields are optional; omission or null selects the default. Amounts follow the currency’s exponent: the maximum is 100000000 minor units for USD, EUR, and PLN, or 1000000 for JPY. Invalid values return 422 with a field path. Unknown enrolments return 404 NOT_FOUND for either simulation.
Idempotency
All POST operations accept Idempotency-Key. It is required for creating a webhook endpoint and for both simulations. Use a fresh value for each new operation, such as a UUID, and reuse it only to retry that same operation. Values must contain 1 through 255 printable ASCII characters.
A retry with the same API key, idempotency key, method, path, query, version, and JSON body returns the stored status and body and makes no additional change. JSON object key order and whitespace do not affect the comparison. The replay response includes Idempotent-Replayed: true. Retain the same URL, query, version, and values when retrying.
Records are retained for 24 hours and then become eligible for removal. Use unique keys indefinitely; do not rely on a key becoming reusable at an exact time. A stored business error is replayed as well as a successful result. Authentication, version, permission, rate-limit, and input-schema errors do not reserve the key; server errors can be retried. Replays still require a currently valid key with the required permission.
A missing required key returns 400 IDEMPOTENCY_KEY_MISSING; an invalid value returns 400 IDEMPOTENCY_KEY_INVALID; reusing a key for a different request returns 409 IDEMPOTENCY_KEY_REUSED. Keys are scoped to the API key, so switching API keys does not deduplicate a request. PATCH and DELETE operations do not use this header.
Rate limits
Limits are shared by all API keys of an organisation:
| Operations | Limit |
|---|---|
| All requests | 1,000 per minute. |
| Enrolment creation | Additional limit of 100 per hour. |
| Webhook delivery retries | Additional limit of 100 per hour. |
| Both simulation operations combined | Additional shared limit of 100 per hour. |
Responses include RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset when available. RateLimit-Reset is the number of seconds until that limit resets. When multiple limits apply, the headers describe the one with the fewest requests remaining. An exceeded limit returns 429 RATE_LIMITED and Retry-After in seconds. Wait at least that long before retrying. Idempotent replays do not consume rate-limit capacity.
Errors
Error responses use this shape:
{
"errors": [
{
"code": "VALIDATION_MISSING",
"message": "retry_outcome: Field required",
"path": "retry_outcome"
}
]
}
errors can contain multiple validation failures. code is machine-readable; message explains the problem. path identifies a request field, including an index for an array item, and is omitted for general errors. A validation error for the whole body has path: null. Branch on the code and status rather than exact message wording. Keep the response’s X-Request-ID when contacting support.
| HTTP status | Codes | Meaning |
|---|---|---|
400 | API_KEY_IN_QUERY | Move the key to the authorization header. |
400 | VERSION_MISSING, VERSION_UNKNOWN | Send a supported PaymentRetryAlert-Version. |
400 | IDEMPOTENCY_KEY_MISSING, IDEMPOTENCY_KEY_INVALID | Correct the idempotency header. |
401 | API_KEY_MISSING, API_KEY_INVALID, API_KEY_REVOKED, API_KEY_EXPIRED | Supply a valid key. |
403 | INSUFFICIENT_SCOPE, TEST_MODE_ONLY | Use a key with the required scope and organisation mode. |
404 | NOT_FOUND | Resource or endpoint not found for this key and version. |
405 | METHOD_NOT_ALLOWED | Use a supported HTTP method. |
409 | IDEMPOTENCY_KEY_REUSED | Use the original request or a fresh key for a new operation. |
409 | MID_ALREADY_ENROLLED, UNENROLMENT_CLOSED, MID_CONFLICT | Enrolment conflict; see the relevant operation. |
409 | ENDPOINT_LIMIT_REACHED, DELIVERY_NOT_RETRYABLE, ENROLMENT_NOT_SIMULATABLE | Resource state prevents the requested action. |
422 | VALIDATION_* | Invalid JSON, missing or invalid fields, unknown fields or parameters, or conflicting field names. Examples include VALIDATION_UNKNOWN_FIELD, VALIDATION_UNKNOWN_PARAMETER, VALIDATION_JSON_INVALID, and VALIDATION_FIELD_COLLISION. |
422 | ENDPOINT_URL_NOT_ALLOWED, NOTES_REQUIRED | Correct the named field. |
422 | PARAMETER_CONFLICT, STARTING_AFTER_NOT_FOUND | Correct the event polling parameters. |
429 | RATE_LIMITED | Wait for Retry-After. |
500 | INTERNAL_ERROR | Retry with backoff; keep the same idempotency key for a POST. |
Webhook delivery protocol
Configure endpoints and subscriptions through the REST operations above or under Webhooks in the dashboard. Owners and developers can manage webhooks in the dashboard.
Delivery request
PaymentRetryAlert sends an HTTP POST to the URL you register. The path belongs to your application; /webhooks/paymentretryalert is an example.
| Header | Value |
|---|---|
content-type | application/json |
webhook-id | Delivery ID, prefixed with whdl_. Remains the same across attempts for that delivery. |
webhook-timestamp | Unix timestamp in seconds for the signed attempt. |
webhook-signature | Standard Webhooks signature, in the form v1,<base64 signature>. |
Header names are case-insensitive. Verify the signature using the exact request body bytes before parsing or processing the event.
Endpoint requirements
- Use a public HTTPS URL with a hostname and a valid TLS certificate. IP address URLs, local or private addresses, and URLs containing a username or password are not accepted.
- Accept
POSTrequests directly. Redirects are not followed. - Return any
2xxstatus once you have received the event. Any other status counts as a failure, and we retry. - Respond within 15 seconds. A slower response counts as a failed attempt.
You can have up to 20 webhook endpoints per organisation. Choose at least one event type for each endpoint. You can edit the description and subscriptions or enable and disable the endpoint. To change its URL, create a replacement endpoint.
Event types
| Type | When it is sent | data.object |
|---|---|---|
enrolment.created | An enrolment is created. | Enrolment |
enrolment.updated | An enrolment’s status changes or its unenrolment request is recorded or cleared. | Enrolment |
alert.created | A retry alert is created. | Alert |
alert.updated | An alert’s retry outcome changes. | Alert |
An update event is specific to the change described above. For example, an edit to enrolment notes alone does not emit enrolment.updated.
Event envelope
Each request contains one event. The following example is illustrative:
{
"id": "evt_example_alert_created",
"object": "event",
"type": "alert.created",
"api_version": "2026-10-05",
"organisation_mode": "TEST",
"created_at": "2026-10-20T10:00:00.000Z",
"data": {
"object": {
"id": "alrt_example",
"object": "alert",
"organisation_id": "org_example",
"enrolment_id": "enrl_example",
"enrolment_mid": "123456789012345",
"card_scheme": "MASTERCARD",
"notification_type": "RETRY_NOW",
"transaction_time": "2026-10-19T08:30:00.000Z",
"transaction_amount_in_cents": 2150,
"transaction_currency": "USD",
"network_transaction_id": "EXAMPLE123",
"card_bin": "512345",
"card_last_four": "1234",
"retry_outcome": null,
"created_at": "2026-10-20T10:00:00.000Z"
}
}
}
Example IDs are placeholders. Treat actual IDs as opaque strings, including their prefixes.
| Field | Type | Description |
|---|---|---|
id | string | Event ID, prefixed with evt_. Use it to deduplicate an event across deliveries and endpoints. |
object | string | Always event. |
type | string | One of the event types above. |
api_version | string | Version of the event’s payload format. The current format is 2026-10-05. |
organisation_mode | string | TEST or LIVE. |
created_at | string | ISO 8601 timestamp for when the event was created. |
data.object | object | Snapshot of the alert or enrolment when this event occurred. |
data.previous_attributes | object | Previous values of changed fields. Present on update events; omitted on creation events. |
Snapshots describe the object at the time of the event, even when an event is delivered later. Parse timestamps with their time zone. Allow unknown fields so additions do not break your receiver.
Update events
For enrolment.updated, data.previous_attributes contains the previous values of the changed status and/or unenrolment_requested_at fields. For alert.updated, it contains the previous retry_outcome, which can be null. The new values are in data.object.
For example, an alert changing from no reported outcome to a successful retry includes:
{
"previous_attributes": {
"retry_outcome": null
}
}
This is an excerpt of data. The event also includes the full alert snapshot with retry_outcome set to SUCCEEDED.
Alert object
| Field | Type | Description |
|---|---|---|
id | string | Alert ID, prefixed with alrt_. |
object | string | Always alert. |
organisation_id | string | Organisation that owns the alert. |
enrolment_id | string | Enrolment associated with the alert. |
enrolment_mid | string | Merchant ID associated with that enrolment. |
card_scheme | string | MASTERCARD for current Mastercard POP alerts. |
notification_type | string | RETRY_NOW for retry alerts. |
transaction_time | string | ISO 8601 timestamp of the original transaction. |
transaction_amount_in_cents | integer or null | Amount in the currency’s ISO 4217 minor units. See below. |
transaction_currency | string | ISO 4217 currency code, or an empty string if unavailable. |
network_transaction_id | string | Network transaction identifier, or an empty string if unavailable. Use it with other transaction details to match a payment. |
card_bin | string | Card bank identification number (BIN), or an empty string if unavailable. |
card_last_four | string | Last four digits of the card, or an empty string if unavailable. |
retry_outcome | string or null | SUCCEEDED, FAILED, or NOT_ATTEMPTED; null until reported or assigned after the reporting timeout. |
created_at | string | ISO 8601 timestamp of when the alert was created. |
Despite its name, transaction_amount_in_cents uses the currency’s minor units, not always hundredths. 2150 means USD 21.50, while 2150 in JPY means JPY 2,150. Use the ISO 4217 exponent for the currency. The amount is null when it cannot be represented exactly in those units or is unavailable. Never interpret null as zero.
The outcome describes your payment retry. PaymentRetryAlert assigns NOT_ATTEMPTED if no outcome is reported within 5 days of receiving the alert; a later API or dashboard report can change it.
Enrolment object
{
"id": "enrl_example",
"object": "enrolment",
"organisation_id": "org_example",
"type": "MASTERCARD_POP",
"status": "ENABLED",
"mastercard_pop_mid": "123456789012345",
"notes": "",
"status_changed_at": "2026-10-20T09:00:00.000Z",
"enabled_at": "2026-10-20T09:00:00.000Z",
"unenrolment_requested_at": null,
"created_at": "2026-10-19T08:00:00.000Z"
}
| Field | Type | Description |
|---|---|---|
id | string | Enrolment ID, prefixed with enrl_. |
object | string | Always enrolment. |
organisation_id | string | Organisation that owns the enrolment. |
type | string | MASTERCARD_POP. |
status | string | PENDING, IN_PROGRESS, ACTION_REQUIRED, ENABLED, PAUSED, UNENROLLED, FAILED, or CANCELLED. See status meanings. |
mastercard_pop_mid | string | Merchant ID. Keep it as a string to preserve leading zeros. |
notes | string | Message about the enrolment, including any required action. Empty when no message is provided. |
status_changed_at | string | ISO 8601 timestamp of the most recent status change. |
enabled_at | string or null | First time the enrolment became enabled. Remains set if it is later paused. |
unenrolment_requested_at | string or null | Time an unenrolment request was made. Null when no request is pending, including after unenrolment completes. |
created_at | string | ISO 8601 timestamp of when the enrolment was created. |
Payload versions
Each endpoint has a payload version. Each delivery keeps the version selected when that delivery was created, so later endpoint version changes do not change the format of its retries. Events retain their original snapshots; an event created in an older format is not converted forward to a newer format.
Signature verification
Signatures follow Standard Webhooks. Each endpoint has its own signing secret, starting with whsec_. You can reveal the secret on its dashboard page. Keep it in server-side secret storage.
To verify a request:
- Read
webhook-id,webhook-timestamp, andwebhook-signatureand retain the raw body bytes. - Check timestamp freshness. A recommended receiver tolerance is 5 minutes in either direction; keep your server clock accurate.
- Remove
whsec_from the secret and base64-decode the remainder to obtain the signing key. - Build the signed bytes as the UTF-8 encoding of
<webhook-id>.<webhook-timestamp>.followed by the raw body bytes. - Compute HMAC-SHA256 with the decoded key and base64-encode the digest.
- Compare it with the signature value after
v1,, using a constant-time comparison. If the header contains multiple space-separated signatures, accept any matchingv1signature.
import { createHmac, timingSafeEqual } from 'node:crypto';
// secret: the endpoint's whsec_ signing secret. headers: lower-case header
// names, as in Node's request.headers. body: the raw request body (Buffer).
export function verifyWebhook(secret, headers, body, toleranceSeconds = 300) {
const id = headers['webhook-id'];
const timestamp = headers['webhook-timestamp'];
const signatures = headers['webhook-signature'];
if (!id || !/^\d+$/.test(timestamp ?? '') || !signatures) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;
const key = Buffer.from(secret.slice('whsec_'.length), 'base64');
const expected = createHmac('sha256', key).update(`${id}.${timestamp}.`).update(body).digest();
return signatures.split(' ').some((signature) => {
if (!signature.startsWith('v1,')) return false;
const supplied = Buffer.from(signature.slice(3), 'base64');
return supplied.length === expected.length && timingSafeEqual(supplied, expected);
});
}
import base64
import hashlib
import hmac
import time
def verify_webhook(secret: str, headers, body: bytes, tolerance: int = 300) -> bool:
"""secret: the endpoint's whsec_ signing secret. headers: a case-insensitive
mapping, such as Flask's request.headers. body: the raw request body."""
msg_id = headers.get("webhook-id", "")
timestamp = headers.get("webhook-timestamp", "")
signatures = headers.get("webhook-signature", "")
if not msg_id or not (timestamp.isascii() and timestamp.isdigit()):
return False
if abs(time.time() - int(timestamp)) > tolerance:
return False
key = base64.b64decode(secret.removeprefix("whsec_"))
signed = f"{msg_id}.{timestamp}.".encode() + body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
return any(
signature.startswith("v1,") and hmac.compare_digest(signature[3:], expected)
for signature in signatures.split()
)
<?php
// $secret: the endpoint's whsec_ signing secret. $headers: getallheaders().
// $body: the raw request body, file_get_contents('php://input').
function verify_webhook(string $secret, array $headers, string $body, int $tolerance = 300): bool
{
$headers = array_change_key_case($headers, CASE_LOWER);
$id = $headers['webhook-id'] ?? '';
$timestamp = $headers['webhook-timestamp'] ?? '';
$signatures = $headers['webhook-signature'] ?? '';
if ($id === '' || !ctype_digit($timestamp) || abs(time() - (int) $timestamp) > $tolerance) {
return false;
}
$key = base64_decode(substr($secret, strlen('whsec_')));
$expected = base64_encode(hash_hmac('sha256', "{$id}.{$timestamp}.{$body}", $key, true));
foreach (explode(' ', $signatures) as $signature) {
if (str_starts_with($signature, 'v1,') && hash_equals($expected, substr($signature, 3))) {
return true;
}
}
return false;
}
package webhooks
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"net/http"
"strconv"
"strings"
"time"
)
// VerifyWebhook checks a PaymentRetryAlert signature. secret is the endpoint's
// whsec_ signing secret; body is the raw request body.
func VerifyWebhook(secret string, header http.Header, body []byte) bool {
id := header.Get("webhook-id")
timestamp := header.Get("webhook-timestamp")
seconds, err := strconv.ParseUint(timestamp, 10, 63)
if id == "" || err != nil {
return false
}
if age := time.Since(time.Unix(int64(seconds), 0)); age > 5*time.Minute || age < -5*time.Minute {
return false
}
key, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(secret, "whsec_"))
if err != nil {
return false
}
mac := hmac.New(sha256.New, key)
mac.Write([]byte(id + "." + timestamp + "."))
mac.Write(body)
expected := mac.Sum(nil)
for _, signature := range strings.Fields(header.Get("webhook-signature")) {
value, ok := strings.CutPrefix(signature, "v1,")
if !ok {
continue
}
if supplied, err := base64.StdEncoding.DecodeString(value); err == nil && hmac.Equal(supplied, expected) {
return true
}
}
return false
}
Reject requests that fail verification. Do not reserialize JSON before checking the signature. Delivery retries have a fresh signed timestamp, so an older event can still arrive in a valid, fresh request. The integration guide shows where verification fits in a webhook endpoint.
Retries and duplicates
A 2xx response completes an attempt successfully. Other status codes, redirects, connection failures, and timeouts count as failures.
After the first failed attempt, automatic retries wait approximately 1 minute, 5 minutes, 30 minutes, 2 hours, and 12 hours, respectively, after each preceding failed attempt. Each delay can be up to 10% longer. There are at most 6 automatic attempts, including the first.
Your endpoint can receive an event more than once, and events can arrive out of order. Store id from the event body as your event deduplication key. webhook-id identifies delivery to a particular endpoint; the same event delivered to another endpoint has a different delivery ID.
In the dashboard, Retry now brings a scheduled attempt forward. Resend makes one additional attempt when no automatic attempt is pending; a failed manual resend does not start a new automatic retry sequence. A delivery that succeeded previously keeps its successful status even if a later resend fails, so inspect individual attempts when diagnosing a resend.
Disabled endpoints and recovery
Disabling or deleting an endpoint cancels its planned retries. A request already in flight can still arrive. Events occurring while an endpoint is disabled are not sent to it later, and creating an endpoint does not backfill earlier events.
Repeated failures can cause an endpoint to be disabled automatically. Owners and developers receive a warning email and, if the failure condition persists for another 24 hours, a disablement email. Fix the receiver, enable the endpoint, and review existing deliveries for manual resends. Enabling it does not restart cancelled retries automatically.
Use GET /events and GET /alerts, or Events and Alerts in the dashboard, to reconcile activity that your receiver missed. Review the integration troubleshooting steps before contacting support.