Every request on this page goes to
https://connect.laces.run/v1, from
your server, with Authorization: Bearer <token>. Laces must first turn
on payments for your organization, and your API key needs payments:write,
orders:write and orders:read. Never send an
organization id: Laces takes the organization from the token. The client
secret stays on your server, never in a browser or an LLM chat. There is
no sandbox: a pay request moves real money.Step 1: Check card is available
Get a token, then quote:Response 200
payment_methods lists card. Show
data.card.total_minor. Card follows the country: today Uganda, Kenya, Ghana,
Rwanda and US, GB and EU organizations, not Zambia. Trust the quote, not this
list. Otherwise create answers 400 rail_unavailable.
Step 2: Create with payment_method: "card"
Response 201
Step 3: Pay, with no number
Response 200
Idempotency-Key is required but not used up, so
calling again is safe. Note that the answer has no payment_status and no
failure_kind.
Step 4: Redirect the buyer
Send their browser tonext_action.redirect_url (303 redirect or a link).
Use the URL as given; don’t build it. The page shows your organization’s name,
the description, the amount, the fee and the total. Where the card network
can’t take your currency (UGX, for example), it shows the amount in USD before
they pay. Your order stays in its own currency. The page can carry your color
and logo: set them on the key (Branding).
Step 5: The buyer comes back
- A payment’s own URL wins. Without one, the key’s saved
default_success_urlordefault_failure_urlis used. With neither, the buyer sees a short Laces result page and stays there. httpsonly (a registeredhttp://localhost:<port>also works for URLs you send in a request, not for saved defaults). The origin must be in the key’s Return URL domains. At most 2048 characters with the order id and status added. Otherwise400 invalid_return_url.- They are checked again when used. If you remove a domain from the key, or revoke the key, the buyer is not sent there.
laces_statuscan bepaid,cart(they left without paying),failed,expiredorcancelled. None of them is final:failedandexpiredcan still becomepaid. Trust the webhook or an order read.
- Using a
#fragment (single-page apps)? Use{LACES_STATUS}and{LACES_ORDER_ID}inside it. Otherwise the values go in the query, before the#. A fragment that already giveslaces_statusorlaces_order_ida different value is dropped whole. - The query string is re-written when values are added:
%20can become+, and anylaces_order_idorlaces_statusyou put there is replaced. Read parameters by name; don’t sign or compare the raw query string. - Your own
order_idorstatusparameters are left alone.
thanks.js
fulfilled and still shows “thanks”; a second order for it shows
“thanks” too, and your handler has sent the duplicate to review.
If the buyer does not come back
They may have closed the tab. A paid payment still sendsorder.paid. An
abandoned one sends nothing: an untouched cart becomes expired 15 to 20
minutes after creation.
If the buyer wants to try again
Wants mobile money instead?
retryPayment with the new method
(guide) creates a new payment. No route cancels a card
order, and a card page left open can still be paid, so replace one only when
the buyer has come back to you, keep the old order id, and ask for one to be
refunded if both are paid.
If the total changes
On the Laces page a buyer may be able to change how they pay, which changes the fee andtotal. Compare requested_amount and requested_currency with
your price, never total.
A changed method can also start a mobile money prompt for this order, so a
“card” order can be prompt_sent. Treat it like any live payment: wait.
Codes: Errors.