# Checkouts

> Create a single-use, order-bound checkout, redirect the buyer to the Moov-hosted page, and read its status safely from your server.

A checkout is a single-use payment page for one order. NorthechPay creates a real Moov payment link with one allowed use. The buyer pays on Moov's hosted page and the money goes to the merchant's own Moov wallet.

| Method   | Path                               | Ability                                | Purpose                  |
| -------- | ---------------------------------- | -------------------------------------- | ------------------------ |
| `POST`   | `/merchant/checkouts`              | `checkouts:write`                      | Create a checkout        |
| `GET`    | `/merchant/checkouts`              | `checkouts:read`                       | List checkouts           |
| `GET`    | `/merchant/checkouts/{id}`         | `checkouts:read`                       | Read one checkout        |
| `POST`   | `/merchant/checkouts/{id}/refresh` | `checkouts:read`                       | Re-read it from Moov now |
| `DELETE` | `/merchant/checkouts/{id}`         | `checkouts:read` and `checkouts:write` | Disable it at Moov       |

## Create a checkout

```bash
curl -sS -X POST "$NORTHECHPAY_API_BASE/merchant/checkouts" \
  -H "Authorization: Bearer $NORTHECHPAY_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001-1" \
  -d '{
    "amount": 2450,
    "title": "Order #1001",
    "description": "2 x House Blend 12oz",
    "merchant_reference": "ORDER-1001",
    "allowed_methods": ["card-payment"],
    "line_items": [
      { "name": "House Blend 12oz", "quantity": 2, "unit_amount": 1225, "product_id": "house-blend" }
    ],
    "metadata": { "cart_id": "c_7781" }
  }'
```

```js
async function createCheckout(order) {
    const response = await fetch(
        `${process.env.NORTHECHPAY_API_BASE}/merchant/checkouts`,
        {
            method: 'POST',
            headers: {
                Authorization: `Bearer ${process.env.NORTHECHPAY_API_KEY}`,
                Accept: 'application/json',
                'Content-Type': 'application/json',
                'Idempotency-Key': order.checkoutIdempotencyKey, // saved with the order before this call
            },
            body: JSON.stringify({
                amount: order.amountCents,
                title: `Order #${order.number}`,
                merchant_reference: order.reference,
                line_items: order.items.map((item) => ({
                    name: item.name,
                    quantity: item.quantity,
                    unit_amount: item.unitCents,
                })),
            }),
        },
    );

    const body = await response.json();
    if (!response.ok) {
        throw new Error(
            `${body.error.code}: ${body.error.message} (request ${body.error.request_id})`,
        );
    }
    return body.data;
}
```

```php
use Illuminate\Support\Facades\Http;

function createCheckout(Order $order): array
{
    return Http::baseUrl(config('services.northechpay.api_base'))
        ->withToken(config('services.northechpay.api_key'))
        ->acceptJson()
        ->timeout(45)
        ->withHeaders(['Idempotency-Key' => $order->checkout_idempotency_key])
        ->post('/merchant/checkouts', [
            'amount' => $order->amount_cents,
            'title' => 'Order #'.$order->number,
            'merchant_reference' => $order->reference,
            'line_items' => $order->items->map(fn ($item) => [
                'name' => $item->name,
                'quantity' => $item->quantity,
                'unit_amount' => $item->unit_cents,
            ])->all(),
        ])
        ->throw()
        ->json('data');
}
```

### Request fields

| Field                      | Type          | Rules                                                                                                                     |
| -------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `amount`                   | integer       | Required. Cents. From `50` ($0.50) to `1000000` ($10,000.00).                                                             |
| `currency`                 | string        | Optional. `USD` only. Defaults to `USD`.                                                                                  |
| `title`                    | string        | Required. 2 to 100 characters. Shown to the buyer on the Moov page.                                                       |
| `description`              | string        | Optional. Up to 255 characters. Shown on the Moov page. Defaults to the title there.                                      |
| `merchant_reference`       | string        | Optional. Up to 100 characters from `A-Z a-z 0-9 . _ : # / -`. Use your order ID.                                         |
| `allowed_methods`          | array         | Optional. At least one of `card-payment`, `apple-pay`, `google-pay`, `ach-debit-collect`. Defaults to `["card-payment"]`. |
| `line_items`               | array         | Optional. Up to 50 items. When sent, `amount` must equal the sum of `quantity × unit_amount`.                             |
| `line_items[].name`        | string        | Required. Up to 150 characters.                                                                                           |
| `line_items[].quantity`    | integer       | Required. 1 to 1000.                                                                                                      |
| `line_items[].unit_amount` | integer       | Required. Cents, 0 to 1000000.                                                                                            |
| `line_items[].product_id`  | string        | Optional. Up to 64 characters. Your SKU stays in NorthechPay. Only a Moov product UUID is sent to Moov.                   |
| `expires_at`               | ISO 8601 date | Optional. More than 5 minutes and less than 90 days from now. Defaults to 24 hours from now.                              |
| `metadata`                 | object        | Optional. Up to 10 keys. String values up to 200 characters. Stored in NorthechPay, not sent to Moov.                     |
| `require_phone`            | boolean       | Optional. Ask the buyer for a phone number. Default `false`.                                                              |
| `require_address`          | boolean       | Optional. Ask the buyer for an address. Default `false`.                                                                  |
| `idempotency_key`          | string        | Optional. Body alternative to the `Idempotency-Key` header. The header wins.                                              |
| `max_uses`                 | —             | Not allowed on checkouts. Use [payment links](/docs/payment-links) for reusable links.                                    |

