# Payment Request API

## :white\_check\_mark: API Request Parameter&#x73;**(HTTP-Request-Body )**

|    Params Name   |         Description        | Required |          Notes         |
| :--------------: | :------------------------: | :------: | :--------------------: |
|      action      |         Action name        |     Y    |           <p>          |
| <br> “H5PAY”</p> |                            |          |                        |
|      version     |       Version number       |     Y    |          "2.0"         |
|   merchant\_id   |         Merchant ID        |     Y    |   Provided by OTT Pay  |
|       data       | Encrypted Transaction Data |     Y    | See "Data" table below |
|        md5       |       Message Digest       |     Y    |                        |

:ballot\_box\_with\_check: **Request Example(JSON Data):**

```php
{
  "data": "M7Unit9a4Iw93M4g2u7fXwpV+ML9JvC5C7finCYY5TbWroDIkdLNxtrpNGTh IduqwHTuG1j28MQgXuwvPOhVLzdHD1M3x5+SzfZxn2r33z1u5JqwzpzEFwqm +kj5MJBxODYCR9IJ1NH6XtzdGbdcKiPczN/QW2sdZMJ0tw5ylWAZsPwuzUXn 2LbV7WXFKqEbiJXnxDmq9OR2XPsu95RLHOG8OUq8IMX0ZKbjqZ9gFZfELe5l VgIEGE8VgIADLMOWUkZq+SKeu1YDTWN7/igp7w5jpzV+IBdVLyIkjHtbfa3k SMNxS6585O58LYBEPHniAESz3TvxhWn7AZQQ/CSyzSeBKrMLtLdvqvnwF4dC xiMV4TRN+kO9iHhix6hSYgX5usCoDWXi5vn2H4rOCR0OJA==",
  "action": "H5PAY",
  "merchant_id": "ON00004652",
  "version": "2.0",
  "md5": "66717B7C144BE13962ACFA4E70EC1957"
}
```

#### :ballot\_box\_with\_check: Dat&#x61;**(JSON Data, to be encrypted):**

|    Params Name    |        Description        | Required |                                   Notes                                   |
| :---------------: | :-----------------------: | :------: | :-----------------------------------------------------------------------: |
|    merchant\_id   |        Merchant ID        |     N    |                                                                           |
|        <p>        |                           |          |                                                                           |
| <br> shop\_id</p> |          Shop ID          |     N    |                                                                           |
|       amount      |           Amount          |     Y    |                                Unit is cent                               |
|     order\_id     |          Order ID         |     N    | OrderID could be generated by merchant, or generated by OTTPay by default |
|   currency\_type  |    Transaction currency   |     Y    |        CAD/USD/CNY, MUST match to currency settings of merchant ID        |
|     biz\_type     |       Business type       |     Y    |                                “WECHATPAY”                                |
|      open\_id     | Customer Id in WeChat pay |     N    |                                                                           |
|    operator\_id   |        Operator id        |     Y    |                                                                           |
|    submit\_type   |           format          |     Y    |                                   “form”                                  |
|  call\_back\_url  |         Notify URL        |     Y    |                                                                           |

:ballot\_box\_with\_check: **Data Example(JSON Data):**

```
{
  "submit_type": "form",
  "shop_id": "ON00004652001",
  "amount": "5",
  "currency_type": "CAD",
  "open_id": "owv3d1YJwmzug7z2ozlPyqIItA7E",
  "operator_id": "0000000437",
  "biz_type": "WECHATPAY",
  "merchant_id": "ON00004652",
  "order_id": "20220510125455761",
  "call_back_url": "http://uatqrpay.ottpay.com/back_response"
}
```

## :white\_check\_mark: API Response Parameter&#x73;**(HTTP-Response-Body)**

| Params Name |    Description   | Required |          Notes         |
| :---------: | :--------------: | :------: | :--------------------: |
|  rsp\_code  |   Response code  |     Y    |   refer to Appendix B  |
|   rsp\_msg  | Response message |     Y    |                        |
|     data    |  Encrypted Data  |     Y    | See "Data" table below |
|     md5     |  Message Digest  |     Y    |                        |

:ballot\_box\_with\_check: **Response Example(JSON Data):**

