A comprehensive guide to using the U-Money Gate API for transfers, top-ups, and data packages.
Version: 1.1.0 (Revised)
Last Updated: 2025-06-24
GET
and POST methods.
All API calls should be made to the following base URL. All endpoints are prefixed with /api/v1/
unless otherwise specified.
https://api.yourdomain.com
This API uses the JSON format for all request and response bodies.
All responses from the API, for both success and errors, follow a standard structure with the keys
code, data, and message.
code: The HTTP status code of the response.data: The requested data. This will be an object or an array for
successful requests, and an empty array [] for errors.
message: A descriptive message.All requests to the API (except /ping) must be authenticated using an API
Token.
You must send the token as a query parameter in the URL of every
request.
| Parameter Name | Type | Description |
|---|---|---|
token |
String | Your secret access token. |
https://api.yourdomain.com/api/v1/{endpoint}?token=YOUR_API_TOKEN&...
If authentication fails (missing or incorrect token), the API will return a
401 Unauthorized error.
Checks if the API server is up and running. No authentication required.
GET /ping
200 OKReturns a plain text string.
pong
Check the current account balance for your token.
GET /api/v1/balance
| Name | Required | Description |
|---|---|---|
token |
Yes | Your access token. |
200 OK{
"code": 200,
"message": "Success!",
"data": [
{
"balance": 12345.67
}
]
}
Retrieves a paginated list of all active and supported packages.
GET /api/v1/packages
| Name | Required | Default | Description |
|---|---|---|---|
token |
Yes | N/A | Your access token. |
page |
No | 1 | The page number to retrieve. |
per_page |
No | 10 | The number of items per page. |
rate is the single combined discount currently available to this token for that package.
create_transaction.200 OK{
"code": 200,
"message": "Success",
"data": [
{
"activated": true,
"description": "60GB/1month Free domestic call 150minutes unlimited Youtube+Facebook+ LAOTV4K",
"is_dynamic": false,
"max_price": "0.00",
"min_price": "150000.00",
"package": "5G150",
"rate": "1.00",
"service": "Data",
"update_at": "22-06-2025 17:17:16",
"use_for": "209,0209"
}
],
"pagination": {
"total_items": 25,
"total_pages": 3,
"current_page": 1,
"per_page": 10,
"has_next": true,
"has_prev": false
}
}
Creates a short-lived quote. No balance is deducted and no provider transaction is sent until confirmation succeeds.
POST /api/v1/create_transaction
| Name | Required | Description |
|---|---|---|
token |
Yes | Your access token. |
| Name | Type | Required | Description |
|---|---|---|---|
package |
String | Yes | The package code from the /packages endpoint. |
service |
String | Yes | The service type from the /packages endpoint. |
receiver |
String | Yes | Recipient's phone number. Must start with a prefix from the package's
use_for field.
|
amount |
Integer | If package is dynamic | Transaction amount. Required if is_dynamic is true. Must be between
min_price and max_price.
|
content |
String | No | Optional transaction description. |
The response exposes one final discount. Internal system and token components are not returned separately.
cost = amount * (1 - discount / 100)
If the manager can fund the complete token discount, the quote uses the combined discount. Otherwise it safely falls back to the system discount. Partial funding is never applied.
create_transaction stores a Redis draft for the configured confirmation TTL. It does not deduct balance, create a PostgreSQL transaction, or contact the provider.
Important: Every draft must be confirmed using its exact transaction_id and revision. Only a successful confirmation deducts balance and starts the provider transaction.
200 OK{
"code": 200,
"message": "Transaction created. Confirmation required.",
"data": [
{
"amount": "1000.00",
"content": "abc",
"cost": "910.00",
"created_at": 1750679842.461925,
"discount": "9.00",
"package": "209",
"receiver": "0209xxxxxxx",
"service": "Topup",
"state": 10,
"status": "Awaiting confirmation",
"confirmation_required": true,
"revision": 1,
"transaction_id": "fe4eca0d-9eb6-4e90-a862-2ceca6b11475",
"expire_at": 1750679902.461925
}
]
}
Confirms a Redis quote, deducts the required balances atomically, creates the PostgreSQL transaction, and queues it for processing.
POST /api/v1/confirm_transaction
| Name | Required | Description |
|---|---|---|
token | Yes | Your access token. |
{
"transaction_id": "fe4eca0d-9eb6-4e90-a862-2ceca6b11475",
"revision": 1
}
200 OK{
"code": 200,
"message": "Transaction confirmed.",
"data": [{
"transaction_id": "fe4eca0d-9eb6-4e90-a862-2ceca6b11475",
"amount": "1000.00",
"cost": "910.00",
"discount": "9.00",
"state": 0,
"status": "Pending",
"confirmation_required": false
}]
}
Price changed — 409: Package settings, token discount, or available balances changed after the draft was created. The response contains an updated quote and incremented revision. Review it and confirm again.
Draft expired — 410: Create a new draft. An expired draft never deducted balance.
Idempotency: Repeating confirmation for an already-created transaction returns that transaction and does not create another database row.
Checks the status of a specific transaction.
POST /api/v1/check_transaction
| Name | Required | Description |
|---|---|---|
token |
Yes | Your access token. |
| Name | Type | Required | Description |
|---|---|---|---|
transaction_id |
String | Yes | The Transaction ID from the /create_transaction response. |
200 OK{
"code": 200,
"message": "Success!",
"data": [
{
"amount": "5000.00",
"content": "abc",
"created_at": 1750676450.038312,
"discount": "9.00",
"expire_at": 1750676479.686785,
"package": "209",
"receiver": "0209xxxxxxx",
"service": "Topup",
"state": 0,
"status": "Pending",
"transaction_id": "aa4fabba-165d-44d0-bf91-d7ded05fdb9e",
"update_at": 1750676450.135122
}
]
}
state |
status |
Description |
|---|---|---|
| 10 | Awaiting confirmation | The Redis draft must be confirmed before its TTL expires. |
| 0 | Pending | The transaction is waiting. |
| 1 | Processing | The transaction is in progress. |
| 2 | Success | The transaction was successful. |
| 99 | Server Error | A server-side failure occurred. |
| 404 | Not Found | The transaction does not exist. |
Retrieves a paginated transaction history associated with your API token.
GET /api/v1/history
| Name | Required | Default | Description |
|---|---|---|---|
token |
Yes | N/A | Your access token. |
page |
No | 1 | The page number to retrieve. |
per_page |
No | 10 | The number of items per page. |
month |
No | Current month | Filter transactions by month (1-12). |
year |
No | Current year | Filter transactions by year. |
200 OK{
"code": 200,
"message": "Success",
"data": [
{
"amount": "1000.00",
"content": "abc",
"created_at": 1750679723.602639,
"discount": "9.00",
"expire_at": 1750679753.1074,
"package": "209",
"receiver": "0209xxxxxxx",
"service": "Topup",
"state": 2,
"status": "Topup - 209 to 0209xxxxxxx with 1000.00",
"transaction_id": "f81dd418-6a04-426f-ba39-3d448c459dd3",
"update_at": 1750679752.469642
},
],
"pagination": {
"total_items": 150,
"total_pages": 15,
"current_page": 1,
"per_page": 10,
"has_next": true,
"has_prev": false
}
}
This API gateway is provided for the primary purpose of simplifying and automating valid transactions in a convenient and fast manner.
By using this API, you agree to these terms.
Processing...