Before you can receive USDB tokens, you need to create a trustline to the USDB asset. This is a one-time setup that you only need to do once per wallet.
Important: Use the same wallet address that you used when creating your blockchain wallet in the . The trustline setup is only required once per wallet.
If you're using Stellar or Solana, you'll use a different delegation process instead of ERC20 approvals. See the Stellar and Solana sections below for blockchain-specific instructions.
For EVM chains, all stablecoins supported by BlindPay are ERC20 tokens, so you need to call the approve method on the token contract to allow BlindPay to move the funds from any blockchain wallet.
Remember: replace YOUR_SECRET_TOKEN with your API key, in_000000000000 with your instance ID, qu_000000000000 with the quote you generated previously and sender_wallet_address with the same wallet address that you used to approve the tokens.
Remember: replace YOUR_SECRET_TOKEN with your API key, in_000000000000 with your instance ID, qu_000000000000 with the quote you generated previously and sender_wallet_address with the same wallet address that you used to approve the tokens.
This endpoint will return a transaction hash that you can use to execute the payout.
{
"transaction_hash": "AAA...AAA"
}
With this hash we can create the transaction on Stellar.
First, you need to install the dependencies:
npm install @stellar/stellar-sdk
Now create a file called index.js inside it, paste the code below and replace the values with your own.
import {
AuthRequiredFlag,
AuthRevocableFlag,
BASE_FEE,
Horizon,
Keypair,
Networks,
Operation,
TransactionBuilder,
Asset,
} from '@stellar/stellar-sdk'
const stellar = new Stellar({
server: 'https://horizon-testnet.stellar.org',
network: 'testnet',
})
const stellarWallet = stellar.wallet(Keypair.fromSecret(process.env.STELLAR_SECRET_KEY))
// Create a transaction from the hash that we got from the authorize endpoint
const transaction = TransactionBuilder.fromXDR(transactionHash, Networks.TESTNET)
// Sign the transaction
const signedTransaction = stellarWallet.sign(transaction)
// Submit the transaction
const result = await stellar.submitTransaction(signedTransaction)
console.log(result)
// You need to save the hash from the result (result.hash) to create the payout on BlindPay
::
Now run you can run the code using the following command:
node index.js
Now you can create the payout on BlindPay using the hash that you got from the result.
cURL
curl --request POST \
--url https://api.blindpay.com/v1/instances/in_000000000000/payouts/stellar \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"quote_id": "qu_000000000000",
"signed_transaction": "<Replace this>", // This is the signed transaction that we got from the authorize endpoint
"sender_wallet_address": "<Replace this>" // This is the wallet address that we used to approve the tokens
}'
Congratulations! You've completed your first payout using BlindPay. If you want to execute more payouts you need to create a new quote and approve the tokens again.
Remember: replace YOUR_SECRET_TOKEN with your API key, in_000000000000 with your instance ID, qu_000000000000 with the quote you generated previously and sender_wallet_address with your Solana wallet address.
Solana payouts require a token delegation before executing the payout. You'll need to sign and submit a delegation transaction before calling the payout API.
Congratulations! You've completed your first Solana payout using BlindPay. The /payouts/evm endpoint supports EVM chains, Stellar, and Solana networks.
Note: For each Solana payout, you need to complete the delegation process (Steps 1-2) before creating the payout. The delegation authorizes BlindPay to pull the specified amount of tokens from your wallet.
By default all the payouts are automatically completed in 'development' instances, but you can force 'refund' and 'failed' scenarios by adding specific values to the payout amount.