Skip to main content
This walkthrough pays one bill in the sandbox. No real money moves. You need:
  • A sandbox key (cleo_test_...) with the scopes contacts:read, payables:read, payables:write, payments:initiate and payments:read.
  • A verified sandbox business with at least one active vendor contact.
1

Check that the business can pay

Look at setupStage, paymentsLocked and the rails array. If setupStage is not READY, or no rail has canSend: true, send your user to dashboardUrl to finish setup. This call works with any valid key, even before verification.
2

Pick the vendor

Note the contact’s id. Check paymentReadiness: it says whether each rail can reach the vendor’s bank right now.
3

Create the bill and submit it

submit: true sends the bill into the business’s approval flow. Without it, the bill is a draft that you can submit later with POST /v1/payables/{payableId}/submit. If the business’s rules need a person to approve, approve the bill in the Cleo web app before you pay it.
4

Choose what to pay from

Each item has a rail, a kind, canPay, and a pay object. Pick an item with canPay: true and copy its pay fields into the payment.
5

Pay the bill

This example pays from the Cleo Pay balance:
To pay from a Dwolla bank, send "paymentRail": "DWOLLA" and that bank’s bankAccountId instead. Idempotency-Key is required on this call. If the request times out, send it again with the same key and the same body: you get the first answer, and the bill is not paid twice.
6

Follow the payment

A payment moves through pending or processing to completed. It can also end held, failed, returned, cancelled, refund_pending or refunded. To get told instead of polling, register a webhook endpoint for payment.* events.

If a call is refused

Every refusal has a machine-readable code. The ones you are most likely to see here: See Errors for the full list.

Next steps