Skip to main content

Receive USD onchain

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 USD wallet ID

Generate a new address to receive USD

Using Stablesats a merchant can generate and onchain address where the bitcoin received will be denominated in USD cents.
Use the address from the response and send to it from any bitcoin wallet.
The received satoshi amount will reflect the USD/BTC exchange rate at the time it was received and the balance will be kept at the dollar value.

The body of the GraphQL request

mutation onChainAddressCreate($input: OnChainAddressCreateInput!) {
  onChainAddressCreate(input: $input) {
    address
    errors {
      message
    }
  }
}
Set the USD wallet ID:
curl command to generate a new address

Once paid check the balance again

The balance will be updated once the transaction is confirmed on the blockchain.
Until the confirmation the new incoming amount will show in the pendingIncomingBalance field.

The body of the GraphQL request

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

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