# 调用示例

## 整体接入步骤

第一步:先找运维解析域名

第二步:创建应用提交公钥并获取 app\_id/rsa\_saas\_pub, 配置回调地址;

第三步:用户授权注册, 获取三方商户code;

第四步:通过code获取开放平台访问token;

第五步:访问开放的资源:

## 准备工作 - 获取 appKey 和设置redirectUrl( 回调地址 )

开放平台是基于OAuth2.0协议标准构建的OAuth2.0授权登录系统。 在进行开放平台授权登录接入之前，需要通过管理后台准备以下接入材料:

1. appKey: 用于和开通开放平台的商户UID进行一对一绑定, 获取开放平台登陆权限的必要条件;
2. redirectUrl: 用于完成开放平台开通授权帐号成功后的跳转地址; 该地址根据实际业务需求填写, 如不清楚业务需求, 可默认填写交易所主页;

#### 登陆管理后台: 公共管理-- > 开放平台管理-- > 应用管理

![](/files/6twNOE37UrDBLM1UV6sB)

根据红框中内容, 提交公钥

<figure><img src="/files/BhLvUzHtoaUBoRqCxETO" alt=""><figcaption></figcaption></figure>

#### 用户注册授权 - OAuth授权登录页

带上正确的appkey和redirectUrl点击注册

浏览器访问地址: [http://service.xxx.com/platform/login.html?appKey=xxx\&redirectUrl=https:xxxx](http://platform.apple.com/?appKey=apple_6746\&redirectUrl=https://www.chainup.com)

![](/files/RrFC7C2YqjeSydzOuZgV)

如果没有注册, 先进行注册; 如果已经是注册用户, 则直接点击上一张图片中的"确认授权" 按钮即可;

![](/files/iuz7xKrCUmbsxJlrD9gc)

系统会发送验证码进行授权;

![](/files/pFcxWI0sL4Uf5Zv6tAJM)

#### 注册( 或登陆 )成功获取code

且在第一步中填写的注册回调地址为交易所首页; 则可以看到下述图片, 箭头处则为当前获取的Code

![](/files/57oD00lKuZiZQqUONPIT)

## 获取token - 使用code换取token、openId

#### 调用接口换取token或openId

接口地址: <http://servoce.xfnh.com/platformapi/chainup/open/auth/token>

接口调用成功后, 返回信息会携带token和openId

## 通过Token访问开放平台资源 - 创建订单/支付/查询订单

#### 创建支付订单

接口地址: <http://service.xfnh.fnhcom/platformapi/chainup/open/opay/createThirdOrder>

<mark style="color:red;">**注意!!!**</mark> <mark style="color:red;">**openId 和userId 只能存在一个,如果都同时存在 优先选择openId**</mark>

支付页面

接口地址: <http://service.xfnh.com/pay.html>

#### 获取请求参数:

登陆管理后台: 公共管理-- > 开放平台管理-- > 应用管理

根据图片所示获取请求参数中的userId

![](/files/wA2bna3eAkwKtL7U7Is5)

使用POSTMAN工具获取接口调用地址

拼装完参数后的接口调用地址: [https://service.xxx.com/pay.html?appKey=xxx\&openId=xxx\&token=xxx\&orderNum=xxx](https://platform.xxx.com/pay.html?appKey=xxx\&openId=xxx\&token=xxx\&orderNum=xxx)

如果熟悉GET请求的工程师可以直接按照参数拼装地址访问

![](/files/hilPrGkwp3dtRrtNxUpT)

#### 调用请求支付页面:

![](/files/oR5dvXATkHv0EmsD4pA9)

#### 余额不足在管理平台充值增币 ( 如果余额充足可忽略该步 )

资产管理-- > 财务管理 -- > 赠币工具

![](/files/skDUirVI8NfbJx0D6BI9)

#### 支付成功后跳转的页面( 该页面为第一步配置的 redirectUrl )

![](/files/huvuSDrC1ntYIUWrK74L)

#### 查询支付订单

接口地址：<http://service.xfnh.com/platformapi/chainup/open/opay/orderDetail>

使用POSTMAN工具获取接口调用地址;

![返回结果即为查询成功后订单信息](/files/skJKagyrRwoo05sx1Pk2)


---

# 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://platformv2docs.chainup.com/diao-yong-shi-li.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.
