Prerequisites
- A verified Bitnob account.
- API credentials, and a working signed request. See Quickstart.
- BTC in your Bitnob wallet, funded on-chain or over Lightning.
- A destination: a BTC address or a BOLT11 invoice.
The two rails
Funds come from the same wallet either way.
1
Collect the input
From your interface or backend, gather the amount, the destination, and your own reference for tracking. The destination format decides the rail: an address means on-chain, a string beginning
lnbc (lntb in sandbox) means Lightning.Validate the destination before you call the API. A malformed address is the most common cause of a failed send, and it is cheaper to catch client-side.2
Send on-chain
The response confirms the withdrawal was accepted, not that it confirmed on-chain. Wait for the
transfer.success webhook before telling the user it is done.3
Or send over Lightning
preimage is the cryptographic proof of payment: store it.4
Confirm the outcome
On success you get a transaction id and your
reference back, and the wallet balance updates. Resolve either identifier later with Get transaction by id or reference, and check the balance with Get balances.Record the reference and the returned transaction id against the user in your own database. If you are moving user funds, log the destination too, for audit.When it fails
Handle all outcome messaging through webhooks rather than the synchronous response, and make the handler idempotent. See Confirmations and webhook events.
Next
Confirmations and webhook events
When a payment is safe to treat as final.
Fees and confirmation strategy
Choosing a fee rate, and rescuing a stuck transaction.
Issue addresses and invoices
The inbound direction.
Custody models
Who holds the keys, and what that changes.