> **Note:** `card-payment` is the default and the only method verified end to end in test mode. `ach-debit-collect` needs the Moov `collect-funds.ach` capability, which NorthechPay does not request for merchants by default, so expect `422 merchant_not_ready`.

### Response

A new checkout returns `201 Created`. A replay of the same request returns `200 OK`. Both send these headers:

| Header                | Value                                                       |
| --------------------- | ----------------------------------------------------------- |
| `Idempotency-Key`     | The key NorthechPay used for this request                   |
| `Idempotent-Replayed` | `true` when the checkout already existed, otherwise `false` |

```json
{
    "data": {
        "id": "01a20926-5b7e-7c2d-9f41-6e8d2c3b1421",
        "object": "checkout",
        "status": "open",
        "status_label": "Awaiting payment",
        "paid": false,
        "amount": {
            "amount": 2450,
            "currency": "USD",
            "decimal": "24.50",
            "formatted": "$24.50"
        },
        "title": "Order #1001",
        "description": "2 x House Blend 12oz",
        "merchant_reference": "ORDER-1001",
        "allowed_methods": ["card-payment"],
        "line_items": [
            {
                "name": "House Blend 12oz",
                "quantity": 2,
                "unit_amount": 1225,
                "product_id": "house-blend"
            }
        ],
        "max_uses": 1,
        "uses": 0,
        "expires_at": "2026-11-25T16:03:00+00:00",
        "metadata": { "cart_id": "c_7781" },
        "checkout_url": "https://moov.link/p/hSYJZTsTH9",
        "hosted_by": "moov",
        "provider": { "payment_link_code": "hSYJZTsTH9", "status": "active" },
        "failure": null,
        "paid_at": null,
        "created_via": "api",
        "created_at": "2026-11-24T16:03:00+00:00",
        "last_synced_at": "2026-11-24T16:03:00+00:00"
    }
}
```

### Checkout fields

| Field              | Meaning                                                                                             |
| ------------------ | --------------------------------------------------------------------------------------------------- |
| `id`               | NorthechPay checkout ID (UUID). Store it with your order.                                           |
| `object`           | `checkout` here. `payment_link` for reusable links.                                                 |
| `status`           | See [Statuses](/docs/statuses).                                                                     |
| `status_label`     | Human-readable status. Do not parse it.                                                             |
| `paid`             | `true` once Moov reported the transfer completed. Stays `true` after a refund or dispute.           |
| `amount`           | Money object: `amount` in cents, `currency`, `decimal` string and `formatted` string.               |
| `checkout_url`     | The Moov-hosted payment page. `null` while `status` is `creating` or after `creation_failed`.       |
| `hosted_by`        | Always `moov`.                                                                                      |
| `provider`         | Moov's payment link `payment_link_code` and its `status` (`active`, `used`, `disabled`, `expired`). |
| `failure`          | `null`, or `{ "code", "message" }` from the last failure.                                           |
| `max_uses`, `uses` | Always `1` for checkouts, and how many times Moov counted it as used.                               |
| `paid_at`          | When the payment completed at Moov.                                                                 |
| `created_via`      | `api` or `dashboard`.                                                                               |
| `last_synced_at`   | When NorthechPay last read this checkout from Moov.                                                 |
| `transactions`     | Only on `GET /merchant/checkouts/{id}` and refresh. The Moov transfers made through this checkout.  |

## Send the buyer to the payment page

Redirect the buyer to `checkout_url`. It is on Moov's domain, not yours. Tell the buyer that, so the change of domain is not a surprise.

Moov payment links have **no return URL**. The buyer does not come back to your site on their own. Show a clear link back to your order page, and on that page show the status your server knows.

> **Warning:** The buyer returning to your site, seeing Moov's "Thanks for your payment" page, or any value in the browser is not proof of payment. Only `paid: true` from your server's own read, or a verified `checkout.paid` webhook, is.

## Read a checkout

`GET /merchant/checkouts/{id}` returns what NorthechPay knows, including `transactions`. NorthechPay keeps it current from Moov webhooks and a re-read every few minutes.

`POST /merchant/checkouts/{id}/refresh` asks Moov right now: it reads the payment link and every transfer made through it, then returns the updated checkout. Use it when a buyer clicks "Check payment status" on your order page. Do not call it in a loop. It counts toward your rate limit and calls Moov each time.

```bash
curl -sS -X POST "$NORTHECHPAY_API_BASE/merchant/checkouts/01a20926-5b7e-7c2d-9f41-6e8d2c3b1421/refresh" \
  -H "Authorization: Bearer $NORTHECHPAY_API_KEY" \
  -H "Accept: application/json"
```

