# Hàm mua thẻ cào

## HTTP request

\ <mark style="color:yellow;">**`POST`**</mark> [https://api.omitopup.com/api/cardcode](http://api.omitopup.com/api/cardcode)

* **Content Type:** <mark style="color:orange;">application/json</mark>
* **Response Type:** <mark style="color:orange;">application/json</mark>

```json
curl --location --request POST 'https://api.omitopup.com/api/cardcode' \
--header 'token: {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"network":{{network}},
"price":"{{price}}"
}'
```

* **Cấu trúc body của request:**

<table><thead><tr><th width="194">Thuộc tính</th><th>Mô tả</th></tr></thead><tbody><tr><td>token  <mark style="color:red;">*</mark></td><td>Bạn sẽ được cung cấp khi sử dụng hàm đăng nhập.</td></tr><tr><td>network</td><td>Là nhà mạng bạn muốn mua thẻ cào. <br>1: Viettel<br>2: Mobiphone <br>3: Vinaphone <br>4: Vietnammobile <br>5: Gtel</td></tr><tr><td>price <mark style="color:red;">*</mark></td><td>Mệnh giá thẻ cào.</td></tr><tr><td>sandbox</td><td>Kiểm tra kết nối<br>1: thử nghiệm, không mua card.<br>0: không thử nghiệm, mua card.</td></tr><tr><td>requestid</td><td><p></p><p>Id đối tác gửi sang eSMS </p><p><strong>*Lưu ý:</strong></p><ul><li>ID này sẽ check trùng với ID khác</li><li>ID này có thể sử dụng để check trạng thái từ Hàm API lấy trạng thái của eSMS.</li></ul></td></tr></tbody></table>

* **Response:**

```json
{
"resultCode": 100,
"cardCode": "59001254178553:12312542358373:10000:Vinaphone:31/12/2025",
"message": "Thành công",
"referenceid": "5a123c6c-0f3f-4ca2-9775-e1cb4faf9add"
}
```

* **Cấu trúc body của response:**

<table><thead><tr><th width="233">Thuộc tính</th><th>Mô tả</th></tr></thead><tbody><tr><td>resultCode</td><td>100: Thành công. <br>106: Truyền sai network. <br>103: Hết tiền trong tài khoản. <br>101: Sai Token. <br>107: Số tiền không đúng Hiện tại: đang là bội của 1000.<br>200: Kết nối thành công (Sandbox). <br>111: Địa chỉ IP chưa được Whitelist.<br>99: Lỗi không xác định.</td></tr><tr><td>message</td><td>Thông báo thành công hay thất bại của request.</td></tr><tr><td>referenceid</td><td>Id hệ thống topup trả về người dùng.</td></tr><tr><td>cardCode</td><td><p>Thông tin card mà eSMS trả về.<br>Ví dụ: 59001254178553:12312542358373:10000:Vinaphone:31/12/2025</p><ul><li>Thứ tự cardCode: seri, mã, mệnh giá,nhà mạng,etc</li></ul></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer-topup.esms.vn/reference/cardcode/ham-mua-the-cao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
