# PaymentRetryAlert documentation

> Markdown version of https://www.paymentretryalert.com/docs/

Enrol your merchant IDs, receive signed RETRY_NOW webhooks when Mastercard identifies a higher likelihood of payment approval, retry through your existing payment provider and report the outcome. Everything you need to integrate, with documentation designed for both developers and AI coding agents.

## Start here

- [How it works](https://www.paymentretryalert.com/docs/how-it-works.md): The payment flow end to end: enrolment, alerts, matching, outcomes and test mode.
- [Integration guide](https://www.paymentretryalert.com/docs/integration-guide.md): Store declined payments, receive and match alerts, retry transactions and report outcomes. Manage each step through the dashboard or API.
- [API reference](https://www.paymentretryalert.com/docs/api-reference.md): Every endpoint, field, event and error code, plus signatures, retries and rate limits.

## The integration at a glance

1. **Store your declines.** Save each Mastercard decline with code `51` or `61`: MID, network transaction ID, amount, currency, card BIN and last four.
2. **Enrol your merchant IDs.** Alerts are sent only for enrolled MIDs. Enrol them in the dashboard or with the API. (`POST /enrolments`)
3. **Receive alerts.** Each alert is an `alert.created` event. Receive it by webhook, or poll for it. (`GET /events`)
4. **Match the alert to a decline.** Use the network transaction ID, or the card BIN, last four, amount and currency together.
5. **Retry and report the outcome.** Retry the payment through your payment provider, then report `SUCCEEDED`, `FAILED` or `NOT_ATTEMPTED`. (`PATCH /alerts/{id}`)

## Quickstart

Create an API key under **Developers** in your test organisation, keep it in your secret store as `PRA_API_KEY`, and check which organisation it belongs to:

```bash
curl --fail-with-body "https://api.paymentretryalert.com/v1/me" \
  -H "Authorization: Bearer $PRA_API_KEY" \
  -H 'PaymentRetryAlert-Version: 2026-10-05'
```

A `pra_test_` key returns `"mode": "TEST"`. From there the [integration guide](https://www.paymentretryalert.com/docs/integration-guide.md) registers a webhook endpoint, runs a signed-event receiver, simulates an alert and reports its outcome, end to end in Node.js with no dependencies.

## API essentials

- **Base URL:** `https://api.paymentretryalert.com/v1`
- **Authentication:** `Authorization: Bearer YOUR_API_KEY`. Keys start `pra_test_` or `pra_live_` and select the organisation.
- **Versioning:** `PaymentRetryAlert-Version: 2026-10-05` on every request. There is no implicit default.
- **Webhooks:** [Standard Webhooks](https://www.standardwebhooks.com/) signatures (HMAC-SHA256), 15-second timeout, up to 6 attempts over about 15 hours.
- **Event types:** `alert.created`, `alert.updated`, `enrolment.created`, `enrolment.updated`
- **Idempotency:** `Idempotency-Key` on `POST`; records kept for 24 hours.
- **Rate limits:** 1,000 requests per minute per organisation, shared by all its keys.
- **Schema:** [OpenAPI JSON](https://api.paymentretryalert.com/v1/openapi.json) · [Interactive docs](https://api.paymentretryalert.com/v1/docs)

## Read the docs as Markdown

Every page is also available as plain Markdown, which AI coding tools can read directly. Use **Copy page** at the top of a page, or add `.md` to its address, for example [`/docs/integration-guide.md`](https://www.paymentretryalert.com/docs/integration-guide.md).

## Scope and access

- **Eligible declines:** Recurring Mastercard merchant-initiated transactions declined due to insufficient funds (ISO 8583 code 51) or an exceeded withdrawal limit (code 61).
- **Advisory only:** Alerts indicate when to retry a payment but do not guarantee approval. PaymentRetryAlert never charges the card directly.
- **Billing:** Charged per `RETRY_NOW` alert, with a $100 monthly minimum inclusive of usage. Alerts in test organisations are free. See [pricing](https://www.paymentretryalert.com/#pricing).
- **Access:** PaymentRetryAlert is currently in limited beta. We'll set up your test and live organisations during onboarding. [Request beta access](https://docs.google.com/forms/d/e/1FAIpQLSeQiEKDq_b1vQZoZ1OkajD2QYXPdWNUYy_VnaXsvi8e1MhBfg/viewform) to get started.
