SET Crypto API Suite · Cash out to a bank
Reserve an order's payable amount on a Cash-Out Address (a platform account)
POST/v1/payment_references
Reserves an order's payable amount on one of your customers' Cash-Out Addresses. The answer's payableAmount is the order amount plus a tag under one cent, unique among the address's open references; a payment of exactly that amount settles the reference. A payer, when given, is sent as the settling payment's sender for the Travel Rule.
Headers
Idempotency-Keystring- Any unique string, so a retry runs once. See Idempotency.
Body
cashOutAddressstringrequired- The id of one of your customers' Cash-Out Addresses (otherwise 404
cash_out_address_unknown). A retired address answers 409cash_out_address_retired. Conversion Addresses are not taken. amountstringrequired- The order total, at most 9 integer digits and 2 decimals, for example
"1250.00"; at least the Cash-Out minimum (400amount_too_small). currencystring- The stablecoin the payer sends. On an ordinary address it is the address's own currency (
usdcby default, oreurc), and naming another answers 400currency_invalid. On a currency "any" address it is required (400currency_required) and must be one the address takes; only a payment in it settles the reference. expiresAtstringrequired- An ISO 8601 date-time after now and at most 30 days ahead (otherwise 400
expires_at_invalid). payerobject- The payer, in the sender shape:
type("business"or"individual"),name, and anaddresswithstreetLine1,streetLine2,city,state,postalCodeand an ISO 3166-1 alpha-3country(for exampleUSA). It is stored sealed and never shown back. metadataobject- Your own key-value pairs, returned on the reference.
Notes
- Needs a key with the
writescope. - Payment references are for platform accounts: a business (merchant) account's key gets 403
payment_references_platform_only. - A restricted business or customer is refused.
- Storing a payer needs a deployment that can seal it; otherwise 503
payment_reference_payer_unavailable: leavepayerout and name each payment's sender. - The payer must send exactly
payableAmount: the order amount plus a tag in decimals 3 to 6, so the payer must be able to send 6-decimal amounts. - In the answer
payeris a boolean:truemeans a payer is stored and will be sent as the payment's Travel Rule sender. idandreferenceare the same value.- Event
payment_reference.createdis written. - Without a payer, the reference settles only a payment whose sender is already named; otherwise the payment waits to be matched by hand with
POST /v1/payment_references/{id}/match. - The reference names no chain: it is on whatever chain its Cash-Out Address is on.
- The example was made with a sandbox key.
- This example is a recorded run of SET's own code (wallet release
e9b03447) with a sandbox key; ids and times are that run's.
Errors
403 payment_references_platform_only400 conversion_address_not_supported404 cash_out_address_unknown409 cash_out_address_retired404 customer_unknown403 restricted400 currency_invalid400 currency_required400 amount_invalid400 amount_too_small400 expires_at_invalid400 sender_type_invalid400 sender_invalid503 payment_reference_payer_unavailable409 payable_amount_exhausted