Overview
The BOB Gateway SDK makes it easy to bring native BTC swaps directly into your app. This guide walks through the complete integration process. We recommend using the API directly, but you may use our SDK for convenience.What’s new in V3
This guide targets the V3 API. V1 and V2 endpoints remain reachable but are superseded — the SDK calls
/v3 under the hood. Upgrading an existing integration? See the Migration Guide.- Non-EVM chains (Tron & Solana) — quotes and orders now span EVM, Tron, and Solana as well as Bitcoin. Addresses and token identifiers are
0x…on EVM chains and Base58 on Tron/Solana.executeQuotesigns and broadcasts the right transaction shape for each chain; if you build transactions yourself,createOrderreturns a tagged union you dispatch on (type: 'evm' | 'tron' | 'solana'). ownerAddress(required) andrefundAddress—getQuotenow takes anownerAddress(the EVM owner / refund-claimant, also used for order lookup) and an optional BitcoinrefundAddressfor onramps. Routes that need an owner but don’t get one fail withMISSING_OWNER_ADDRESS.- USD on order info —
srcInfo,dstInfo, settled transfers (receivedTokens/refundedTokens), andpendingBtcPaymentnow each carry an optionalusdvalue (valued at order time). In V2,usdwas only on quote amounts and fee-breakdown lines. - Affiliate fees on
tokenSwap—tokenSwapquotes now expose a resolved singleaffiliate({ address, bps }), charged by the aggregator on the source chain. Aggregators allow only one partner fee per swap, so passing more than one affiliate returnsTOO_MANY_AFFILIATES.onramp/offrampkeep the V2 multi-recipientaffiliateslist (details). - Removed parameters —
gasRefill,strategyAddress/strategyTarget, andstrategyMessageare no longer supported and are rejected by the gateway. - Paginated
getOrders—getOrdersaccepts{ userAddress, cursor?, limit? }and returns{ orders, nextCursor }(carried over from V2). Pass backnextCursorto fetch the next page; a null/missing value means you’ve reached the end (details). - Discriminated order status —
success/refundedare objects carryingreceivedTokens/refundedTokens(each entry haschain,token,amount, the settlementtxHash, and nowusd);status.inProgress.pendingBtcPaymentexposes the gateway’s outgoing Bitcoin{ txid, amount, usd }on in-progress X-to-BTC orders. Read the destinationtxHashfrom the status payload —dstInfodoesn’t carry one.
Installation
Initialize the SDK
Import theGatewayApiClient (exported as GatewaySDK) and create an instance. The constructor takes an optional options object:
Authentication
API keys are optional — the API is reachable without authentication. A key unlocks:- Analytics dashboard — your orders, volume, and affiliate earnings
- Higher rate limits than keyless usage
Partner Onboarding
Get an API key and go live — full flow and contact details
Authorization header as a Bearer token (Authorization: Bearer <api-key>). If you’re calling the API directly, set the same header on every V3 request.
Get Available Routes
Fetch all supported routes to show users their options:Get a Quote
Request a quote for the user’s desired transaction:Understanding Quote Types
ThegetQuote response is a discriminated union — access fields through the appropriate key:
Execute the Quote
Execute the quote by having the user sign the Bitcoin transaction:For detailed wallet integration options including Reown AppKit, sats-wagmi, Dynamic.xyz, and more, see the Bitcoin Wallets guide.
Monitor Orders
Fetch a page of the user’s pending and completed orders.getOrders returns { orders, nextCursor } — pass nextCursor back to walk subsequent pages:
Link users to the Gateway Explorer
If you don’t want to build your own tracking UI, every order has a public status page on the Gateway Explorer that you can link users to directly:Paginating through all orders
nextCursor is null/absent once you’ve reached the last page:
X to BTC Order Features
For X-to-BTC (BOB → Bitcoin) orders,getOrders surfaces status fields you can act on while the order is still in progress:
Track the Pending BTC Payout
Track the Pending BTC Payout
While the gateway is settling an X-to-BTC order,
status.inProgress.pendingBtcPayment carries the outgoing Bitcoin transaction { txid, amount }. Use it to show the user a “payout in flight” state and link to a block explorer:Gateway no longer exposes a
bumpFeeTx EVM transaction — it manages fee bumps internally for the BTC payout it broadcasts.Refund Stuck Orders
Refund Stuck Orders
If an order gets stuck or needs to be cancelled, the order will include a
refundTx to unlock the locked assets:Monetization (Affiliate Fees)
Gateway supports affiliate fees out of the box. You set them per-quote via the SDK’saffiliates parameter — an array of { address, bps } pairs. How they’re charged depends on the route:
onramp/offramp— fees are deducted at settlement and paid out in USDT on Ethereum to the recipient addresses you specify, regardless of the route. These routes accept multiple recipients per quote.tokenSwap— the fee is charged by the aggregator (Bungee/Velora) on the source chain. Aggregators allow only one partner fee per swap, so atokenSwapquote accepts exactly one affiliate. Passing more than one returnsTOO_MANY_AFFILIATES.
1 bps = 0.01%, so 50 means 0.50%. For the full fee model, see Fees.
Single recipient
Split fees across multiple recipients
onramp and offramp quotes let you split affiliate fees across multiple recipients in a single quote — useful for revenue splits between an aggregator and an underlying integrator, referral programs, or multi-party agreements. (tokenSwap accepts only one affiliate.)
Format and rules
- Comma-separated
<address>:<bps>pairs, no spaces. - Each address must be a valid EVM address.
- Each
bpsMUST be greater than0. - Omit
affiliatesor pass an empty array for no affiliate fees. tokenSwapaccepts at most one affiliate; more than one returnsTOO_MANY_AFFILIATES.- The gateway enforces caps on recipient count and total bps. Routes that don’t support affiliate fees return error code
AFFILIATE_FEES_NOT_SUPPORTED_FOR_ROUTE— handle this by retrying the quote withaffiliatesomitted, or surfacing the error to the user.
Reading resolved fees from the quote
onramp and offramp quotes include a resolved affiliates array — each entry has the recipient address and the computed fee amount (with optional USD value). Use it to surface the affiliate split to the user:
tokenSwap quotes instead expose a single resolved affiliate ({ address, bps }, or null for a fee-free swap):
Raw API equivalent
For integrators not using the SDK, pass the same pairs to the V3 quote endpoint as theaffiliates query parameter:
Track your orders and earnings
With an API key you get a partner dashboard on the Gateway Explorer:Next Steps
Build DeFi Strategies
Create 1-click DeFi actions like staking and lending
Bitcoin Wallets
Detailed guide on wallet integrations
API Reference
Complete API documentation
Example Code
View complete examples on GitHub