```js
const response = await fetch(
    `${process.env.NORTHECHPAY_API_BASE}/merchant/checkouts/${checkoutId}/refresh`,
    {
        method: 'POST',
        headers: {
            Authorization: `Bearer ${process.env.NORTHECHPAY_API_KEY}`,
            Accept: 'application/json',
        },
    },
);
const { data: checkout } = await response.json();
```

```php
$checkout = Http::baseUrl(config('services.northechpay.api_base'))
    ->withToken(config('services.northechpay.api_key'))
    ->acceptJson()
    ->post("/merchant/checkouts/{$checkoutId}/refresh")
    ->throw()
    ->json('data');
```

### Approval, settlement and completion

| Stage     | `status`     | `paid`  | Meaning                                                 | Ship? |
| --------- | ------------ | ------- | ------------------------------------------------------- | ----- |
| Submitted | `processing` | `false` | Moov has a payment in flight.                           | No    |
| Approved  | `authorized` | `false` | The card network approved the card. Funds are settling. | No    |
| Completed | `paid`       | `true`  | Moov reports the transfer `completed` into the wallet.  | Yes   |

An approved card can still fail before it completes. Wait for `paid`.

## List checkouts

`GET /merchant/checkouts` returns checkouts only (not reusable payment links), newest first.

| Query parameter | Meaning                                                                               |
| --------------- | ------------------------------------------------------------------------------------- |
| `status`        | Exact status, for example `paid`.                                                     |
| `search`        | Partial match on `title` or `merchant_reference`, or exact `id` or payment link code. |
| `per_page`      | 1 to 100. Default 20.                                                                 |
| `page`          | Page number.                                                                          |

`search` on `merchant_reference` is a partial match: `ORDER-100` also finds `ORDER-1001`. Compare `merchant_reference` exactly in your code. Better still, store the checkout `id` and read it directly.

## Disable a checkout

`DELETE /merchant/checkouts/{id}` disables the payment link at Moov if it is still active, re-reads it, and returns the checkout. Use it when an order is cancelled before payment.

- A checkout with no Moov link yet (`creating` or `creation_failed`) returns `409 checkout_not_disableable`.
- Disabling does not cancel a payment that is already in flight. The status follows the transfers, so the checkout can still become `paid`. Re-read it after disabling.

## Idempotency

Send `Idempotency-Key` on every create.

- Format: 8 to 128 characters from `A-Z a-z 0-9 . _ : -`. A good key is your order ID plus an attempt number, for example `order-1001-1`.
- Scope: per merchant. Checkouts and payment links share the same keys.
- Same key, same request: you get the original checkout back (`200`, `Idempotent-Replayed: true`), with its current status. No second Moov link is created.
- Same key, different request: `409 idempotency_conflict`. `expires_at` is not part of the comparison.
- A header or body key that does not match the format fails with `422 validation_failed`; nothing is created.
- No key at all: NorthechPay generates one and returns it in the `Idempotency-Key` response header. Store it and send it on any retry. If your request times out before you see the response, you cannot know that key, so always send your own.

> **Warning:** Save the key with your order before you call the API, and reuse it on every retry of that call.

## Timeouts and unknown outcomes

If the create call times out on your side, or returns `503 provider_unavailable` or `504 provider_outcome_unknown`, you do not know whether a Moov link exists.

1. Retry with the **same** `Idempotency-Key`. You get the stored checkout back. A retry never sends a second create to Moov.
2. If `status` is `creating`, `checkout_url` is `null`. Wait, then `GET` or refresh the checkout. NorthechPay looks for the link at Moov. If it finds one, the status becomes `open`. If none exists 15 minutes after creation, the status becomes `creation_failed`.
3. Only after `creation_failed` (or `expired`) create a new checkout for the order, with a new key such as `order-1001-2`.

`creation_failed` is final for its key. A replay with that key keeps returning the failed checkout.

## Errors you may see

| HTTP | `error.code`                 | Meaning                                                                                                 |
| ---- | ---------------------------- | ------------------------------------------------------------------------------------------------------- |
| 403  | `insufficient_scope`         | The key lacks `checkouts:write`.                                                                        |
| 409  | `idempotency_conflict`       | The key was used with different parameters.                                                             |
| 422  | `validation_failed`          | A field is invalid. `error.details` lists each field.                                                   |
| 422  | `merchant_not_ready`         | The merchant is not onboarded or lacks a Moov capability. `details.missing_capabilities` may list them. |
| 422  | `provider_validation_failed` | Moov rejected the link. The checkout is `creation_failed`.                                              |
| 429  | `rate_limited`               | More than 30 creates per minute. Wait for `Retry-After`.                                                |
| 502  | `provider_mismatch`          | Moov returned a link for another account or mode. It was not used.                                      |
| 503  | `provider_unavailable`       | Moov could not be reached. Retry later with the same key.                                               |
| 504  | `provider_outcome_unknown`   | Moov may have created the link. Retry with the same key or read the checkout.                           |

See [Errors](/docs/errors) for the full list.
