Understanding Entity Mapping for Rewards
In this guide, the entities map as follows (platform-funded model):Entity Type | Who They Are | In This Example |
---|---|---|
Platform | Your rewards app paying rewards directly | Your cashback/rewards platform |
Customer | (Not used in this model) | N/A |
External Account | Users’ crypto wallets receiving rewards | User’s self-custody Spark wallet |
For white-label reward programs where brands like Nike or Starbucks fund their own reward campaigns, those brands would be created as Customers who manage their own reward budgets.
Prerequisites
Before starting this guide, ensure you have:- A Grid API account with valid authentication credentials
- Access to the Grid API endpoints (production or sandbox)
- A webhook endpoint configured to receive notifications
- A Spark wallet address where the Bitcoin will be sent
Overview
The process consists of the following steps:- List platform internal accounts to find your platform’s USD funding instructions
- Fund your internal account via ACH push and receive a webhook notification
- Generate a spark wallet for your customer, or let them connect their own
- Execute a quote to complete the Bitcoin purchase and transfer a reward to the user’s own Spark wallet.
Step 1: List your platform’s internal accounts
When your platform is first created, it is automatically assigned an internal account with a balance in your configured fiat currency. List your platform’s internal accounts to see the available balances and funding instructions for USD.Request
Response
fundingPaymentInstructions
provide the bank account details and reference code needed to fund this internal account via ACH pull from the customer’s bank.
You can also see that there are Spark wallet funding instructions in this
example response which can be used to fund the internal account with USDB
instantly.
Step 2: Fund your Internal Account
You can initiate an ACH transfer from your bank to the account details provided in the funding instructions, making sure to include the reference codeFUND-BTC123
in the transfer memo.
In sandbox mode, you can use the
/sandbox/internal-accounts/{accountId}/fund
endpoint to simulate receiving funds. In production, actual ACH transfers
typically take 1-3 business days to settle.Webhook Notification
When the funds are received and the internal account balance is updated, you’ll receive a webhook notification:Step 3: Customer Onboarding
This guide assumes you have a Spark wallet address for your customer who will receive the Bitcoin reward. For rewards, the only entity who needs to be KYB’d is the entity paying for the reward - in this case, you, the platform! All you need in order to pay out a reward is the wallet address. No need to go through the full hosted KYC flow for this use case! To generate a spark wallet, you can use a tool like Privy or the Spark SDK directly.Step 4: Create and Execute a Quote to the Customer’s Spark Wallet
Create and execute a trade from USD to BTC, and initiate the final transfer in one step. This combines external account creation and quote execution using theexternalAccountDetails
option.
Request
Combined External Account Creation and Quote Execution: The
externalAccountDetails
option allows you to
create the external account and execute the quote in a single API call, which is perfect for one-off payments
to new destinations. The external account will be automatically created and then used as the destination for
the Bitcoin transfer. Its ID in the response can be used directly in future quote creation requests.Immediate Quote Execution (Market Order): Note that immediatelyExecute
is set to true
in this example.
Because we always just want to send $1.00 worth of BTC to users as a reward at the current market rate, we don’t
need to lock a quote and view the rate details before executing. If you want to lock a quote and confirm fees
and exchange rate details before executing the quote, set immediatelyExecute
to false
or omit the field.Response
- Sending: $1.00 USD (including $0.05 fee)
- Receiving: 0.0000081 BTC (810 satoshis)
- Exchange rate: 8.1 sats per USD cent (~$123,000 per BTC)
- External account created: The Spark wallet was automatically added as an external account during quote creation
PROCESSING
and the Bitcoin transfer is initiated. The external account is created, USD is debited from the internal account, Bitcoin is purchased, and then sent to the Spark wallet address.
You can track the status by:
- Polling the quote endpoint:
GET /quotes/{quoteId}
- Waiting for a webhook notification
Completion Webhook
When the Bitcoin transfer completes, you’ll receive a webhook notification:Bitcoin transfers to Spark wallets typically complete within seconds, much
faster than traditional Bitcoin on-chain transactions.
Summary
You’ve successfully completed a Bitcoin purchase and transfer to a self-custody Spark wallet! Here’s what happened:- ✅ Listed internal accounts and obtained USD funding instructions
- ✅ Funded the internal account with USD via ACH
- ✅ Generated a Spark wallet for the customer
- ✅ Created and executed a quote to purchase Bitcoin and send to the Spark wallet
Next Steps
- Transaction history: Use
GET /transactions
to track all Bitcoin purchases - Price monitoring: Build price alerts using the lookup endpoint to monitor rates
- Webhook verification: Implement signature verification for webhook security (see Webhooks guide)
Related Resources
- API Reference - Complete API documentation
- Platform Configuration - Configure your platform settings
- Webhooks - Webhook security and verification