Developer Guide
Sending
15 min
sending payments this guide explains how to send lightning network and onchain bitcoin payments using the voltage api prerequisites a voltage account with an active wallet an api key (get this from the "api keys" page in your dashboard) sending a payment endpoint post https //voltageapi com/v1/organizations/{organization id}/environments/{environment id}/payments headers x api key your api key content type application/json request body lightning payment (bolt11) { "id" "68d00852 8dd8 4c71 94d2 91c84695da78", // uuid created by you "wallet id" "7a68a525 9d11 4c1e a3dd 1c2bf1378ba2", "currency" "btc", "type" "bolt11", "data" { "payment request" "lntbs1500n1p ", // required lightning invoice to pay (cannot be empty) "amount msats" 150000, // optional when payment request already contains an amount // required when payment request has no amount // if provided with an amount containing payment request, values must match // must be greater than 0 "max fee msats" 1000 // optional defaults to 1% of payment value or 1,000 msats (whichever is greater) // must be greater than 0 } } onchain payment { "id" "2ec1e783 19b4 4c10 8181 66336a6232bd", "wallet id" "7a68a525 9d11 4c1e a3dd 1c2bf1378ba2", "currency" "btc", "type" "onchain", "data" { "address" "tb1pzkhtj4ld86g9c49du5yagnncfrm0s489t76vmrwmt2ecxfnf7spsvjte49", // required bitcoin address "amount sats" 150000, // required amount in satoshis (must be greater than 0) "max fee sats" 1000, // optional defaults to 1% of payment value or 1,000 sats "label" "test payment" // optional label for the payment } } unified payment (bip21) { "id" "3e84b6c5 5bbe 4e0f 9fb3 f1198330f6fa", "wallet id" "7a68a525 9d11 4c1e a3dd 1c2bf1378ba2", "currency" "btc", "type" "bip21", "data" { "address" "bitcoin\ tb1pzkhtj4ld86g9c49du5yagnncfrm0s489t76vmrwmt2ecxfnf7spsvjte49?amount=0 0015", // required bip21 uri "amount msats" 150000, // optional amount specification "max fee msats" 1000, // optional max fee for lightning portion "max fee sats" 10, // optional max fee for onchain portion "description" "payment for services" // optional payment description } } required fields id a unique identifier for the payment wallet id the id of the wallet sending the payment currency currently only "btc" is supported type "bolt11" (lightning), "onchain" (bitcoin), or "bip21" (unified) data payment specific data for lightning payment request and optionally amount msats , max fee msats for onchain address , amount sats , and optionally max fee sats , label for bip21 address (bip21 uri) and optionally amount/fee fields monitoring payment status after sending a payment, monitor its status using get https //voltageapi com/v1/organizations/{organization id}/environments/{environment id}/payments/{payment id} the payment will transition through these states sending payment is in progress completed payment was successful failed payment failed (check error field for details) error handling common http status codes 200 success 400 invalid request (check error message) 403 authentication error 404 payment not found 500 server error example implementation lightning payment \# send lightning payment curl 'https //voltageapi com/v1/organizations/{organization id}/environments/{environment id}/payments' \\ \ request post \\ \ header 'x api key your api key' \\ \ header 'content type application/json' \\ \ data '{ "id" "68d00852 8dd8 4c71 94d2 91c84695da78", "wallet id" "7a68a525 9d11 4c1e a3dd 1c2bf1378ba2", "currency" "btc", "type" "bolt11", "data" { "amount msats" 150000, "max fee msats" 1000, "payment request" "lntbs1500n1p " } }' onchain payment \# send onchain payment curl 'https //voltageapi com/v1/organizations/{organization id}/environments/{environment id}/payments' \\ \ request post \\ \ header 'x api key your api key' \\ \ header 'content type application/json' \\ \ data '{ "id" "2ec1e783 19b4 4c10 8181 66336a6232bd", "wallet id" "7a68a525 9d11 4c1e a3dd 1c2bf1378ba2", "currency" "btc", "type" "onchain", "data" { "address" "tb1pzkhtj4ld86g9c49du5yagnncfrm0s489t76vmrwmt2ecxfnf7spsvjte49", "amount sats" 150000, "max fee sats" 1000, "label" "test payment" } }' check payment status curl 'https //voltageapi com/v1/organizations/{organization id}/environments/{environment id}/payments/{payment id}' \\ \ header 'x api key your api key' \# send payment curl 'https //voltageapi com/v1/organizations/{organization id}/environments/{environment id}/payments' \\ \ request post \\ \ header 'x api key your api key' \\ \ header 'content type application/json' \\ \ data '{ "id" "68d00852 8dd8 4c71 94d2 91c84695da78", "wallet id" "7a68a525 9d11 4c1e a3dd 1c2bf1378ba2", "currency" "btc", "type" "bolt11", "data" { "amount msats" 150000, "max fee msats" 1000, "payment request" "lntbs1500n1p " } }' \# check payment status curl 'https //voltageapi com/api/v1/organizations/{organization id}/environments/{environment id}/payments/{payment id}' \\ \ header 'x api key your api key'