# Changelog

The public API has two version axes. They do not replace each other.

## Path — the breaking boundary

`/v1` is the breaking boundary. A future `/v2` is a new URL\: a client opts in,
and the old surface stays up beside it. Every route in the [API reference](/api-reference)
is served under `/v1`.

## `Mayarin-Version` — the date rev within v1

The `Mayarin-Version` header is the date revision within `/v1`. It covers
additive change\: a new field, a new route, a new response shape that does not
break an existing client. The SDK pins it (`packages/sdk/src/version.ts`) so an
upgrade is a deliberate act, not a side effect of deploying the library.

Send the header to pin a revision\:

```http
Mayarin-Version: 2026-08-11
```

Omit it and you receive the current revision. A pinned revision keeps working
after additive changes ship; an additive change never removes a field or alters
a type an existing client reads.

## Unversioned routes

These stay at the root forever. A printed QR and a shared link encode them, so a
version bump must never move them\:

* `GET /checkout/:id` and sub-routes — the hosted checkout page.
* `GET /invoices/:id/view` — the hosted invoice page.
* `GET /health` — the deployment probe.

A buyer page has no version. It renders whatever the current API serves.

## Revisions

### 2026-08-11 — current

Initial public revision of the `/v1` merchant API. Covers payment intents,
payments and refunds, quotes, catalog and carts, payment links, invoices,
provider webhooks, and the intentionally unversioned buyer surfaces.

This is still the current revision. Everything below shipped **additively**
inside it — a new route or a new optional field never removes anything a pinned
client reads, so none of it moved the date.

## Additive since 2026-08-11

**Agent payments (x402).** `/v1/x402/resources` registers, lists and unlists an
endpoint you sell per request. The buyer-facing half is unversioned and keyless\:
`GET /x402/resources/:id/payment-required`, `POST …/verify`, `POST …/settle`, and
the `GET /x402/resources` and `GET /x402/payables` discovery indexes. See
[the guide](/guides/x402).

**A third execution path.** `executionPath` accepts `x402` beside
`deposit-match` and `on-chain-contract`, on payment intents, cart checkout and
invoice checkout, and reports back which path a payment took. See
[execution paths](/concepts/execution-paths).

**Listing an obligation to agents.** `POST /v1/invoices/:id/list` and
`POST /v1/payment-links/:id/list`, each with an `/unlist` twin. Nothing is listed
by default, and listing only affects whether something is *found*.

**Refunds.** `POST /v1/payments/:id/refunds` and `GET /v1/payments/:id/refunds`.
Idempotent\: a repeated key returns the refund it made rather than issuing a
second one, and an omitted amount refunds everything still refundable.

**Wider currency and rail coverage.** More pricing currencies, EURC as a
settlement and payer asset, and additional chains including Arc testnet. See
[currencies, assets and chains](/concepts/rails).

**Subscriptions.** `/v1/subscriptions` creates, lists, reads, pauses, resumes and cancels a recurring plan with a secret key. Every cycle is an invoice Mayarin issues and emails, and payments on it carry `metadata.subscriptionId`. The SDK exposes it as `commerce.subscriptions`. See [the guide](/guides/subscriptions).

**Retrying a failed payment.** `POST /v1/payments/:id/retry` reopens a payment that failed after the payer's funds arrived and settles it, re-signing an expired deposit order with the same terms. See [payment lifecycle](/concepts/payment-lifecycle#retrying-a-failed-payment).

**Invoice and receipt PDFs.** `GET /v1/payments/:id/invoice.pdf` and `GET /v1/payments/:id/receipt.pdf`, drawn from the payment's own records. The receipt carries the settlement proof.

**Settlement per chain, and USDG.** A merchant's settlement asset can differ per chain, and each rail from `GET /v1/payment-links/:id/rails` reports its `settlementAsset`. USDG (Global Dollar) is a settlement and payer asset, on Arbitrum Sepolia. See [currencies, assets and chains](/concepts/rails).

**Buyer protection (escrow).** `escrow: { holdSeconds, arbiter?, bondBps? }` on a payment intent settles it into a per-payment escrow, and `GET /v1/payments/:id/escrow` (`payment.getEscrow` in the SDK) reports where the funds are, the dispute, and the calls to release or refund. A dispute is announced by the `escrow.disputed` webhook. The arbiter can split a disputed payment, and a merchant can require a dispute bond. See [the guide](/guides/escrow).

**Disputes API.** `GET /v1/disputes`, `GET /v1/disputes/:id` and `POST /v1/disputes/:id/messages` read the disputes buyers open on your escrowed payments and their threads, and post your answer (`disputes.list`, `disputes.get` and `disputes.reply` in the SDK). Reading needs `payments:read`; answering needs the new `disputes:manage` permission. Two webhooks join `escrow.disputed`\: `escrow.dispute.message` for every message in the thread and `escrow.dispute.resolved` when the funds move. See [the guide](/guides/disputes).

**Flagged payments.** `GET /v1/risk/flags` lists the payments Mayarin's fraud rules flagged or blocked, and the `payment.flagged` webhook announces each one as it happens. A flag does not stop a payment; only a payer on Mayarin's denylist is refused at confirm.

**Merchant logo on documents.** Invoice and receipt PDFs, and invoice and subscription emails to your buyers, carry the logo uploaded in dashboard Settings.

**Hosted checkout URL on cart checkout.** `POST /v1/carts/checkout` returns `url`, the absolute hosted checkout page for the new intent.

**Cart checkout without `merchant`, and a React pay button.** `merchant` on `POST /v1/carts/checkout` is optional\: the key already names the merchant. With a publishable key, the intent always records the merchant's own name, city and country from dashboard Settings, whatever the body says, so set your city and country first. `@mayarin/react` adds a `PayButton` that sends the buyer to the hosted checkout without a product catalog. See [React pay button](/sdk/typescript/react).

None of these require a client change. A client pinned to `2026-08-11` keeps
working and simply does not see the new fields.

**Analytics.** `GET /v1/analytics` returns revenue, orders, settlements and payment performance for a date range, with a total, a change against the previous range and a point per bucket for each metric. The SDK exposes it as `analytics.get`. See [the guide](/guides/analytics).

**Checkout in a modal.** The hosted checkout opens over a merchant's page or app instead of a new tab. `openCheckout` in `@mayarin/sdk/browser` does it in plain JavaScript, `PayButton` takes `mode="modal"` with `onSuccess`, `onFailed` and `onClose`, and `@mayarin/react-native` shows it as a bottom sheet. The checkout reports `ready`, `success`, `failed` and `close` to the host. See [React pay button](/sdk/typescript/react#open-the-checkout-in-a-modal) and [React Native](/sdk/typescript/react-native).

**Waiting for a payment, and a guide to your own screen.** `payment.waitFor(id)` in the SDK reads a payment with a growing pause until it is `COMPLETED`, `FAILED` or `EXPIRED`, and throws `WAIT_TIMEOUT` if the payer has not paid in time. [Your own checkout screen](/guides/headless) walks through taking a payment on the API alone\: choose a rail, read the deposit address from JSON, and learn the result from a webhook.
