# Sample request

## Overall access steps

Step 1: Resolve the domain name first

Step 2: Create application to submit public key and get app\_id/rsa\_saas\_pub, configure callback address.

Step 3: The user is authorized to register, and obtains the three-party merchant code

Step 4: Get the open platform counter-question token by code

Step 5: Access to open resources:

## Preparation - Get appKey and set redirectUrl( callback address )

Open Platform is an OAuth2.0 authorization login system built based on OAuth2.0 protocol standard. Before accessing the open platform, you need to prepare the following access materials through the management background:

1. appKey: Used to bind one-to-one with the UID of the merchant who opened the open platform, which is necessary to obtain the login permission of the open platform;
2. redirectUrl: The address to be used to jump to after the successful opening of an authorized account on the open platform; this address is filled in according to the actual business needs, if you do not know the business needs, you can fill in the exchange home page by default.;

Login to the administration background: Public Administration--> Open Platform Management--> Application Management

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2Fo6S4VIh9UNKbwp7rV0c7%2Fimage.png?alt=media\&token=c4d9f291-32a7-493f-84cc-caed440c81b7)

Submit the public key according to the content in the red box

<figure><img src="https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2F6libJ5p5vD4HxLG3YQnT%2Fimage.png?alt=media&#x26;token=0e485188-b1d4-4fd0-855b-77a20d102410" alt=""><figcaption></figcaption></figure>

User Registration Authorization - OAuth Authorization Login Page

Click Register with the correct appkey and redirectUrl

Browser access address: [http://service.xxx.com/platform/login.html?appKey=xxx\&redirectUrl=https:xxxx](http://platform.apple.com/?appKey=apple_6746\&redirectUrl=https://www.chainup.com)

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FKp8Aer0xtAIGWnGT6bfE%2Fimage.png?alt=media\&token=caa58015-ef36-4251-bbcf-a0a8bce083dc)

If you are not registered, register first; if you are already a registered user, just click the "Confirm Authorization" button in the previous image

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2F5ULDFd95ussFwIPPiIW6%2Fimage.png?alt=media\&token=421ed495-ee4b-49c5-89df-be2464b18070)

The system will send a verification code for authorization

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FZnyqtGuAjoleEVm6eyez%2Fimage.png?alt=media\&token=4131e401-b1c3-4b4a-b036-4477befc26b9)

Register (or login) to get the code successfully

If you fill in the first step of the registration callback address is the home page of the exchange; then you can see the following image, the arrow is the current Code obtained

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FIJBggKlTSxOO6fG1Bv76%2Fimage.png?alt=media\&token=6dbfc8d6-6c4f-4d5b-89c0-1afbe4ded5fa)

## Get token - Get token and openId by code

#### Call the interface for a token or openId

Interface Address: <http://servoce.xfnh.com/platformapi/chainup/open/auth/token>

## Access to open platform resources via Token - create order/pay/inquire order

#### Create a payment order

Interface Address: <http://service.xfnh.fnhcom/platformapi/chainup/open/opay/createThirdOrder>

<mark style="color:red;">**Note!!! openId and userId can only exist one, if both exist at the same time, openId is preferred.**</mark>

Payment Page

Interface Address: <http://service.xfnh.com/pay.html>

#### Get the request parameters::

Login to the administration background: Public Administration--> Open Platform Management--> Application Management

Get the userId of the request parameter as shown in the image

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FXLGweY923yrsewmd0oR0%2Fimage.png?alt=media\&token=86159676-477d-43ba-ac26-25d6ad959efa)

Use POSTMAN tool to get the interface call address

The address of the interface call after assembling the parameters: [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)

Engineers who are familiar with GET requests can directly follow the parameters to assemble the address to access

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FSsVpgNviAoalHYH7ggjj%2Fimage.png?alt=media\&token=58c3415d-fb6b-4e70-b6b8-7d7e5a853b63)

#### Calling the request payment page:

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2Fm6RUYiyFnfyPYE9nJTOr%2Fimage.png?alt=media\&token=46daf9c8-eef4-4ed4-86b2-fe25736d3656)

Insufficient balance in the management platform to recharge the coins ( if the balance is sufficient, you can ignore this step )

Asset Management -- > Financial Management -- > Coin Grant Tool

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FH94dBtN6fc0epctl2w0R%2Fimage.png?alt=media\&token=90fa9f02-f266-46d5-89e9-a29a82454309)

The page that will be redirected after successful payment ( the page is the redirectUrl configured in the first step )

![](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FYAJcUHYTo8nHMaMQWO3H%2Fimage.png?alt=media\&token=a59727be-e2fc-4002-bcfa-2995ea9e43e9)

Check Payment Order

Interface Address：<http://service.xfnh.com/platformapi/chainup/open/opay/orderDetail>

Use POSTMAN tool to get the interface call address;

![返回结果即为查询成功后订单信息](https://3422565439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ12JnMKxsBgT55xBjIjw%2Fuploads%2FJtrKCRy3EcJhL0djvSmB%2Fimage.png?alt=media\&token=036b996f-a3cd-442f-a2e3-fb150d9b1f52)