```
{
  "rsp_code": "SUCCESS",
  "rsp_msg": "success",
  "data": "ZDfrLAMckA3fQ09ku7vT13Fz+mfWeGaGCmVmjRZ7vbQkoOJ0G91NbU+lI6Y83QUqcFXP4G36NVAhRKa25yA/d7LbWEPoFA0fOS07V7g9SR/ZllPaHxhNlbpn gvpQ/JP+ZAW3N2HRyziih0jBeFZam/rQwlMIWShy8wQJOBzN2xaXrovYlFG6 vnR0eY3xibpCmoFYqAng7xsY7r+epX03xEllL6NljU7bUlBfbhhK6FS9/Ch6 yBI+7uCE8vxtGnY7Jb3PZxFMMmjy6mjF6xCGTWXeZu9hpEi6Fk8dRgPtkUVx q9HK66pEkvWQwhtZQQ86",
  "md5": "A62FE1E70F48B2063F9B6F325C2DE4E2"
}
```

#### :ballot\_box\_with\_check: Transaction Data(JSON format, After decrypted)

|   Params Name  |  Description | Required | Notes |
| :------------: | :----------: | :------: | :---: |
|    order\_id   |   Order ID   |     Y    |       |
|  merchant\_id  |  Merchant ID |     Y    |       |
|     amount     |    amount    |     Y    |       |
|     payinfo    |   MWEB link  |     Y    |       |
| time\_zone\_id | Time zone ID |     Y    |       |

:ballot\_box\_with\_check: **Data Example(JSON Data, after decrypted):**

```
{
  "payInfo": "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx11005622308524e27996e33df495fc0000&package=3129796039",
  "merchant_id": "ON00004652",
  "order_id": "20220510125455761",
  "amount": 6,
  "time_zone_id": "America/Toronto"
}
```

Note: The **amount**=6 contains the 1 cent “convenience fee” addition to the original **amount**=5

{% hint style="info" %}
Merchant web site adds redirect URL to **payinfo**, and use it to redirect the client to WeChat mobile app’s payment page
{% endhint %}

## :white\_check\_mark: API Call Back (**HTTP-POST**)

{% hint style="info" %}
Once API server finished the request process, it will send back process status to specified URL which been set up as field of '**call\_back\_url**' within above API request parameters.
{% endhint %}

### :ballot\_box\_with\_check:Message Payload Parameters Level **(HTTP-Response-Body)**

|  Params Name |         Description        | Required |          Notes         |
| :----------: | :------------------------: | :------: | :--------------------: |
|   rsp\_code  |        Response code       |     Y    |   refer to Appendix B  |
|   rsp\_msg   |      Response message      |     Y    |                        |
| merchant\_id |         Merchant ID        |     Y    |                        |
|     data     | Encrypted Transaction Data |     Y    | See "Data" table below |
|      md5     |       Message Digest       |     Y    |                        |

:ballot\_box\_with\_check: **Call-Back Message Example(JSON Data):**

```
 {
  "data":"hy0yiXxPH4TDXeY5ET7gqIsUcgY5ykO1vQYOahS5SsbN7/5Ha7+hvcXhgY1hz9kHuf5OxqNfv28kVeiYACrLzngk+hA2o8dVAcifT6h3AquN5micrIi3L9owj6cHT1nJRExC74sNUqF8CDY5fb4jLh9it9tq7r8xFOpcpf19VNWceo/Jt1nHca6HPMvMUEDeX1aUjnxOs7R7B2TUQbAENg\u003d\u003d",
  "rsp_code":"SUCCESS",
  "rsp_msg":"success",
  "merchant_id":"QC00005496",
  "md5":"F70CA0472D1AAA596E720C19A1DD36A0"
 }

```

#### :ballot\_box\_with\_check: Transaction Data (JSON format, after decrypted)

|    Params Name    |       Description      | Required |                                Notes                               |
| :---------------: | :--------------------: | :------: | :----------------------------------------------------------------: |
|    finish\_time   |      Payment time      |     Y    |                    yyyyMMddHHmmss (Beijing time)                   |
|     order\_id     |        Order ID        |     Y    |                                                                    |
|       amount      |   Transaction amount   |     Y    |                String(e.g.  "100" for 1.00 dollars)                |
|        tip        |           tip          |     N    |                String(e.g.  "100" for 1.00 dollars)                |
| bizpay\_order\_id | order id from Acquirer |     Y    | Returned by the Payment Service Provider (e.g. WeChat Pay, Alipay) |
|      remarks      |         remarks        |     N    |                                                                    |
|     sale\_num     |  Merchant sale number  |     N    |                         Provided by OTT Pay                        |
|  convenience\_fee |     Convenience fee    |     N    |                                                                    |


---

# 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://docs.ottpay.com/payment-api/api-for-mobile-browser-with-wechat/payment-request-api.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.
