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: Pick the method before you create
payment_method sets the fee and cannot be changed afterwards.
In Uganda, ask which network the buyer uses, or infer it from the number,
before you create the payment.
Step 2: Create
Get a token first:201 answer carries data.order with id, total, currency,
status: "cart" and hold_expires_at. Save id with your purchase.
Next: pay.
Step 3: Pay
Send a newIdempotency-Key (not the create key) and the number:
0763494235 is the example number in these docs; use the payer’s own. In
Uganda a local number (07…) is accepted. Everywhere else, send the country
code (+254…, +233…, +250…, +260…). The number must be from the
payment’s country (payer_country, else your organization’s), or the answer is
400 invalid_msisdn.
Response 200: the prompt was sent
Response 200: nothing was sent, safe to try again
200 does not mean paid. It means the request was handled: look at
payment_status.
Step 4: Wait
Tell the buyer “Check your phone and enter your PIN”, and count down toprompt_expires_at. When it passes the payment has not failed: keep
waiting. Learn the result from the order.paid or order.failed
webhook. To poll as well (scope orders:read):
laces.js
wait.js
GET /orders/Pm4xT9cL while the prompt is out
Step 5: When it fails
GET /orders/Pm4xT9cL after a failure
One rule while a payment is live
While the order ispayment_initiated or prompt_sent, don’t call pay, not
even with another number, and don’t create another payment. It ends as paid,
failed or expired, usually in minutes and within about 2 hours.
Laces blocks only part of this: any new prompt on the order for 2 minutes
(409 prompt_in_progress), and the same number on it for 10 minutes
(409 charge_pending_same_number). After that, or on another order, a second
prompt can go out while the first can still be approved. If a buyer is debited
twice on one order you get no second webhook: send
support@laces.run the order id.
Try again
Lock per purchase while you read, pay or create, so a double click or two servers can’t start two payments. Only when the buyer asks. Never in the background, whatever the answer was: once the wait is over, the same request, even with the same key, sends a new prompt. Read every order of the purchase first; any other status means stop and let a person look:
Inside 15 minutes, these answers also mean a new payment. The call charged
nothing:
There is no route that changes or cancels a payment. Keep the old order id:
a late approval can still pay it, and two paid orders for one
partner_reference means one refund. Code: retryPayment in the
guide.
429 payer_prompt_limit: the number has had 3 prompts in an hour, or 10 in 24
hours, across all Laces orders. Nothing was sent. If no prompt is live, the
buyer can use another number, or wait Retry-After seconds.
retry_safe is only on the pay answer, not on reads or webhooks: false means
read the order before you offer a retry. The read is what decides.
No answer from pay? The call may still be running, and the order can still
read cart, or the failed or expired of an earlier try. Wait 3 minutes
before you believe it; until then only the same key is safe (it answers
idempotency_in_progress or the first result).
Idempotency, in one line
No answer (timeout, network error,5xx): read the order
first. Anything that changed: new
key. The pay key is tied to the order and the number.
Full list of codes: Errors.