POST /orders and a
Laces event, and runs its own registration form. After the move, Laces only
collects.
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.What changes, and what stays
Nothing is migrated. Old orders, refunds and earnings stay on the Laces
event. New ones are payments. Both count in the same organization balance.
Step 1: Make the webhook handler accept both, and deploy it
Do this first: the moment payments are turned on, your endpoints andorders:read keys can see payment orders. In this order:
- Pause your deadline job (the one that gives places back).
- Add
fulfilled,undoneandreleasedto registrations, and run the backfill: the confirmed ones, then those whose places the old code gave back. - Deploy the handler below. Keep the delivery ids you have saved, so an event the old code handled is skipped.
- Run the backfill again, for what the old code confirmed in between.
- Restart the deadline job, as
releaseIfOver. Then step 2.
event_id (at the top or on the order), no
ticket_count and no registrations. Ticket orders have no
order_type, requested_amount or requested_currency: keep your own check
on total for those.
Add this above your existing ticket code:
ticketPaid is in cutover.js, in step 4. In
webhook.js the ticket part is the body of handleTicketOrder.
Skip events of another key only for payments: a ticket order can carry
another client id, or null, and is still yours if you saved its id. Make sure your ticket code ignores anything it
doesn’t know.
fulfilIfPaid reads the order, requires status: "paid" now, and compares
reference, amount and currency. refundPayment undoes once the price is back.
Both, and the whole handler, are on
Webhooks. refundPayment
takes ticket orders too.
Backfill
For every registration your old code confirmed, with the ticket order that confirmed it. Without it your deadline job could give a confirmed registration’s places back, and a payment could be fulfilled on top of it without “paid twice”. Safe to run again.backfill.js
Step 2: Switch it on
- Ask support@laces.run to turn payments on for your organization.
- An owner or admin adds
payments:writeandorders:readto your API key, and your site to its Return URL domains. - Get a new token, clear any cached one, and check its
scope.
Step 3: Quote instead of reading the event
Response 200
amount is the item price for everything in this payment, before the fee.
If your page shows all-in prices that already contain the Laces fee, take the
fee out, or the buyer pays it twice. Part of the fee is per payment, so quote
the whole sum, and quote again for each method.
Step 4: Create a payment instead of an order
Before:POST /v1/orders
Authorization, Idempotency-Key, Content-Type):
POST /v1/payments
Response 201
retryPayment and pay read
its ticket orders (db.ticketOrdersOf, { orderId, unansweredAt? }) every time
and stop if one is paid or could be. Stop calling pay on ticket orders from now
on.
cutover.js
failed or expired ticket order at any
time, even on a closed event, also just after pay read it. Nothing cancels it:
that is what the shared
fulfil and the review are for. Ask the buyer to close it.
A retry with the same key answers 200 with the same data and the message
“Payment already created (idempotent replay)”. In the answer, registrations,
event_name, event_when_label and poster_theme are gone, and
order.event_id is replaced by order.order_type.
Step 5: Pay, unchanged
0763494235 is the example number in these docs; use the payer’s own.)
Response 200: prompt sent, wait
Response 200: nothing sent, safe to try again
payment_method: "card" and pay with {}:
POST /v1/payments
Response 201
POST /v1/orders/Wn2dG6jR/pay answers 200: redirect the buyer
on_success_url
or on_failure_url with laces_order_id and laces_status added. That is
not proof of payment.
Step 6: Handle every outcome
Webhook: order.paid (fulfil once)
Webhook: order.failed (once per order; the buyer may retry, release nothing yet)
Webhook: order.refunded (the price only)
GET /v1/orders/Zs5kF8nA: paid
GET /v1/orders/Zs5kF8nA: failed
GET /v1/orders/Zs5kF8nA: expired (no webhook if the buyer walked away)
Create or quote before Laces turns payments on: 403
Pay: too many prompts to one number: 429
Step 7: Close sales on the Laces event
When new payments arrive, close the event in the Laces app so nobody can still buy there. Do not delete it: its orders, refunds and history hang off it. Closing stops new orders; an order created before it can still be paid, so keep handling both kinds. Checkout sessions already open can’t start new orders on a closed event. Selling on both at once? Don’t: Laces counts only its own places. If you must, split the places between the two.Rolling back
Point your server atPOST /orders again and reopen the event. Payments
already created can still be paid, and stay as payments: before you create a
ticket order, read the registration’s payments, as look does, and go on only if
none is paid or could be. Keep the handler for both kinds.
Checklist
- Laces has turned payments on for the organization
-
payments:write,orders:writeandorders:readare on the key, and the token is new - The site is in Return URL domains
- In this order, before payments are turned on: deadline job paused, backfill, webhook handler deployed, backfill again, deadline job restarted
- Every registration whose places were already given back has
releasedset before the job restarts - A ticket order of another API key is matched by order id only, never by reference
- The webhook handler works without
event_idandregistrations, accepts both kinds of order, and both fulfil and undo through the shared code - A ticket order that can’t be matched, or has another total, goes to review
- A registration’s ticket orders are read before a payment is created and before pay, and two paid orders for one registration are flagged
- Prices come from the quote;
amounthas no fee in it - One payment per registration,
amountis the sum,productnever changes for this event -
partner_referenceis always sent;metadataholds an id, no attendee or child data - The consent, attendee list, tickets and check-in are on your side
- Places are reserved before the payment and released by you
- Fulfilment only when a server read says
paidnow, once -
requested_amountandrequested_currencyare compared with your price (payments only) - No fixed fee or rate is left in your code
- The old event is closed, not deleted
- One small real payment was made by a person, and refunded if wanted