> For the complete documentation index, see [llms.txt](https://api.vietqr.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.vietqr.vn/vi/cac-dich-vu-api-khac/host-to-client/api-ecommerce-sync.md).

# API Ecommerce Sync

### <mark style="color:green;">`POST`</mark>

```
https://<vietqr-host>/<basepath>/api/ecommerce
```

**Request Headers**

<table><thead><tr><th width="225">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization</td><td>Basic Authentication: Base64[<code>username:password</code>]</td></tr></tbody></table>

**Request Body**

<table><thead><tr><th width="185">Field</th><th width="84">Type</th><th>Description</th></tr></thead><tbody><tr><td>ecommerceSite</td><td>String</td><td>Địa chỉ url của hệ thống ecommerce</td></tr><tr><td>checkSum</td><td>String</td><td><p>Chuỗi mã hóa checkSum MD5:</p><p><code>password</code> + <code>:</code> + <code>ecommerceSite</code> + <code>VietQRAccesskey</code></p></td></tr><tr><td>webhook</td><td>String</td><td>Webhook trả vể khi có thông báo BĐSD</td></tr></tbody></table>

**Response**

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

```json
{
  "webhook": "",
  "clientId": "ZTk2NjVmMTgtM2I3MC00YTUwLTkxZTItM2ZiMjAwOGNiMTM2VmlldFFSQm94QWNjZXNzS2V5",
  // clientId để nhận wss
  "certificate": "MER-ECM-MER37695058",
  // certificate hiển thị dưới dạng mã QR cho người dùng muốn đồng bộ  
  // tài khoản ngân hàng vào trang có thể quét
  "token": {
    "access_token": "eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwidXNlciI6IlkzVnpkRzl0WlhJdFltd3RkWE5sY2pBMSIsImlhdCI6MTcyNDQ3MTY3OX0.axvTVS5lFEZcjE3nWqDoJDw2plzRjTK86Q34LqsXvDkTvcJfBmfDWrkAfQiimMWGqYX4s0PaHAgYmpfJH3WDtQ",
    "token_type": "Bearer",
    "expires_in": 0
  }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "FAILED",
    "message": "mã_lỗi_và_mô_tả_lỗi"
}
```

{% endtab %}
{% endtabs %}

***

### Code mẫu

{% tabs %}
{% tab title="Request body" %}

```json
{
  "ecommerceSite": "https://www.google.com",
  "checkSum": "8a3439ca64d2394713e946f9f3677bb1",
  //HashMD5: 37256497631:https://www.google.comVietQRAccesskey
  "webhook": "https://www.google.com"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://api.vietqr.vn/vi/cac-dich-vu-api-khac/host-to-client/api-ecommerce-sync.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
