Quick Start

Send your first payment with BlindPay.

Get your API Key

Before you start, you need to:

  1. Create an account on BlindPay
  2. Create a development instance
  3. Create your API key
  4. Mint USDB on Base Sepolia Testnet

Create a Receiver

Run the code below in your terminal to create a new receiver.

All receivers on development instances will be automatically approved by our KYC.

cURL
curl --request POST \
  --url https://api.blindpay.com/v1/instances/in_000000000000/receivers \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "type": "individual",
    "kyc_type": "standard",
    "email": "[email protected]",
    "tax_id": "12345678",
    "address_line_1": "8 The Green",
    "address_line_2": "#12345",
    "city": "Dover",
    "state_province_region": "DE",
    "country": "US",
    "postal_code": "02050",
    "ip_address": "127.0.0.1",
    "phone_number": "+1234567890",
    "proof_of_address_doc_type": "UTILITY_BILL",
    "proof_of_address_doc_file": "https://pub-4fabf5dd55154f19a0384b16f2b816d9.r2.dev/v4-460px-Get-Proof-of-Address-Step-3-Version-2.jpg.jpeg",
    "first_name": "John",
    "last_name": "Doe",
    "date_of_birth": "1998-01-01T00:00:00Z",
    "id_doc_country": "US",
    "id_doc_type": "PASSPORT",
    "id_doc_front_file": "https://pub-4fabf5dd55154f19a0384b16f2b816d9.r2.dev/1000_F_365165797_VwQbNaD4yjWwQ6y1ENKh1xS0TXauOQvj.jpg"
  }'

Create a Bank Account

In this example we're going to create an ACH bank account in the US.

This account should be a valid one, so please replace beneficiary, routing_number and account_number with your own information.

cURL
curl --request POST \
  --url https://api.blindpay.com/v1/instances/in_000000000000/receivers/re_000000000000/bank-accounts \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "ach",
  "name": "Display Name",
  "beneficiary_name": "<Replace this>",
  "routing_number": "<Replace this>",
  "account_number": "<Replace this>",
  "account_type": "checking",
  "account_class": "individual"
}'

Create a Payout on Base Sepolia Testnet

In this step we're going to use a default express.js server to create a payout on Base Sepolia Testnet.

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

Now create a folder called blindpay-api-example. Inside the folder, please run the following command:

npm init

And now install the dependencies:

npm install express ethers

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

index.js
import express from "express";
import { ethers } from "ethers";

var app = express()

app.get("/", async function(req, res){
  // Before start
  const rpcProviderUrl = "<Replace this>" // You can get this from https://chainlist.org/
  const walletPrivateKey = "<Replace this>" // This wallet must have ethers (which you can get here: https://www.alchemy.com/faucets/base-sepolia) and USDB (which you can get here https://app.blindpay.com/mint) to execute the transaction on step 2
  const instanceId = "<Replace this>"
  const blindpayApiKey = "<Replace this>"
  const bankAccountId = "<Replace this>"

  // BlindPay Api Configs
  const headers = {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${blindpayApiKey}`
  };

  // 1 Step: Create a quote
  const fiftyDollars = 5000
  const quoteBody = {
    "bank_account_id": bankAccountId,
    "currency_type": "sender",
    "cover_fees": false,
    "request_amount": fiftyDollars,
    "network": "base_sepolia", // "sepolia", "base_sepolia", "arbitrum_sepolia"
    "token": "USDB" // on development instance is always "USDB"
  }
  const createQuote = await fetch(`https://api.blindpay.com/v1/instances/${instanceId}/quotes`, { headers, method: "POST", body: JSON.stringify(quoteBody) });
  const quoteResponse = await createQuote.json();

  // 2 Step: Approve tokens
  const provider = new ethers.JsonRpcProvider(rpcProviderUrl, quoteResponse.contract.network)
  const yourWallet = new ethers.Wallet(walletPrivateKey, provider)
  const contract = new ethers.Contract(quoteResponse.contract.address, quoteResponse.contract.abi, provider)
  const contractSigner = contract.connect(yourWallet)

  await contractSigner.approve(
    quoteResponse.contract.blindpayContractAddress,
    quoteResponse.contract.amount,
  );

  // 3 Step: Execute payout
  const senderWalletAddress = await yourWallet.getAddress()
  const payoutBody = {
    "quote_id": quoteResponse.id,
    "sender_wallet_address": senderWalletAddress
  }
  const executePayout = await fetch(`https://api.blindpay.com/v1/instances/${instanceId}/payouts/evm`, { headers, method: "POST", body: JSON.stringify(payoutBody) });
  const payoutResponse = await executePayout.json();

  res.send(payoutResponse);
});

/* istanbul ignore next */
app.listen(3000);
console.log("Express started on port 3000");

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

node index.js

You can now access the application at http://localhost:3000 to see the result.