# Payment Request API

## :white\_check\_mark: Payment Request API Link

The link for payment button on merchant's web page to allow customer to activated Alipay Wallet payment process.&#x20;

:point\_right: Once Alipay payment process finished,  web browser will be redirected to the following returnURL  defined by the merchant according to its own business needs with receiving Alipay payment result. &#x20;

### :ballot\_box\_with\_check: API Link Request Parameter Data Format (Example)

```
https://mppay.ottpay.com/wapPay?merCode=××××&merchantId=××××&orderId=××××&operId=×××××&amount=××××&returnURL=××××&notifyURL=××××
```

### :ballot\_box\_with\_check: Request Parameters (need be URL encoded )

#### :asterisk\_symbol: Prefixed URL  &#x20;

```
https://mppay.ottpay.com/wapPay?
```

&#x20;:asterisk\_symbol: **merCode**

**merCode** is the merchant payment key. Once a merchant accept OTT Pay WeChat Official Account service , OTTPay operation team will send this code through welcome email.

#### :asterisk\_symbol: **merchantId**

**merchantId** is a merchant ID created by OTTPAY. Once a merchant starts OTTPAY payment service, OTTPAY operation team will send this ID through welcome email.

#### :asterisk\_symbol: orderId

**orderId** is a customized order ID provided by merchant. Once an order is placed, merchant need to send this order ID.

#### :asterisk\_symbol: amount

Amount of the order. Merchant need to send the amount to OTT server.&#x20;

**Note: The number is based on cents, which means 100 for 1.00 dollar.**

:asterisk\_symbol: **operId**&#x20;

**operId** is an operator number with 10-digit created by OTTPAY. Once a merchant starts OTTPAY payment service, OTTPAY operation team will send this ID through welcome email.

#### :asterisk\_symbol: **returnURL** (need be encoded with Base64)

**returnURL** is the link to the order processing page to be displayed by the merchant after the payment request is returned, which is defined by the merchant according to its own business needs. That is, after payment is completed, **Alipay** redirects back to this page of the merchant's website

```
returnURL=aHR0cHM6Ly93d3cub3R0cGF5LmNvbS9yZXN1bHQ= 
(Base64 encoded value of https://www.ottpay.com/result)
```

#### :asterisk\_symbol: **notifyURL** (need be encoded with Base64)

**notifyURL** is the callback URL of the merchant, which be called with the payment result from OTTPAY.

```
notifyURL=aHR0cHM6Ly93d3cub3R0cGF5LmNvbS9jYWxsYmFjaw== 
(Base64 encoded value of https://www.ottpay.com/callback)
```

#### :ballot\_box\_with\_check: Payment Link Request Example (need to be URL encoded)

```
https://mppay.ottpay.com/wapPay?merCode=66e201e8d8f9415be8eb9c1e6e0b308e&merchantId=ON00000097&orderId=2020060919257O266O1801&operId=0000000436&amount=1&returnURL=aHR0cHM6Ly9lenNob3BzLm90dC5jYS9tb2JpbGUvQWxpSDVPVFRQQVlfY2FsbGJhY2sucGhw&notifyURL=aHR0cHM6Ly9lenNob3BzLm90dC5jYS9tb2JpbGUvQWxpSDVPVFRQQVlfY2FsbGJhY2sucGhw
```

## :white\_check\_mark: Payment Return URL Link

After payment process finished,  the result will be sent back by redirecting to the following payment result Web Page URL link.

### :ballot\_box\_with\_check:Return URL Link Format

```
http://newURL/xxx?total_fee=XXXX&trade_no=XXXX&out_trade_no=XXXX&trade_status=XXXX
```

### :ballot\_box\_with\_check: Return URL Parameters (need be decoded with Base64)

#### :asterisk\_symbol: Prefixed URL

**Prefixed URL** is a customized page for order processing, /xxx is an additional page for the merchant according to their own business. e.g.

```
https://ezshops.ott.ca/mobile/AliH5OTTPAY_callback.php
```

#### :asterisk\_symbol:  total\_fee

**total\_fee** is the request amount of the order from the merchant. Number, 100 for 1.00 dollar.

#### :asterisk\_symbol: trade\_no

**trade\_no** is the internal order number returned from Alipay.

#### :asterisk\_symbol: out\_trade\_no

**out\_trade\_no** is the order number returned from Alipay.

#### :asterisk\_symbol: trade\_status

**trade\_status** shows the result of the payment. Payment succeed returns " **Trade\_Finished**".

#### :ballot\_box\_with\_check: Return URL Link Example (URL encoded)

```

https://ezshops.ott.ca/mobile/AliH5OTTPAY_callback.php?currency=CAD&out_trade_no=AL2192407938683822&total_fee=0.01&trade_no=2020061022001367651432273894&trade_status=TRADE_FINISHED&sign=aTTXuUU8DD4J11vwsu%2Bx%2FonuesJ%2Ba73bIXrDTgbOze1Df35H6x8cSt9Rk9b9hqQksF8QobWU7Zt0%2F0LbPYFSR9kI%2B5rVYQKSP%2Fgad97A89ySV7wi05jLmiRLVHySG131zTwren9XoS81Do13hFUkoTZfEQc745bTxvgDKIMrSRs%3D&sign_type=RSA

```

```
resposdwx:Array
(
    [currency] => CAD
    [out_trade_no] => AL2192407938683822
    [total_fee] => 0.01
    [trade_no] => 2020061022001367651432273894
    [trade_status] => TRADE_FINISHED
    [sign] => aTTXuUU8DD4J11vwsu+x/onuesJ+a73bIXrDTgbOze1Df35H6x8cSt9Rk9b9hqQksF8QobWU7Zt0/0LbPYFSR9kI+5rVYQKSP/gad97A89ySV7wi05jLmiRLVHySG131zTwren9XoS81Do13hFUkoTZfEQc745bTxvgDKIMrSRs=
    [sign_type] => RSA
)
```

## :white\_check\_mark: Payment Notify URL - 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 '**notifyURL**' 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":"j8RlS+SN18WS/nP5rypaQch/qMeTG78qu4hu9GIq66U2mVYQcDMS9OFgaSkFuOwQkxbMReOeksRwwSpsoKCny8Dk84d2OTPN08kpObZd0/C5p+zI5UY9bkq/Wm1KdqKVm/Rz7RELZCN498ersXCeyLwlweFK1KF0mVT1H0mV6nPAm/6lKcJ7oWa1jM9JEhzAjJQ5OstIjrPo+Prb/4XXQc/OU1FkNKhM6MVauN20RnY\u003d",
"rsp_code":"SUCCESS",
"rsp_msg":"success",
"merchant_id":"QC00005496",
"md5":"1E2E9E78906F85FFE17962A523329220"
}
```

#### :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, "100" for 1.00 dollar.                   |
|        tip        |       tip amount       |     N    |                   String, "100" for 1.00 dollar.                   |
| bizpay\_order\_id | order id from Acquirer |     Y    | Returned by the Payment Service Provider (e.g. WeChat Pay, Alipay) |
|    merchant\_id   |       Merchant ID      |     Y    |                         Provided by OTT Pay                        |

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

```
{
"amount":"1",
"bizpay_order_id":"AL5599135482523381",
"tip":"0",
"merchant_id":"QC00005496",
"order_id":"2020061019988O227O2154",
"finish_time":"2020-06-10 23:22:09"
}
```


---

# 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/alipay-h5/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.
