# Tạo giao dịch

## Tạo giao dịch

<mark style="color:green;">`POST`</mark> `https://developers.hachium.com/app/create_transaction`

Khi người dùng tạo giao dịch cho một khóa học từ hệ thống thứ 3, API create\_transaction sẽ trả về cho người sử dụng mã kích hoạt để kích hoạt khóa học và id của giao dịch

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

#### Headers

| Name  | Type   | Description                                               |
| ----- | ------ | --------------------------------------------------------- |
| token | string | Token có được khi quản trị viên bật chế độ nhà phát triển |

#### Request Body

| Name            | Type   | Description                                 |
| --------------- | ------ | ------------------------------------------- |
| course\_ids     | string | JSON của mảng chứa id các khóa học          |
| domain          | string | Tên miền của trường                         |
| student\_email  | string | Email của học viên                          |
| student\_name   | string | Tên của học viên                            |
| student\_phone  | string | Số điện thoại của học viên                  |
| creator\_email  | string | Email của quản trị viên                     |
| amount          | number | Số tiền thanh toán                          |
| payment\_method | string | Phương thức thanh toán (PM\_COD hoặc OTHER) |
| payment\_note   | string | Ghi chú về giao dịch                        |
| coupon\_code    | string | Mã khuyến mãi                               |

{% tabs %}
{% tab title="200 API create\_transaction sẽ trả về thông báo tạo giao dịch thành công hay chưa. Nếu tạo giao dịch thành công, API này sẽ trả về thông báo kèm theo dữ liệu của mã kích hoạt và id giao dịch. Nếu tạo giao dịch thất bại, API sẽ trả về thông báo lỗi cụ thể." %}
{% tabs %}
{% tab title="Tạo giao dịch thành công" %}
{% code title="Tạo giao dịch thành công" %}

```
{
"status": "000",
"message": "Tạo giao dịch thành công",
"activation_code": "0419986624",
"transaction_id": 351,
}
```

{% endcode %}
{% endtab %}

{% tab title="Tạo giao dịch thất bại" %}
{% code title="Tạo giao dịch thất bại" %}

```
{
"status": "018"
"message": "không tìm thấy course tương ứng với id trong trường"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

*\*Bạn có thể lấy Course\_ids tại đường dẫn URL khóa học của bạn*

![](/files/-LJC1vvkX9SoWgxxV1Xt)


---

# 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://support.hachium.com/kho-ung-dung/nha-phat-trien/create_transaction.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.
