> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monirates.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stable Checkout

> Accept USDT and USDC payments on your website with a hosted checkout page or an embedded widget.

## Overview

Stable Checkout lets your customers pay you in stablecoins without leaving your checkout flow. You create a checkout for an order from your server, and the customer pays on a Monirates-hosted page, either in a pop-up on your site (the **widget**) or by being sent to the page (the **hosted page**).

Each checkout gets its own one-time deposit address. When the customer pays, Monirates records the payment, moves the funds into your [Stable Wallet](https://docs.monirates.com/guides/stable-wallets.md), and sends you a webhook.

See [Supported Networks & Tokens](https://docs.monirates.com/guides/stable-networks.md) for the networks and tokens you can use, and which pairs are available in sandbox and production. Set `network` and `token` when you create a checkout if you want to avoid the customer picking a pair that isn't available.

> [!NOTE]
>
> You need a Stable Wallet before you can create checkouts. Creating a checkout without one returns a `400` error: "You need to have a stable wallet before creating a checkout". See [Create Wallet](https://docs.monirates.com/guides/stable-wallets.md#create-wallet).

> [!WARNING]
>
> Fees may apply. A fee may be taken from each payment before it is credited to your Stable Wallet, so the amount credited can be lower than what the customer paid. The checkout's `amount`, `amountPaid` and `amountReceived` are always what the customer paid, before any fee.

| | Sandbox | Production |
| - | - | - |
| API base URL | `https://dev.interface.monirates.com/v1` | `https://interface.monirates.com/v1` |
| Checkout page | `https://dev.pay.monirates.com/<widgetCode>` | `https://pay.monirates.com/<widgetCode>` |
| Widget script | `https://dev.pay.monirates.com/inline.js` | `https://pay.monirates.com/inline.js` |

***

## How it works

```mermaid theme={null}
sequenceDiagram
    participant C as Customer (browser)
    participant S as Your server
    participant M as Monirates
    C->>S: Place order
    S->>M: POST /stable-currency/checkout (x-api-key)
    M-->>S: { _id, widgetCode, hostedUrl, ... }
    S-->>C: widgetCode (or hostedUrl)
    C->>M: Opens checkout (widget or hosted page)
    C->>M: Chooses network + token, sends funds
    M-->>S: Webhook: stable_wallet.checkout_paid
    S->>M: GET /stable-currency/checkout/:id (optional check)
    S-->>C: Order confirmed
```

1. Your **server** creates the checkout with your API key.
2. Your server gives the browser only the `widgetCode` (widget) or the `hostedUrl` (hosted page). Your API key never reaches the browser.
3. The customer chooses a network and token (unless you fixed them), gets a deposit address, and pays.
4. Monirates sends you a webhook. Your server marks the order as paid and fulfils it.

***

## Step-by-step integration

**1. Create the checkout on your server**

Call this from your backend when the customer is ready to pay. Take the amount from your own order records, never from the browser.

**Endpoint**

```text theme={null}
POST /v1/stable-currency/checkout
```

**Headers**

```text theme={null}
x-api-key: YOUR_API_KEY
Content-Type: application/json
```

**Request body**

| Field | Type | Required | Description |
| - | - | - | - |
| `amount` | string | Yes | Amount to collect, in the token's units (1 = 1 USDT/USDC). Positive, up to 6 decimals, e.g. `"25"` or `"12.50"`. |
| `reference` | string | No | Your own ID for this payment, such as the order number. Letters, numbers, `.`, `_` and `-`, up to 64 characters. Generated if you leave it out. |
| `description` | string | No | Shown to the customer on the checkout page. Up to 255 characters. |
| `redirectUrl` | string | No | Where the hosted page's **Continue** button sends the customer after paying. Must be `http` or `https`. |
| `network` | string | No | Fix the [network](https://docs.monirates.com/guides/stable-networks.md). If you leave it out, the customer chooses. |
| `token` | string | No | Fix the [token](https://docs.monirates.com/guides/stable-networks.md). If you leave it out, the customer chooses. |
| `validFor` | number | No | How long the checkout stays open, in seconds. Minimum `900` (15 minutes), which is also the default. |

```bash cURL theme={null}
curl -X POST https://dev.interface.monirates.com/v1/stable-currency/checkout \
  -H "x-api-key: MR_v1_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "25.00",
    "reference": "ORDER-1042",
    "description": "Order #1042",
    "redirectUrl": "https://shop.example.com/order-complete",
    "validFor": 1800
  }'
```

```javascript Node.js theme={null}
app.post("/api/orders/:orderId/pay", async (req, res) => {
  const order = await db.orders.find(req.params.orderId);

  const response = await fetch(`${process.env.MONIRATES_API_URL}/stable-currency/checkout`, {
    method: "POST",
    headers: {
      "x-api-key": process.env.MONIRATES_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amount: order.total,            // e.g. "25.00"
      reference: order.id,
      description: `Order #${order.id}`,
      redirectUrl: "https://shop.example.com/order-complete",
    }),
  });
  const { data } = await response.json();

  // Save the checkout id against the order so you can look it up later
  await db.orders.update(order.id, { checkoutId: data._id });

  // Only these two values go to the browser
  res.json({ widgetCode: data.widgetCode, hostedUrl: data.hostedUrl });
});
```

**Response**

```json theme={null}
{
  "success": true,
  "message": "Checkout created successfully",
  "data": {
    "_id": "6a71c2e4b3f9a8d1e2c4f501",
    "widgetCode": "k7m3qp9xw2hnra",
    "reference": "ORDER-1042",
    "hostedUrl": "https://dev.pay.monirates.com/k7m3qp9xw2hnra",
    "amount": "25.00",
    "description": "Order #1042",
    "redirectUrl": "https://shop.example.com/order-complete",
    "network": null,
    "token": null,
    "address": null,
    "status": "CREATED",
    "amountPaid": "0",
    "amountReceived": "0",
    "expiresAt": "2026-11-23T10:30:00.000Z",
    "paidAt": null,
    "createdAt": "2026-11-23T10:00:00.000Z"
  }
}
```

| Field | Description |
| - | - |
| `_id` | The checkout's ID. Use it to fetch the checkout later. |
| `widgetCode` | Pass this to the widget (`MoniratesPay.open({ code: widgetCode })`). |
| `hostedUrl` | The full checkout page URL, for the hosted page option. |
| `network` / `token` | `null` until you or the customer choose them. |
| `address` | `null` until the customer generates a deposit address. |
| `amountPaid` | What counts towards the order, never more than `amount`. Only deposits in the checkout's token, on its network, that arrive before `expiresAt` count. Deposits in the wrong token or on the wrong network never count. The checkout is `PAID` when it equals `amount`. |
| `amountReceived` | Everything that arrived at the checkout's address in its token and on its network, including overpayments and late or extra deposits. Equal to `amountPaid` unless the customer sent too much or paid late. |

> [!TIP]
>
> **Safe to retry.** If you send the same `reference` again with the same `amount`, `network` and `token`, you get the original checkout back instead of a new one. The same `reference` with different details returns a `409` error, so one order can never get two checkouts.

**2. Show the checkout to your customer**

Pick one of the two options.

> [tab] Widget (pop-up on your site)
>
> Add the Monirates script to your page. It creates a global `MoniratesPay` object. Then call `MoniratesPay.open()` with the `widgetCode` your server returned. The checkout opens in a pop-up over your page.
>
> ```html theme={null}
> <!-- Sandbox: https://dev.pay.monirates.com/inline.js -->
> <script src="https://pay.monirates.com/inline.js"></script>
>
> <button id="pay">Pay with crypto</button>
>
> <script>
>   document.getElementById("pay").onclick = async () => {
>     // Your server creates the checkout (step 1) and returns the widgetCode
>     const res = await fetch("/api/orders/1042/pay", { method: "POST" });
>     const { widgetCode } = await res.json();
>
>     MoniratesPay.open({
>       code: widgetCode,
>       theme: "auto", // "light", "dark" or "auto"
>       onLoad: () => console.log("Checkout is showing"),
>       onSuccess: (payment) => {
>         // Ask your server to confirm, then show your thank-you page
>         window.location.href = "/orders/1042/thank-you";
>       },
>       onError: (error) => console.warn(error.message, error.status),
>       onClose: () => console.log("Customer closed the checkout"),
>     });
>   };
> </script>
> ```
>
> **Options**
>
> | Option | Description |
> | - | - |
> | `code` | The `widgetCode` from the create response. |
> | `url` | Or the full `hostedUrl` from the create response, used instead of `code`. |
> | `theme` | `"light"`, `"dark"` or `"auto"` (default: follows the customer's system setting). |
> | `onLoad()` | The checkout page has loaded. |
> | `onSuccess(payment)` | The payment was received. See the payload below. |
> | `onExpired(result)` | The checkout expired before it was paid in full: `{ code, reference, amount, amountPaid, amountReceived }`. If `amountPaid` is above `0`, it was part-paid (see [Part-paid checkouts](#part-paid-checkouts)). |
> | `onError(error)` | The checkout could not be loaded: `{ message, status }`. A `404` means it was not found or was cancelled. |
> | `onClose()` | The pop-up closed: the close button, **Done** after paying, the Escape key, or `close()`. |
>
> `MoniratesPay.open()` returns a handle, so you can close the pop-up yourself with `checkout.close()`. Only one checkout can be open at a time.
>
> **`onSuccess` payload**
>
> ```json theme={null}
> {
>   "code": "k7m3qp9xw2hnra",
>   "reference": "ORDER-1042",
>   "amount": "25.00",
>   "amountPaid": "25",
>   "amountReceived": "25",
>   "network": "base",
>   "token": "USDC",
>   "paidAt": "2026-11-23T10:07:41.000Z"
> }
> ```
>
> `code` here is the checkout's `widgetCode`. If the customer sent too much, `amountReceived` is higher than `amountPaid`, and the success screen tells them to contact you about the difference.
>
> > [accordion] Embedding without the script (your own iframe)
> >
> > The script is a thin wrapper around an iframe. If you'd rather build the pop-up yourself, load the checkout page with `?embed=1&origin=<your site's origin>` and listen for messages from it.
> >
> > ```javascript theme={null}
> > const PAY = "https://pay.monirates.com";
> >
> > const src = new URL(`${PAY}/${encodeURIComponent(widgetCode)}`);
> > src.searchParams.set("embed", "1");                      // shows a close button and sends events
> > src.searchParams.set("origin", window.location.origin); // the page only posts messages to this origin
> > // src.searchParams.set("theme", "dark");
> >
> > const iframe = document.createElement("iframe");
> > iframe.src = src;
> > iframe.allow = "clipboard-write"; // for the "copy address" button
> > iframe.style.cssText = "position:fixed;inset:0;width:100%;height:100%;border:0;z-index:2147483647";
> > document.body.append(iframe);
> >
> > window.addEventListener("message", (e) => {
> >   if (e.origin !== PAY || e.source !== iframe.contentWindow) return; // only trust this iframe
> >   const msg = e.data;
> >   if (msg?.source !== "monirates-pay") return;
> >
> >   // msg.type: "ready" | "success" | "error" | "close"
> >   if (msg.type === "success") confirmOnServer(msg.data.reference);
> >   if (msg.type === "close") iframe.remove();
> > });
> > ```
> >
> > | `type` | `data` |
> > | - | - |
> > | `ready` | `{ code, reference, status }`, or `null` if the checkout could not be loaded |
> > | `success` | Same as the `onSuccess` payload above |
> > | `expired` | Same as the `onExpired` payload above |
> > | `error` | `{ message, status }` |
> > | `close` | none: the customer pressed close or **Done** |

