Skip to main content

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, and sends you a webhook. See Supported Networks & Tokens 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.
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.
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.

How it works

  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
Headers
Request body
Response
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.
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.
OptionsMoniratesPay.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
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.
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.
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.
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).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 first.
Option B: fetch the checkout. Call this after onSuccess or the redirect back.
Webhooks can be delivered more than once. Make your handler idempotent: if the order is already marked as paid, do nothing.

Checkout statuses

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:
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, 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: Each deposit also has a resolution, which tells you whether it needs your attention:

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:
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, credit it to their account with you, or keep it. Monirates doesn’t refund automatically.
3

Mark it as handled

Call the acknowledge endpoint 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

Get a checkout

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

List checkout deposits

Get a checkout deposit

Acknowledge a deposit

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.
Response
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 for setup and signature checks. Sample payloads are on the Webhooks page.

Testing in sandbox

  1. Create a Stable Wallet on sandbox (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.

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.