Receive BTC on Lightning
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
}
}
}
}
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
}
}
}
Once paid check the balance again
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
}
}
}
}
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.