> [tab] Hosted page (redirect)
>
> Send the customer to the `hostedUrl` your server returned.
>
> ```javascript theme={null}
> const res = await fetch("/api/orders/1042/pay", { method: "POST" });
> const { hostedUrl } = await res.json();
>
> window.location.href = hostedUrl; // https://pay.monirates.com/k7m3qp9xw2hnra
> ```
>
> If you set a `redirectUrl` when creating the checkout, the success screen shows a **Continue** button that sends the customer back to it, with these query parameters added:
>
> ```text theme={null}
> https://shop.example.com/order-complete?reference=ORDER-1042&code=k7m3qp9xw2hnra&status=PAID
> ```
>
> > [!WARNING]
> >
> > Anyone can type these query parameters into a browser, so they don't prove payment. Use `reference` to find the order, then confirm it on your server (step 4).

**3. The customer pays**

On the checkout page, the customer:

1. Chooses a network and token. Any you fixed when creating the checkout are already set and can't be changed.
2. Clicks to generate a deposit address. The address is unique to this checkout. Once it is generated, the network and token are locked.
3. Sends the exact amount from their wallet or exchange before the checkout expires.

The page checks for the payment every few seconds and shows a success screen when it arrives.

> [!WARNING]
>
> The full amount must arrive before `expiresAt`, including the rest of a part-payment. Money sent after a checkout expires, or after it is already paid, is still moved into your Stable Wallet, but it doesn't count towards the order. It's marked for your review instead (see [Extra and late payments](#extra-and-late-payments)).
>
> The checkout page shows a countdown until the checkout is paid in full. Once it expires, the page tells the customer not to send any more and to contact you with the order's `reference`.

**4. Confirm the payment on your server**

The browser callbacks (`onSuccess`, the redirect back) tell you to **check**. They are not proof of payment. Before you ship anything, confirm the payment on your server in one of these ways.

**Option A: webhook (recommended).** Handle `stable_wallet.checkout_paid`. It arrives even if the customer closes the tab before the success screen. Always [verify the signature](https://docs.monirates.com/getting-started/webhook.md#validating-the-signature) first.

```javascript theme={null}
app.post("/webhooks/monirates", express.json(), async (req, res) => {
  // 1. Verify x-monirates-signature first (see the Webhooks page)
  const { event, data } = req.body;

  if (event === "stable_wallet.checkout_paid") {
    const order = await db.orders.findByReference(data.reference);
    if (order && !order.paid && data._id === order.checkoutId) {
      await db.orders.markPaid(order.id, { txHash: data.txHash, amountPaid: data.amountPaid });
    }
  }

  res.sendStatus(200); // reply quickly; do slow work in the background
});
```

**Option B: fetch the checkout.** Call this after `onSuccess` or the redirect back.

```text theme={null}
GET /v1/stable-currency/checkout/{checkoutId}
```

```javascript theme={null}
const response = await fetch(`${process.env.MONIRATES_API_URL}/stable-currency/checkout/${order.checkoutId}`, {
  headers: { "x-api-key": process.env.MONIRATES_API_KEY },
});
const { data } = await response.json();

if (data.status === "PAID" && data.reference === order.id) {
  await db.orders.markPaid(order.id);
}
```

> [!TIP]
>
> Webhooks can be delivered more than once. Make your handler idempotent: if the order is already marked as paid, do nothing.

***

## Checkout statuses

| Status | Meaning |
| - | - |
| `CREATED` | The checkout exists, but no deposit address has been generated yet. |
| `AWAITING_PAYMENT` | A deposit address was generated and is waiting for funds. |
| `UNDERPAID` | Some funds arrived, but less than `amount`. The customer can send the rest to the same address before `expiresAt`. |
| `PAID` | `amountPaid` equals `amount`. Anything sent on top is in `amountReceived` and reported as an overpayment or extra deposit. |
| `EXPIRED` | `expiresAt` passed before the checkout was paid in full. Check `amountPaid`: `0` means nothing was paid, more than `0` means it was part-paid. |
| `CANCELLED` | The checkout was cancelled. The checkout page treats it as not found. |

```mermaid theme={null}
stateDiagram-v2
    [*] --> CREATED
    CREATED --> AWAITING_PAYMENT: address generated
    CREATED --> EXPIRED: expiresAt passes
    AWAITING_PAYMENT --> PAID: full amount received
    AWAITING_PAYMENT --> UNDERPAID: part received
    UNDERPAID --> PAID: rest received
    AWAITING_PAYMENT --> EXPIRED: expiresAt passes
    UNDERPAID --> EXPIRED: expiresAt passes
```

### Part-paid checkouts

If a checkout expires while `UNDERPAID`, its status becomes `EXPIRED` and `amountPaid` shows how much arrived in time. That money is already in your Stable Wallet. No webhook is sent when a checkout expires, so check for these yourself, for example once a day:

```text theme={null}
GET /v1/stable-currency/checkouts?status=EXPIRED
```

For each result with `amountPaid` above `0`, either refund the customer or complete the order another way (for example, by creating a new checkout for the rest). On the widget, `onExpired` tells you as soon as the customer's page sees it expire.

***

## Extra and late payments

Every supported stablecoin transfer to a checkout address is recorded as a **checkout deposit** and moved into your Stable Wallet, even when it doesn't count towards the order. If it arrives on a network and token pair that isn't [available](https://docs.monirates.com/guides/stable-networks.md#availability), for example on Ethereum, it's recorded and reported but not moved automatically. Contact Monirates support to have it moved. Each deposit has a `classification`:

| Classification | When | Counts towards `amount`? |
| - | - | - |
| `PAYMENT` | Brings the total to exactly `amount` | Yes |
| `UNDERPAYMENT` | The total is still below `amount` | Yes |
| `OVERPAYMENT` | The total goes above `amount`. The checkout becomes `PAID`. | Yes |
| `LATE` | Arrived after the checkout expired or was cancelled | No |
| `EXTRA` | Arrived after the checkout was already paid, on a different network from the checkout's (EVM addresses are the same on every EVM chain), or in a different token | No |

Each deposit also has a `resolution`, which tells you whether it needs your attention:

| Resolution | Meaning |
| - | - |
| `NONE` | Nothing to do. The deposit was a normal payment (`PAYMENT` or `UNDERPAYMENT`). |
| `PENDING_DECISION` | You need to decide what to do with this money (`OVERPAYMENT`, `LATE` or `EXTRA`). |
| `ACKNOWLEDGED` | You've dealt with it and marked it as handled. |

### Resolving a deposit

**1. Find deposits that need a decision**

You get a `stable_wallet.checkout_extra_deposit` webhook for each one. You can also list them at any time:

```text theme={null}
GET /v1/stable-currency/checkout-deposits?resolution=PENDING_DECISION
```

**2. Decide what to do**

The money is already in your Stable Wallet. Depending on the case, you might refund the extra amount to the customer with a [withdrawal](https://docs.monirates.com/guides/stable-wallets.md#withdraw), credit it to their account with you, or keep it. Monirates doesn't refund automatically.

**3. Mark it as handled**

Call the [acknowledge endpoint](#acknowledge-a-deposit) so the deposit moves to `ACKNOWLEDGED` and drops out of your `PENDING_DECISION` list.

***

## Other endpoints

All of these need your `x-api-key` header.

### List checkouts

```text theme={null}
GET /v1/stable-currency/checkouts?page=1&limit=10&status=PAID
```

| Query | Description |
| - | - |
| `page` | Page number, from `1`. |
| `limit` | Results per page, `1` to `100` (default `10`). |
| `status` | Optional filter: `CREATED`, `AWAITING_PAYMENT`, `UNDERPAID`, `PAID`, `EXPIRED`, `CANCELLED`. `EXPIRED` includes every checkout whose `expiresAt` has passed without full payment, and the open statuses only return checkouts that haven't expired. |

```json theme={null}
{
  "success": true,
  "message": "Checkouts fetched successfully",
  "data": {
    "data": [ { "_id": "6a71c2e4b3f9a8d1e2c4f501", "widgetCode": "k7m3qp9xw2hnra", "status": "PAID", "...": "..." } ],
    "pageCount": 1,
    "pageId": 1,
    "limit": 10,
    "totalCount": 1
  }
}
```

### Get a checkout

```text theme={null}
GET /v1/stable-currency/checkout/{checkoutId}
```

Returns one checkout in the same shape as the create response.

### List checkout deposits

```text theme={null}
GET /v1/stable-currency/checkout-deposits?checkoutId=6a71c2e4b3f9a8d1e2c4f501&resolution=PENDING_DECISION
```

| Query | Description |
| - | - |
| `page`, `limit` | Same as above. |
| `checkoutId` | Only deposits for this checkout. |
| `resolution` | `NONE`, `PENDING_DECISION` or `ACKNOWLEDGED`. |

```json theme={null}
{
  "success": true,
  "message": "Checkout deposits fetched successfully",
  "data": {
    "data": [
      {
        "id": "6a71c4a0b3f9a8d1e2c4f5a2",
        "checkoutId": "6a71c2e4b3f9a8d1e2c4f501",
        "userId": "67e5345cdce758f487ab6ca6",
        "network": "base",
        "token": "USDC",
        "address": "0x3f6c2a9d8b1e4c7a5f0d2e9b8c7a6f5e4d3c2b1a",
        "amount": "5.00",
        "from": "0x9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b",
        "txHash": "0x7c1e5f9b2d4a6c8e0f1a3b5d7c9e1f3a5b7d9c1e3f5a7b9d1c3e5f7a9b1d3c5e",
        "blockNumber": "23817465",
        "status": "CONFIRMED",
        "classification": "EXTRA",
        "resolution": "PENDING_DECISION",
        "acknowledgedAt": null,
        "createdAt": "2026-11-23T10:12:05.000Z"
      }
    ],
    "pageCount": 1,
    "pageId": 1,
    "limit": 10,
    "totalCount": 1
  }
}
```

### Get a checkout deposit

```text theme={null}
GET /v1/stable-currency/checkout-deposit/{depositId}
```

### Acknowledge a deposit

```text theme={null}
PATCH /v1/stable-currency/checkout-deposit/{depositId}/acknowledge
```

Marks a `PENDING_DECISION` deposit as handled by moving it to `ACKNOWLEDGED` and recording the time in `acknowledgedAt`. There is no request body. See [Resolving a deposit](#resolving-a-deposit).

| Path parameter | Description |
| - | - |
| `depositId` | The deposit's `id`, from the deposits list (`id` in [List checkout deposits](#list-checkout-deposits)). |

```bash cURL theme={null}
curl -X PATCH https://dev.interface.monirates.com/v1/stable-currency/checkout-deposit/6a71c4a0b3f9a8d1e2c4f5a2/acknowledge \
  -H "x-api-key: MR_v1_xxx"
```

```javascript Node.js theme={null}
await fetch(
  `${process.env.MONIRATES_API_URL}/stable-currency/checkout-deposit/${depositId}/acknowledge`,
  { method: "PATCH", headers: { "x-api-key": process.env.MONIRATES_API_KEY } },
);
```

**Response**

```json theme={null}
{
  "success": true,
  "message": "Checkout deposit acknowledged successfully",
  "data": {
    "id": "6a71c4a0b3f9a8d1e2c4f5a2",
    "checkoutId": "6a71c2e4b3f9a8d1e2c4f501",
    "userId": "67e5345cdce758f487ab6ca6",
    "network": "base",
    "token": "USDC",
    "address": "0x3f6c2a9d8b1e4c7a5f0d2e9b8c7a6f5e4d3c2b1a",
    "amount": "5.00",
    "from": "0x9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b",
    "txHash": "0x7c1e5f9b2d4a6c8e0f1a3b5d7c9e1f3a5b7d9c1e3f5a7b9d1c3e5f7a9b1d3c5e",
    "blockNumber": "23817465",
    "status": "CONFIRMED",
    "classification": "EXTRA",
    "resolution": "ACKNOWLEDGED",
    "acknowledgedAt": "2026-11-23T14:30:12.000Z",
    "createdAt": "2026-11-23T10:12:05.000Z"
  }
}
```

Returns `404` if the deposit doesn't exist, belongs to another account, or isn't `PENDING_DECISION` (for example, it was already acknowledged, or it was a normal payment with resolution `NONE`).

***

## Webhooks

Checkout events use the same envelope and `x-monirates-signature` header as every other Monirates webhook. See [Webhooks](https://docs.monirates.com/getting-started/webhook.md) for setup and signature checks.

| Event | When |
| - | - |
| `stable_wallet.checkout_created` | A checkout was created. |
| `stable_wallet.checkout_paid` | The checkout became `PAID`. **Fulfil the order on this one.** |
| `stable_wallet.checkout_underpaid` | A deposit arrived, but the total is still below `amount`. |
| `stable_wallet.checkout_extra_deposit` | An overpayment, late or extra deposit needs your decision. |

Sample payloads are on the [Webhooks page](https://docs.monirates.com/getting-started/webhook.md#event-types--sample-payloads).

***

## Testing in sandbox

1. Create a Stable Wallet on sandbox ([dev.business.monirates.com](https://dev.business.monirates.com)) and get a sandbox API key.
2. Create checkouts against `https://dev.interface.monirates.com/v1` and load the widget from `https://dev.pay.monirates.com/inline.js`.
3. Pay with testnet funds, using a pair that is [available in sandbox](https://docs.monirates.com/guides/stable-networks.md#availability).

***

## Checklist

* Create checkouts on your **server**. Keep your API key out of the browser.
* Take the amount from your own order records.
* Use your order ID as `reference`, so a retried request returns the same checkout.
* Save the checkout `_id` against the order.
* Fulfil orders on the `stable_wallet.checkout_paid` webhook (or a server-side fetch), not on `onSuccess` or the redirect alone.
* Verify webhook signatures, and make your handler idempotent.
* Fulfil on `amountPaid`, not `amountReceived`.
* Watch for `stable_wallet.checkout_extra_deposit`, and acknowledge deposits once you have handled them.
* Check `?status=EXPIRED` regularly for part-paid checkouts (`amountPaid` above `0`) and refund or follow up.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.