Skip to content

Create a sell order

Request

Allows your customer to create a sell crypto order with Banxa. Upon success, the response will contain a checkout URL which will be unique for the order. The customer will be redirected to this URL to complete the checkout process, which will expire after 1 minute if a redirect does not occur. How the customer sends the crypto (the fulfilment flow) is configured on your partner account by Banxa. See Custodial vs. non-custodial.

Path
partnerstringrequired

This is the partner code provided to you during onboarding. e.g. metamask.

Headers
Acceptstring
Default:"application/json"
x-api-keystring

This is the API Key that has been provided to you during onboarding.

Example:YOUR_API_KEY
Bodyapplication/json
Any of:
paymentMethodIdstring

The payout method. Sell payout method IDs are listed in Supported Payment Methods, e.g. payid-bank-transfer for AUD (BSB and account number) or sepa-bank-transfer for EUR. If omitted, the customer chooses in checkout.

cryptostringrequired

This is the crypto type the customer wants to sell.

blockchainstring

The blockchain (network) the customer will deposit the crypto on, e.g. ETH or TRON. If omitted, Banxa uses its default network for the coin.

fiatstringrequired

This is the fiat type the customer wants to receive.

fiatAmountstring

The amount of fiat the customer wants to receive. Either fiatAmount OR cryptoAmount must be provided. If both are provided, then cryptoAmount will be used.

cryptoAmountstring

The amount of crypto the user wants to sell. Either fiatAmount OR cryptoAmount must be provided. If both are provided, then cryptoAmount will be used.

walletAddressstring

The customer’s sending wallet: the address the customer will send the crypto from. Banxa screens this address and uses it as the refund address if a refund is necessary. Required for custodial flows, where it must match sourceAddress on POST /{partner}/v2/orders/{orderId}/confirm. Recommended for all sell orders.

walletAddressTagstring

Memo or tag of the customer’s sending wallet, on chains that use one (e.g. memo for XLM, destination tag for XRP).

redirectUrlstringrequired

The URL the user will be redirected to after the sell flow has been completed. If the case of an order failure or cancellation, then the returnUrl will be appended with the status e.g. /?status=failure, /?status=cancel Accepts a URL or a deep link. If your account uses the Native Wallet sell flow, Banxa also redirects the customer here with the deposit details as query parameters.

subPartnerIdstring

Your defined ID for associating an order with. e.g. you may use this to differentiate between channels such as Exchange, Wallet, Web, Mobile.

metadatastring

Free form string that you can use to send us any information that will be returned in the Get Orders endpoint

externalCustomerIdstring

Unique customer reference provided by you. Recommended on every order: used to check whether the customer has completed KYC and to recognise returning customers.

externalOrderIdstring

An order ID that you may define and will be returned to you in a Get Order call.

emailstring

Customer email address.

phoneNumberstring

Customer phone number.

discountCodestring

Discount code to apply to the order.

ipBindingArray of objects, [ 1 .. 2 ] items

IP binding. The customer's IP address, taken from the customer's own request that started the order. One or two items, at most one per IP family. Required when Banxa has turned on IP binding for your account, unless you send ipBindingOmitted.

ipBindingOmittedstring

Sent instead of ipBinding when the customer uses iCloud Private Relay. Never sent together with ipBinding.

Value:"private_relay"
originalUrlstring, (uri)

The http or https URL of the page the customer was on. Stored with the order. URLs longer than 2,048 characters are cut, not rejected.

Example:"https://yourapp.com/buy"
curl -i -X POST \
  'https://docs.banxa.com/_mock/products/hosted-checkout/openapi/{partner}/v2/sell' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
    "crypto": "ETH",
    "blockchain": "ETH",
    "fiat": "AUD",
    "cryptoAmount": "0.5",
    "walletAddress": "0xcbf80ee36fbf03307962576f338fc50b942e0591",
    "redirectUrl": "https://yourapp.com/order-complete",
    "paymentMethodId": "payid-bank-transfer",
    "externalCustomerId": "user_12345"
  }'

Responses

Order created.

Bodyapplication/json
checkoutUrlstring

Checkout URL to redirect the customer to. Expires after 1 minute if a redirect does not occur.

Example:"https://partner.banxa.com/portal?expires=xxx&oid=xxx&signature=xxx"
idstring

Banxa order ID.

Example:"191fa5b4b1f45e1cf784422e09317d56"
externalOrderIdstring or null

The externalOrderId from the request. null if not provided.

Example:"a4b427ccb872a1744b317456bd0d165f"
externalCustomerIdstring
Example:"awasdf-fg34fg-34hhsdf"
fiatstring
Example:"CAD"
fiatAmountstring
Example:"1000.00"
cryptostring
Example:"USDC"
cryptoAmountstring or null

null if not provided in the request.

Example:"696.63"
blockchainstring
Example:"TRON"
Response
{ "checkoutUrl": "https://partner.banxa.com/portal?expires=xxx&oid=xxx&signature=xxx", "id": "191fa5b4b1f45e1cf784422e09317d56", "externalOrderId": "a4b427ccb872a1744b317456bd0d165f", "externalCustomerId": "awasdf-fg34fg-34hhsdf", "fiat": "CAD", "fiatAmount": "1000.00", "crypto": "USDC", "cryptoAmount": null, "blockchain": "TRON" }