# Overview

OpenApi是AsiaBill提供到第三方合作平台，为解决平台运营以及商户数据信息获取的行业解决方案。

## 流程介绍

我们使用[OAuth 2.0](https://tools.ietf.org/html/rfc6749)授权您访问我们的API接口

{% hint style="info" %}
注意需要联系Asiabill客服人员，先在Asiabill添加上您机构的client\_id
{% endhint %}

![授权流程图](/files/dMU0cjDWCXB9UlAhrHl4)

### 一、页面获取授权码 <a href="#shou-quan" id="shou-quan"></a>

1.先通过浏览器访问[申请授权码接口](/openapi/shou-quan-jie-kou.md#shen-qing-shou-quan-ma)，进行用户授权操作，如果在用户未登录的情况下，会跳转到用户登录页面

![用户登录页面](/files/1Xrkdzu90Cca1tGGXa3z)

登录信息必须是该商户的超级管理员信息

| 表单字段       | 描述                 |
| ---------- | ------------------ |
| merchantId | 支持商户号和网关号（目前使用商户号） |
| username   | 用户名                |
| password   | 密码                 |

登录完成后会跳转到用户授权界面

<div align="left"><img src="/files/8TRNFKgDDTCSJoGuqzfF" alt="用户授权界面"></div>

用户授权后，会跳转到商户设置的 redirect\_uri 路径，并且会带上code参数和商户号，合作伙伴根据商户号去关联code，例如：

![](/files/TgdSvXwrFch5md319DSA)

redirect\_uri 路径最好是商家服务器接口，商家获取到code后，[获取access\_token](/openapi/shou-quan-jie-kou.md#huo-qu-accesstoken)接口成功后，再返回到界面显示成功

### 二、获取access\_token

在上一步获取到code值后，调用[`获取access_token接口`](/openapi/shou-quan-jie-kou.md#huo-qu-accesstoken)`，获取到的`access\_token 最好保存起来，目前 access\_token 是长期有效的，建议加密保存，避免泄露

## 开通三方平台账号

请联系 AsiaBill 官方客服，来开通 client\_id 以及设置 client\_secret，并且需要提供商家logo

## 环境地址

### 测试环境

oauthUrl：<https://auth-uat.asiabill.com>

openApiUrl：<https://api-uat.asiabill.com>

### 生产环境

oauthUrl：[https://oauth.asiabill.com](https://auth-sandbox.asiabill.com)

openApiUrl：[https://openapi.asiabill.com](https://api-sandbox.asiabill.com)

## 访问接口请求头

<table><thead><tr><th width="150">请求头字段名</th><th>请求头说明</th></tr></thead><tbody><tr><td>authorization</td><td>access_token，格式：Bearer ACCESS_TOKEN</td></tr><tr><td>request-id</td><td>请求id，30分钟之内唯一</td></tr><tr><td>request-time</td><td>请求时间（格式 yyyy-MM-dd'T'HH:mm:ss ，该时间为当前时间正负30分钟内）</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://asiabill.gitbook.io/openapi/overview.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.
