v3

Create a hosted checkout

Prices the trade and returns a link the customer completes on our pages. Where POST /api/v3/orders takes a quote you already hold, this is the whole flow in one call. Called for a known customer (a `User-Identifier` or user token), it creates the order at once. Called without one, the customer signs in or registers on the page and the order is created when they confirm there; the trade is held as you specified it (lock it with `fixed`), and only refusals that hold for every customer, such as an amount below the minimum or a disabled currency, are answered now.

POST/api/v3/checkouts

Send your own credential. Add the customer's to create the order at once; without it they sign in on our page.

How authentication works
Yours
x-api-keyorAuthorization: Bearer
The customer's (optional)
User-Authorization: BearerorUser-Identifier

Prices the trade and returns a link the customer finishes on our pages. Where create an order takes a quote you already hold, this is the whole flow in one call, which is why a Unified Checkout integration is mostly this endpoint plus a webhook.

Only three fields are required: the two currencies and the payment method. The direction follows from the currencies, and the amount can be left out entirely if you want the customer to choose it on our page.

With or without a customer

Send the customer's credential (a User-Identifier or their session) and the order is created at once, for that customer.

Leave it out and nobody owns an order yet. The link then carries the trade you specified, and the customer signs in or registers on our page, verifies, picks where the value goes and confirms there. The order exists from that moment and carries your partnerOrderIdentifier, so the webhooks about it are matched to your record exactly as they would be otherwise. Lock what the customer may not change with fixed. Only refusals that hold for every customer, such as an amount below the minimum or a disabled currency, are answered by this call; everything about who the customer is gets decided when they confirm.

On a sell where you do not name the customer, you cannot name a payout account: their accounts do not exist for you before they sign in, so they choose one on the page.

What comes back

url
Where to send the customer. Redirect, do not embed it.
orderId
The uuid to store against your own record and to read back later. Only when you name the customer in the call (a User-Identifier or their token): otherwise there is no order yet.
displayId
The short id a human reads out to support. Show this one; key on orderId. Only when you name the customer in the call.
offerId
Only when you do not name the customer: the trade the link carries until they confirm it. The order created from it reaches you through webhooks, matched by partnerOrderIdentifier.
partnerOrderIdentifier
Your own reference, echoed back. Send one and every webhook about this order carries it. When you do not name the customer it is how you recognise the order at all.

The return URL is not a result

A customer can close the tab before we redirect them, and a payment can settle minutes after they leave. What happened to the order comes from the webhook. See webhooks.

Returning to your app

returnUrl can be your app's own link (yourapp://…) instead of a web address, once that scheme is enabled for your account. Ask your account manager. The page then sends the customer back into your app rather than to a website, and on a sell whose coins your app sends, the deposit screen leads with a button back into it. See sell from your own app.

Language

Environment

Credentials

Your credential

The customer's credential

Choose an environment first.

cURL request
curl -X POST https://api.btcdirect.eu/api/v3/checkouts \  -H "x-api-key: $BTCD_API_KEY" \  -H "User-Authorization: Bearer $BTCD_USER_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "sourceCurrency": "swift:0/iso4217:EUR",    "targetCurrency": "bip122:000000000019d6689c085ae165831e93/slip44:0",    "sourceAmount": "100.00",    "paymentMethod": "ideal",    "returnUrl": "https://your.app/checkout/return",    "partnerOrderIdentifier": "your-ref-8842",    "fixed": {      "amount": true,      "currency": true    }  }'
Choose an environment to run this.

Response

The checkout.
{  "url": "https://checkout.btcdirect.eu/c/9RVQ2M7KX0",  "orderId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",  "displayId": "K7M4RPQ2",  "offerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",  "direction": "buy",  "partnerOrderIdentifier": "your-ref-8842"}

Request

sourceCurrencystringrequired

Exampleswift:0/iso4217:EUR

targetCurrencystringrequired

Examplebip122:000000000019d6689c085ae165831e93/slip44:0

sourceAmountstring

Example100.00

targetAmountstring

Example0.00126555

paymentMethodstringrequired

Exampleideal

destinationobject

Where the value the customer receives goes. Which kinds are valid follows from the trade's direction.

