Skip to content
Last updated

Create Buy Order

For the complete documentation index, see llms.txt. Append .md to any page URL for its markdown version.

Create an on-ramp order (fiat → crypto) for a customer. Returns a checkoutUrl to redirect or embed so the customer can complete their payment.


Endpoint

POST /{partnerRef}/v2/buy

Request body

FieldTypeRequiredDescription
cryptostringYesCryptocurrency code (e.g., ETH, BTC, USDT).
fiatstringYesFiat currency code (e.g., AUD, USD, EUR).
walletAddressstringYesCustomer's receiving wallet address: where Banxa sends the crypto.
redirectUrlstringYesURL to redirect the customer to after checkout completes or is cancelled.
paymentMethodIdstringNoPre-selects a payment method. If omitted, the customer chooses in checkout. See supported values below.
fiatAmountstringConditionalFiat amount to spend. Either fiatAmount or cryptoAmount must be provided.
cryptoAmountstringConditionalCrypto amount to receive. Either fiatAmount or cryptoAmount must be provided.
blockchainstringNoBlockchain network (e.g., ETH, BNB). Required for multi-chain assets.
externalCustomerIdstringRecommendedYour stable identifier for this customer. Enables returning customer recognition and reduces repeat KYC. See best practices.
emailstringNoCustomer's email address. Pre-populates the email field in checkout.
externalOrderIdstringNoYour own order reference to attach to this transaction. Banxa stores it and returns it in order responses and webhooks for reconciliation.
walletAddressTagstringNoMemo or tag of the customer's receiving wallet, on chains that use one (e.g., memo for XLM, destination tag for XRP). Required when the destination wallet requires a tag.
discountCodestringNoDiscount code to apply to the order.
subPartnerIdstringNoIdentifier for a sub-partner or segment within your account (e.g., different sites or resellers).
metadatastringNoAdditional free-form data to attach to the order. Returned as-is in order responses and webhooks.
ipBindingarrayConditionalThe customer's IP address, so Banxa can check that checkout is opened from the same network. One item per IP version (v4, v6), at most two. Required once Banxa turns on IP binding for your account, unless you send ipBindingOmitted. See IP Binding.
ipBinding[].methodstringYeshash (the exact address, hashed) or range (the network the address is in).
ipBinding[].familystringYesv4 or v6.
ipBinding[].valuestringYesFor hash: 64 hexadecimal characters. See Hashing the IP address. For range: an IPv4 /24 or IPv6 /64 network with the host part set to zero, such as 203.0.113.0/24 or 2001:db8:1234:5678::/64.
ipBindingOmittedstringConditionalSend private_relay instead of ipBinding when the customer uses iCloud Private Relay. No other value is accepted. Never send both.
originalUrlstringNoThe http or https URL of the page the customer started the order on. Banxa stores it with the order. Longer than 2,048 characters is shortened, not rejected.

Payment method IDs

debit-credit-card · apple-pay · sepa-bank-transfer · gbp-bank-transfer · payid-bank-transfer · upi · paypal


Example requests

Debit/credit card

curl -X POST "https://api.banxa-sandbox.com/{partnerRef}/v2/buy" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "crypto": "ETH",
    "fiat": "AUD",
    "fiatAmount": "200",
    "walletAddress": "0xe3BDEFdAeFF070925eB7FfC49F9B30c647Cb751e",
    "redirectUrl": "https://yourapp.com/order-complete",
    "paymentMethodId": "debit-credit-card",
    "externalCustomerId": "user_12345",
    "email": "[email protected]"
  }'

Apple Pay

curl -X POST "https://api.banxa-sandbox.com/{partnerRef}/v2/buy" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "crypto": "ETH",
    "fiat": "AUD",
    "fiatAmount": "300",
    "walletAddress": "0xe3BDEFdAeFF070925eB7FfC49F9B30c647Cb751e",
    "redirectUrl": "https://yourapp.com/order-complete",
    "paymentMethodId": "apple-pay",
    "externalCustomerId": "user_12345"
  }'

With IP binding

curl -X POST "https://api.banxa-sandbox.com/{partnerRef}/v2/buy" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "crypto": "ETH",
    "fiat": "AUD",
    "fiatAmount": "200",
    "walletAddress": "0xe3BDEFdAeFF070925eB7FfC49F9B30c647Cb751e",
    "redirectUrl": "https://yourapp.com/order-complete",
    "externalCustomerId": "user_12345",
    "ipBinding": [
      { "method": "hash", "family": "v4", "value": "31e085138870946bf3e30b6e6709089d14909607b10f1b2138ddc7aaa0d36057" },
      { "method": "range", "family": "v6", "value": "2001:db8:1234:5678::/64" }
    ],
    "originalUrl": "https://yourapp.com/buy"
  }'

Response

201 Created

{
  "checkoutUrl": "https://partner.banxa.com/portal?expires=xxx&oid=xxx&signature=xxx",
  "id": "191fa5b4b1f45e1cf784422e09317d56",
  "externalOrderId": "a4b427ccb872a1744b317456bd0d165f",
  "externalCustomerId": "user_12345",
  "fiat": "AUD",
  "fiatAmount": "200.00",
  "crypto": "ETH",
  "cryptoAmount": "0.04812",
  "blockchain": "ETH"
}
FieldDescription
checkoutUrlURL to redirect or embed for the customer to complete their transaction.
idBanxa order ID. Store this for order lookup and reconciliation.
externalOrderIdYour order reference (externalOrderId from the request). Null if not provided.
externalCustomerIdThe customer identifier you provided.
fiatFiat currency code (string).
fiatAmountFiat amount as a string.
cryptoCryptocurrency code (string).
cryptoAmountCrypto amount as a string.
blockchainBlockchain network.

IP binding

IP binding is on for all new partners: every buy order must include the customer's IP address in ipBinding, or ipBindingOmitted for iCloud Private Relay customers. See the example request above.

→ See IP Binding for how to get the address, choose hash or range, and build the values.


Next step

Redirect the customer to checkoutUrl or load it in an iFrame/WebView.

→ See Redirecting to Checkout