curl -X POST https://api.zbdpay.com/api/v1/transactions/credits \
-H "x-api-key: YOUR_API_KEY" \
-H "Idempotency-Key: 90f9371e-c48a-4bc9-9075-ef7a4c6816ec" \
-H "Content-Type: application/json" \
-d '{
"user_id": "4ac4fd8a-cc2c-4d03-af09-a76f4e89d652",
"type": "reward",
"amount": 1000,
"currency": "USD",
"reference_id": "season_3_win"
}'
{
"success": true,
"message": "Credit completed.",
"data": {
"transaction_id": "txn_3b10",
"type": "reward",
"status": "completed",
"user_id": "4ac4fd8a-cc2c-4d03-af09-a76f4e89d652",
"amount": 1000,
"currency": "USD",
"reference_id": "season_3_win"
},
"error": null
}
Earnings
Credit a User
Add value to a user’s balance.
POST
/
api
/
v1
/
transactions
/
credits
curl -X POST https://api.zbdpay.com/api/v1/transactions/credits \
-H "x-api-key: YOUR_API_KEY" \
-H "Idempotency-Key: 90f9371e-c48a-4bc9-9075-ef7a4c6816ec" \
-H "Content-Type: application/json" \
-d '{
"user_id": "4ac4fd8a-cc2c-4d03-af09-a76f4e89d652",
"type": "reward",
"amount": 1000,
"currency": "USD",
"reference_id": "season_3_win"
}'
{
"success": true,
"message": "Credit completed.",
"data": {
"transaction_id": "txn_3b10",
"type": "reward",
"status": "completed",
"user_id": "4ac4fd8a-cc2c-4d03-af09-a76f4e89d652",
"amount": 1000,
"currency": "USD",
"reference_id": "season_3_win"
},
"error": null
}
Only for programs where ZBD tracks earnings. If you track earnings yourself, this returns
403 feature_not_enabled.Configuration
Header Parameters
string
required
Your ZBD API key.
string
required
A UUID you generate for this credit. Retrying with the same key never credits the user twice.
string
Content Type
Body Parameters
string
required
The ZBD user ID returned by Create a User.
string
required
Why the user is being credited:
reward, purchased_token (currency they bought through a platform store), or adjustment. The type decides what the user can do with the value later, including whether they can cash it out. Your ZBD contact confirms which types your program can use.integer
required
Amount in the currency’s smallest unit.
string
required
The currency code, for example
USD or a currency you defined.string
Your own ID for this credit, returned in the transaction history.
string
Shown in the user’s history.
string
The project the credit belongs to.
curl -X POST https://api.zbdpay.com/api/v1/transactions/credits \
-H "x-api-key: YOUR_API_KEY" \
-H "Idempotency-Key: 90f9371e-c48a-4bc9-9075-ef7a4c6816ec" \
-H "Content-Type: application/json" \
-d '{
"user_id": "4ac4fd8a-cc2c-4d03-af09-a76f4e89d652",
"type": "reward",
"amount": 1000,
"currency": "USD",
"reference_id": "season_3_win"
}'
{
"success": true,
"message": "Credit completed.",
"data": {
"transaction_id": "txn_3b10",
"type": "reward",
"status": "completed",
"user_id": "4ac4fd8a-cc2c-4d03-af09-a76f4e89d652",
"amount": 1000,
"currency": "USD",
"reference_id": "season_3_win"
},
"error": null
}
transaction_id.
Errors
| HTTP | code | When |
|---|---|---|
400 | idempotency_key_required · validation_failed | No idempotency key, or a malformed body |
403 | feature_not_enabled | You track earnings yourself, or the credit type isn’t enabled |
404 | user_not_found | The user doesn’t exist under your key |
409 | idempotency_key_reused | The same key was sent with a different body |
Was this page helpful?