Receive USD 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 Stablesats Invoice
Using Stablesats a merchant can generate invoices denominated in USD cents.
Use the paymentRequest
from the response and pay it with a lightning wallet.
The satoshi amount of the invoice will reflect the current USD/BTC exchange rate and the balance will be kept at the dollar value.
The body of the GraphQL request
mutation LnUsdInvoiceCreate($input: LnUsdInvoiceCreateInput!) {
lnUsdInvoiceCreate(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.