Integrate Payments
Add deposit tracking and payment configuration to your application.
Prerequisites
- A DUAL organization with billing enabled
- Familiarity with crypto tokens (ERC-20)
What You'll Build
DUAL supports on-chain payments for tokenized assets. In this tutorial you'll configure the payment system, track deposits, and query balance and transaction history for your organization.
Step 1 — Check Payment Config
First, retrieve your organization's payment configuration to see supported tokens and deposit addresses:
curl https://blockv-labs.io/payments/config \
-H "Authorization: Bearer $DUAL_TOKEN"The response includes:
| Field | Description |
|---|---|
multi_token_deposit_address | The address where users send tokens |
vee_address | VEE token contract address |
supported_tokens | Array of accepted ERC-20 tokens |
Step 2 — Monitor Deposits
Once a user sends tokens to the deposit address, DUAL detects them automatically. List deposits with optional filters:
# List all deposits
curl https://blockv-labs.io/payments/deposits \
-H "Authorization: Bearer $DUAL_TOKEN"
# Filter by transaction hash
curl "https://blockv-labs.io/payments/deposits?tx_hash=0xabc..." \
-H "Authorization: Bearer $DUAL_TOKEN"
# Filter by token
curl "https://blockv-labs.io/payments/deposits?token=VEE" \
-H "Authorization: Bearer $DUAL_TOKEN"Step 3 — Check Organization Balance
Track your organization's running balance and credit history:
# Current balance
curl https://blockv-labs.io/organizations/{orgId}/balance \
-H "Authorization: Bearer $DUAL_TOKEN"
# Balance history (credits and debits over time)
curl https://blockv-labs.io/organizations/{orgId}/balance/history \
-H "Authorization: Bearer $DUAL_TOKEN"Step 4 — Implement in Your App
Here's a complete JavaScript example that polls for new deposits and updates a UI:
const API_BASE = 'https://blockv-labs.io';
async function checkDeposits(token) {
const res = await fetch("" + API_BASE + "/payments/deposits", {
headers: {
'Authorization': "Bearer " + token + "",
'Content-Type': 'application/json'
}
});
const data = await res.json();
return data.items || [];
}
async function getBalance(token, orgId) {
const res = await fetch(
"" + API_BASE + "/organizations/" + orgId + "/balance",
{ headers: { 'Authorization': "Bearer " + token + "" } }
);
return res.json();
}
// Poll every 30 seconds
setInterval(async () => {
const deposits = await checkDeposits(AUTH_TOKEN);
const balance = await getBalance(AUTH_TOKEN, ORG_ID);
updateUI(deposits, balance);
}, 30000);payment.deposit.confirmed events.
Summary
You've now set up the payment pipeline: configuration, deposit tracking, balance monitoring, and a client-side integration pattern. For the full payments API reference, see Payments API.