Payouts

API to convert stablecoins to fiat money.

What is a payout?

A payout is an operation that moves funds from the sender's wallet to the receiver's bank account.

The payout can only be executed if a quote was created previously, and you have 5 minutes to execute the payout before the quote expires.

Please review how BlindPay manages the stablecoins in the flow of funds explanation.

How to mint USDB?

USDB is a fake ERC20 stablecoin powered by BlindPay to simulate payouts on development instances.

EVM Chains

You can mint infinite USDB, but you need to add Ether to your wallet, so please get some Ether from https://www.alchemy.com/faucets/base-sepolia.

Put your instance_id on the following url https://app.blindpay.com/instances/<instance_id>/utilities/mint and mint USDB on Base Sepolia Testnet.

Remember: we're using Base Sepolia Testnet in all the examples below, so please double check you're doing everything on the correct network.

Stellar

You can also mint USDB on Stellar Testnet.

Step 1: Create Asset Trustline (Only required once)

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.

Bash

This will return an unsigned XDR transaction:

JSON

Step 2: Sign and Submit the Trustline Transaction

You have two options to complete the trustline setup. Choose only one:

Option A: Sign and submit manually

  1. Sign the XDR using your Stellar wallet (or use Stellar Lab)
  2. Submit the signed transaction to the Stellar network yourself

Option B: Let BlindPay submit it for you

  1. Sign the XDR using your Stellar wallet
  2. Pass the signedXdr to the mint endpoint in the next step - BlindPay will submit the trustline transaction for you

Step 3: Mint USDB Tokens

After your trustline is established, you can mint USDB tokens:

Put your wallet address, the amount, and optionally the signedXdr (if you chose Option B above) on the following url https://api.blindpay.com/v1/instances/{instance_id}/mint-usdb-stellar.

Bash

Important: Use the same wallet address that you used when creating your blockchain wallet in the blockchain wallets section. The trustline setup is only required once per wallet.

Solana

You can also mint USDB on Solana Devnet.

Put your wallet address and the amount on the following endpoint:

Bash

This will return:

JSON

Approving tokens for being moved by BlindPay

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.

Before approving the tokens, you need to have:

  1. A RPC provider URL from Base Sepolia Testnet
  2. A blockchain wallet with enough funds to execute the transaction
  3. The private key or any way to instantiate the blockchain wallet using ethers.js
  4. ERC20 token contract address (Provided by BlindPay on Quote API response)
  5. ERC20 ABI (Provided by BlindPay on Quote API response)
  6. BlindPay smart contract address (Provided by BlindPay on Quote API response)

To simulate an approval, we're going to use JavaScript to install express.js server and ethers.js library.

Before start, please ensure you have Node.js installed.

Now create a folder called approve-erc20. Inside the folder, please run the following command:

Bash

And now install the dependencies:

Bash

Now create a file called index.js inside it, paste the code below and replace the values with your own.

JavaScript
index.js

Now run you can run the code using the following command:

Bash

Now access http://localhost:3000 and after some seconds you should see a result like this in your browser:

JSON

Creating a payout on EVM chains

You can check the required fields in the BlindPay API Docs.

Before creating a payout, you need to:

  1. Create an account on BlindPay
  2. Create a development instance
  3. Create your API key
  4. Create a receiver
  5. Add a bank account
  6. Generate a quote
  7. 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.

Bash
cURL

Creating a payout on Stellar

You can check the required fields in the BlindPay API Docs.

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.

Authorizing a token on Stellar

Bash
cURL

This endpoint will return a transaction hash that you can use to execute the payout.

JSON

With this hash we can create the transaction on Stellar.

First, you need to install the dependencies:

Bash

Now create a file called index.js inside it, paste the code below and replace the values with your own.

JavaScript

::

Now run you can run the code using the following command:

Bash

Now you can create the payout on BlindPay using the hash that you got from the result.

Bash
cURL

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.

Creating a payout on Solana

You can check the required fields in the BlindPay API Docs.

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.

Step 1: Prepare the Delegation Transaction

First, call the BlindPay API to prepare a delegation transaction:

Bash

This will return a serialized transaction that you need to sign:

JSON

Step 2: Sign and Submit the Delegation

Install the Solana dependencies:

Bash

Create a file called solana-delegate.js:

JavaScript

Run the delegation:

Bash

Step 3: Create the Payout on BlindPay

After the delegation is confirmed, you can create the payout using the /payouts/evm endpoint (same as EVM and Stellar):

Bash
cURL

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.

Testing scenarios

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.

AmountResult Status
666.00Failed
777.00Refunded