# API đăng ký gói cước viễn thông

## API lấy mã OTP&#x20;

## API dùng để lấy mã OTP đăng ký gói cước viễn thông

<mark style="color:green;">`POST`</mark> `https://api.dmall.com.vn/api-customer/public/order/partner/get-otp`

#### Headers

| Name                                      | Type   | Description                 |
| ----------------------------------------- | ------ | --------------------------- |
| api-key<mark style="color:red;">\*</mark> | String | Mã api-key dùng để xác thực |

#### Request Body

| Name                                          | Type   | Description                                            |
| --------------------------------------------- | ------ | ------------------------------------------------------ |
| phone<mark style="color:red;">\*</mark>       | String | Số thuê bao đăng ký gói cước                           |
| utmSource                                     | String |                                                        |
| utmMedium                                     | String |                                                        |
| utmContent                                    | String |                                                        |
| utmCampaign                                   | String |                                                        |
| productCode<mark style="color:red;">\*</mark> | Double | Mã gói cước nhà mạng cung cấp. Ví dụ **V200B**         |
| telcoCode<mark style="color:red;">\*</mark>   | String | Mã nhà mạng. Hiện tại hỗ trợ **VIETTEL**, **MOBIFONE** |

{% tabs %}
{% tab title="200: OK Tạo giao dịch thành công" %}

```json
{
	"data": {
		"orderCode": "DG20231113172059456724",
		"telcoTransId": "102996904"
	},
	"errorCode": 200,
	"message": "Tạo giao dịch thành công",
	"success": true,

}
```

{% endtab %}
{% endtabs %}

### Ví dụ&#x20;

{% tabs %}
{% tab title="RequestBody" %}

```json
{
	"telcoCode": "MOBIFONE",
	"productCode": "6C120",
	"phone": "0936004420",
	"utmCampaign": "",
	"utmContent": "",
	"utmMedium": "",
	"utmSource": ""
}
```

{% endtab %}

{% tab title="cURL" %}

```json
curl --location 'https://api.dmall.com.vn/api-customer/public/order/partner/get-otp'
--header 'api-key: 6vZNjMXffyBXCqqSw3dMULc5OZgSxZnN'
--header 'Content-Type: application/json'
--data '{ "telcoCode": "VIETTEL", "productCode": "MP5X", "phone": "0337880699", "utmCampaign": "", "utmContent": "", "utmMedium": "", "utmSource": "" }'
```

{% endtab %}
{% endtabs %}

## API đăng ký gói cước với OTP

## API dùng để đăng ký gói cước viễn thông qua OTP

<mark style="color:green;">`POST`</mark> `https://api.dmall.com.vn/api-customer/public/order/partner/register_with_otp`

#### Headers

| Name                                      | Type   | Description                 |
| ----------------------------------------- | ------ | --------------------------- |
| api-key<mark style="color:red;">\*</mark> | String | Mã api-key dùng để xác thực |

#### Request Body

| Name                                        | Type   | Description                                         |
| ------------------------------------------- | ------ | --------------------------------------------------- |
| otp<mark style="color:red;">\*</mark>       | String | Mã OTP nhận được ở tin nhắn gửi về                  |
| orderCode<mark style="color:red;">\*</mark> | String | Mã giao dịch nhận được khi tạo giao dịch thành công |

{% tabs %}
{% tab title="200: OK Đăng ký thành công" %}

```json
{
	"success": true,
	"errorCode": 200,
	"message": "Đăng ký gói cước thành công",
	"data": {
		"type": "CALL/SMS",
		"code": "MP5X",
	}
}
```

{% endtab %}
{% endtabs %}

### Ví dụ

{% tabs %}
{% tab title="RequestBody" %}

```json
{
	"orderCode": "DG20231113172847592599",
	"otp": "246595"
}
```

{% endtab %}

{% tab title="cURL" %}

```json
curl --location 'https://api.dmall.com.vn/api-customer/public/order/partner/register_with_otp' \
--header 'api-key: 6vZNjMXffyBXCqqSw3dMULc5OZgSxZnN' \
--header 'Content-Type: application/json' \
--data '{
    "orderCode": "DG20231113172847592599",
    "otp": "246595"
}'
```

{% endtab %}
{% endtabs %}

```json
```
