Skip to main content

Receive BTC on Lightning

The GraphQL endpoint to connect to:
A valid authentication token is required in the header as a bearer token:

Get the wallet IDs and check the balances

Can run this query at any stage to confirm the change in the balances.
The "BTC" wallet balance is denominated in satoshis.
The "USD" wallet balance is in cents.

The body of the GraphQL request

query Me {
me {
defaultAccount {
wallets {
id
walletCurrency
balance
}
}
}
}
curl command to get the BTC wallet ID

Generate a lightning invoice

Receive satoshis to your BTC balance.
Use the paymentRequest from the response and pay it with a lightning wallet.

The body of the GraphQL request

mutation LnInvoiceCreate($input: LnInvoiceCreateInput!) {
lnInvoiceCreate(input: $input) {
invoice {
paymentRequest
paymentHash
paymentSecret
satoshis
}
errors {
message
}
}
}
Set the variables
curl command to generate an invoice

Once paid check the balance again

tip

There are multiple ways to get notified on the incoming payments: see how to use webhooks (callbacks) and websocket subscriptions.

The body of the GraphQL request to check the balance

query Me {
me {
defaultAccount {
wallets {
walletCurrency
balance
}
}
}
}
curl command to check the balance of your wallets
tip

To test the GraphQL requests further use the GraphQL playground at api.blink.sv/graphql for mainnet or api.staging.blink.sv/graphql for staging.
Check out the Galoy API Postman collection to find examples in multiple programming languages.