Cards
Card Top-Ups
Create top-ups and list top-up records for mobile users.
Flow Summary
The top-up flow is:
Step 1. Make sure the source card is active Use Card List to confirm card status first
Step 2. Start a top-up
Use POST /api/v1/card-topup
Step 3. Check the top-up record
Use GET /api/v1/card-topup
All routes below should be treated as protected routes and sent with:
Authorization: Bearer <access_token>
1. Create Card Top-Up
POST /api/v1/card-topup
Creates a new top-up order for a card.
Request
{
"amount": 100.00,
"card_id": 508
}
URL Query Parameters:
method(optional): Payment methodagent_pay: Agent pays on behalf of user using agent's prepaid balanceuser_pay: User pays directly via payment gateway (default)
Request rules
amountis requiredcard_idis requiredcard_idis the local numeric card record IDmethodis optional URL parameter, defaults touser_payif not provided
Important backend behavior
- The card must belong to the current user
- The card must currently be
ACTIVE - The input
amountis treated as the user's USDT funding amount - Fees, adjusted exchange rate, and the final net amount are calculated server-side
- The new top-up row is created with
status = PENDING - After the DB row is created, the service makes a synchronous RPC call to create a payment order
Success response
{
"status_code": 201,
"message": "Success",
"data": {
"id": 123,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"card_id": "508",
"amount": "100.00",
"amount_usdt": "100.00",
"net_amount": "99.20",
"top_up_fee": "0.80",
"exchange_rate": 0.998857,
"status": "PENDING",
"merchant_order_sn": "HTP-550e8400-e29b-41d4-a716-446655440000",
"created_at": "2024-01-15T10:30:00Z"
}
}
Response fields:
id: Local database IDuuid: Top-up unique identifiercard_id: Card ID (as string)amount: Gross amount in cents, formatted to 2 decimal placesamount_usdt: USDT amount from usernet_amount: Net amount after fee, formatted to 2 decimal placestop_up_fee: Fee charged for top-up, formatted to 2 decimal placesexchange_rate: Exchange rate applied at time of top-upstatus: Top-up status (PENDING, SUCCESS, FAILED, etc.)merchant_order_sn: Unique merchant order reference for payment trackingcreated_at: ISO 8601 timestamp
2. List Card Top-Ups
GET /api/v1/card-topup
Lists top-up records with pagination.
Query parameters
| Name | Required | Notes |
|---|---|---|
page | No | Default 1 |
limit | No | Default 10 |
search | No | Free-text search |
status | No | Filters by top-up status |
start_date | No | Date range start (Note: uses start_date, not from_date) |
end_date | No | Date range end (Note: uses end_date, not to_date) |
Important backend caveat
- The current repository implementation is not explicitly scoped to the authenticated mobile user
- In practice, this behaves more like a shared top-up list filtered only by the provided query params
- Clients should treat this as an implementation gap and avoid assuming strict user-only isolation until the backend is tightened
