Purchase mobile data
X-API-KeyPOST
/data/purchaseData purchase is asynchronous. A successful accept returns HTTP 202 with status: processing. Poll GET /transactions/{id} until terminal.
Language
curl -X POST "https://api.vendpower.ng/api/v1/data/purchase" \
-H "X-API-Key: YOUR_X_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"biller_code": "MTN",
"plan_id": "501",
"mobile_number": "08031234567",
"idempotency_key": "VP_DATA_UNIQUE_001"
}'Authentication
Send your approved API key on every request. Keep it on your server only.
| Header | Value | Required |
|---|---|---|
| X-API-Key | YOUR_X_API_KEY | Yes |
| Content-Type | application/json | Yes |
| Accept | application/json | Recommended |
Authentication failures (401 / 403 / 429) are listed in Authentication.
Parameters
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
| biller_code | string | Yes | Network code |
| plan_id | string | Yes | Numeric id or api_plan_id |
| mobile_number | string | Yes | 11-digit Nigerian MSISDN |
| idempotency_key | string | Yes | Your unique purchase key (recommended VP…). Re-sending the same key returns 409 with the original transaction — never charges twice. |
Responses
202 Accepted — Accepted
{
"success": true,
"message": "Purchase accepted.",
"data": {
"id": 99001,
"reference": "VP_DATA_UNIQUE_001",
"idempotency_key": "VP_DATA_UNIQUE_001",
"status": "processing",
"category": "data",
"amount": 500,
"charge": 500
}
}Errors
Errors specific to this endpoint, in addition to common authentication and validation failures.
| Code | HTTP | When |
|---|---|---|
| VALIDATION_ERROR | 422 | Request body failed validation or business rules. |
| INSUFFICIENT_BALANCE | 400 / 402 | Wallet balance is too low for this purchase. |
| DUPLICATE_IDEMPOTENCY | 409 | This idempotency_key was already used — requery the returned transaction. |
| SERVICE_UNAVAILABLE | 503 | Upstream provider or service is temporarily unavailable. |
Notes
- Do not create a second purchase while the first is still
processing— poll instead.