Retrieve a send context
Get what the dashboard needs to sign a send: each funded address with its balance and nonce, and the fees.
What the dashboard reads before it signs a send in the browser. Checkout pays every customer to a fresh address, so a wallet's funds sit across many addresses: this lists each one that holds the coin or the network's own coin, with its balance and next nonce, and what the network charges at each speed. Nothing in it can move funds, and the browser checks every address against the recovery phrase before it signs.
It takes a person signed in to the dashboard, like the send it prepares, so an API key gets 403 session_required. Balances and nonces come from the network when it's read, less any sends still pending; on a simulated business they come from its own records, and the fees are fixed. Sends are signed on Solana, Polygon and Ethereum. To move Tron and Bitcoin funds for now, restore the recovery phrase in a wallet app.
Query
networkstring RequiredOne ofpolygon,ethereum,solana.assetstring RequiredThe coin to send, such asUSDC.to_addressstring RequiredThe recipient. On Solana, a token send costs more the first time an address receives the coin.
Fields to know
familystringevmfor Polygon and Ethereum, orsolana. The rest of the object depends on it.addressesarrayThe main address first, then every address holding the coin or the network's own coin.indexis the address's place in the wallet (0 is the main address), andbalanceandnative_balanceare in the smallest unit of the coin and of the network's own coin: wei, lamports or the token's base units. EVM addresses also carry the nextnonce, counting transactions still pending.speedsarraySlowest first, each with about how manyminutesit takes. EVM speeds givemax_fee_per_gasandmax_priority_fee_per_gasin wei per gas, and Solana speeds givecompute_unit_pricein micro-lamports per compute unit.gas_limitsobjectEVM only: the gas for a transfer of the network's coin, a token transfer, and a token transfer that another of the wallet's addresses submits under an EIP-3009 authorization.base_fee_per_gasgives the expected fee, andl1_fee_reserveis what a rollup charges per transaction apart from gas, in wei,"0"elsewhere.recent_blockhashstringSolana only: the blockhash to sign with. The transaction must land bylast_valid_block_height, so read a fresh context if the send waits.recipient_token_account_existssays whetherto_addressalready has an account for the token, or isnullfor SOL.
Errors
- 400
invalid_requestA parameter is missing, the coin isn't on the network, or sends on the network aren't signed in the browser yet.fieldnames it. - 400
invalid_addressto_addressisn't valid for the network. - 403
session_requiredAn API key sent the request. Only a person signed in to the dashboard can send. - 404
not_foundYour business has no wallet yet. - 409
external_walletThe wallet keeps its own keys, so its sends happen in its own app. - 503
network_unavailableThe network couldn't be reached. Try again in a moment.
Any request can also fail on its key or its body. See errors.
// On a dashboard page, whose session cookie the browser sends.const response = await fetch("/api/v1/wallet/send-context?network=polygon&asset=USDC&to_address=0x136e44a2738dea5217e8d6745463d2a9a84d1421", { headers: { "402pay-Business": businessId, },});const { data } = await response.json();{ "data": { "kind": "send_context", "family": "evm", "network": "polygon", "asset": "USDC", "chain_id": 137, "base_fee_per_gas": "857142857143", "gas_limits": { "native_transfer": "21000", "token_transfer": "80000", "token_transfer_with_authorization": "100000" }, "l1_fee_reserve": "0", "speeds": [ { "speed": "slow", "minutes": 3, "max_fee_per_gas": "1904761904762", "max_priority_fee_per_gas": "190476190476" }, { "speed": "standard", "minutes": 2, "max_fee_per_gas": "3809523809524", "max_priority_fee_per_gas": "380952380952" }, { "speed": "fast", "minutes": 1, "max_fee_per_gas": "7619047619048", "max_priority_fee_per_gas": "761904761904" } ], "addresses": [ { "address": "0x2A845e4D5e88c78112A719a6B20E71320A88EF86", "index": 0, "balance": "0", "native_balance": "0", "nonce": 0 }, { "address": "0x6F00bCaA08D1A6De8Ce7724dd643823c978bc81F", "index": 1, "balance": "49000000", "native_balance": "0", "nonce": 0 }, { "address": "0xfb8417FbE62ddD1A7992e40Cb42215f02eAd1b37", "index": 2, "balance": "0", "native_balance": "10000000000000000000", "nonce": 0 } ] }}