returnUrlstring

Where the customer goes when they are done: an absolute http(s) URL, or your app's own link when its scheme is enabled for you.

Examplehttps://your.app/checkout/return

partnerOrderIdentifierstring

Your own reference for the trade. It comes back on the order and on every webhook about it, which is how you match an order created on the checkout to your own records.

Exampleyour-ref-8842

fixedobject

Pins parts of the trade so the customer cannot change them on the page.

showWalletAddressboolean

localestring

The language the hosted checkout page renders in — a language subtag with an optional region, e.g. `nl` or `nl-NL`. Casing is ignored and the region is discarded: it selects no content, so `de-AT` and `de-DE` render the same German. Supported languages are `nl`, `en`, `de`, `fr` and `es`; anything else is refused rather than quietly served in English, because a link minted for a language we do not ship would 404 for the customer. Omitted means English.

Examplenl-NL

expiresIninteger

How long the returned `url` stays valid, in seconds. Between 300 (5 minutes) and 604800 (7 days); omitted means 3600 (1 hour). Refused rather than clamped if it is outside that range. Note that the order behind the link is priced when it is created, so a long window means a customer can open a link quoting an older rate. Applies to a checkout for a known customer; one created without a customer is priced when the customer confirms.

identifierstring

Your own identifier for this customer, registered as part of creating the checkout so you do not need the separate POST /api/v3/users/identifiers call. Needs a partner access token: an api-key call that sets one is refused 403 `server_credential_required`. The User-Identifier header may name the same customer; both at once must be equal (400 `identifier_mismatch`). Already linked, the returned `url` signs that customer in on the page (a one-time login, 15 minutes, single use); not yet linked, the customer registers (which links it) or signs in and is asked once to connect. The `url` never carries this value, only an opaque handle: use it exactly as returned.

Exampleyour-customer-8842

ipv4string

Locks the link to the customer's IPv4 address: a bare address (exact match) or a CIDR range. The first time the customer opens the link their IP is checked against it and the outcome (`match`, `mismatch` or `no-lock-for-family`, and for a mismatch how far off it was) is recorded on the order for your chargeback analysis. It is recorded, never enforced: a customer on a different address is not turned away. Refused with 400 if it is not an IPv4 address or range.

Example203.0.113.0/24

ipv6string

Locks the link to the customer's IPv6 address: a bare address or a CIDR range, compared on the /64 so a rotating privacy address inside one network still matches. Recorded the same way as `ipv4`, never enforced. Refused with 400 if it is not an IPv6 address or range.

Example2001:db8:1:2::/64

Responses

201The checkout.
400Unknown currency, untradeable pair, unknown payment method, or a missing amount. Also answered, with code `quote_unconfirmable`, when the trade cannot be confirmed for this customer: the same refusal `POST /api/v3/quotes` reports as `unconfirmableReasons`, such as a customer who has not completed verification, a limit, or no customer at all. No order is created.
403The Business-Identifier header names a business the customer does not represent. A quote for a business is checked against that business's limits, so the customer must represent it.
503`trading_paused` — an operator has paused this side of trading for this partner, coin or payment method. Nothing is wrong with the request and no order or checkout was created; the same request is accepted once trading reopens (`reopensAt`, when the pause has an end). Told apart from any other 503 by `code`. Or `maintenance`: full maintenance is on, and every endpoint refuses every request until it ends (`endsAt`, when it has an end).

Body of the success response

urlstringrequired

Send the customer here to complete the trade.

Examplehttps://checkout.btcdirect.eu/c/9RVQ2M7KX0

orderIduuid

Set when the checkout was created for a known customer.

Example3fa85f64-5717-4562-b3fc-2c963f66afa6

displayIdstring

Set when the checkout was created for a known customer.

ExampleK7M4RPQ2

offerIduuid

Set when the checkout was created without a customer: the trade the customer completes after signing in.

Example3fa85f64-5717-4562-b3fc-2c963f66afa6

directionstringrequired

Can be one ofbuysell

partnerOrderIdentifierstring

Exampleyour-ref-8842

Every failure answers with a message and a code. Switch on the code — messages are written for people and can change.