# Payment Request with Alipay

## :white\_check\_mark: Create Payment Request Link or Form

### :ballot\_box\_with\_check: Merchant payment button to generate payment request link&#x20;

The format and introduction of payment request link as followed: &#x20;

```
https://mppay.ottpay.com/webPay?merCode=××××&merchantId=××××&orderId=××××&operId=×××××&amount=××××&returnURL=××××&notifyURL=××××&submit_type=xxxx&remarks=xxxx
```

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

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

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

**merCode** is the payment code for merchants, it is generated with 16 digits random rode. Once a merchant starts OTTPAY payment 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 is the order amount. Once the customer places the order, the merchant need to send the amount.&#x20;

**Note: All the monetary measurement unit in API are CENT, which means 1 dollar = 100**

: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. It is required to have it Base64 encoded in the request.

```
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, that is, the link with the payment result from OTTPAY. It is required to have it Base64 encoded in the request.

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

#### :asterisk\_symbol: submit\_type

**submit\_type** is the flag for response format. If submit\_type=”scan”, OTT Pay will return a dynamic link, else if submit\_type=”form”, OTT Pay will return HTML form.

#### :asterisk\_symbol: remarks (optional)

**remarks** for the transaction input by client

### :ballot\_box\_with\_check: Return and the next action

:point\_right: If send with submit\_type=**scan**, then response is the **Payment Request Link.**

Example:

```
https://mppay.ottpay.com//webPay?merchantId=ON00000097&merCode=0728974bc0a30cd0df1e7f08a5229ce9&orderId&amount=1&operId=01&notifyURL=aHR0cHM6Ly91YXRxcnBheS5vdHRwYXkuY29tL2FjL3BheW1lbnRzUmVzdWx0&returnURL=aHR0cHM6Ly91YXRxcnBheS5vdHRwYXkuY29tL2FjL3BheW1lbnRzUmVzdWx0&submit_type=scan&remarks=feeforbooks
```

The next action: **redirect to Payment Request Link and start to pay**

:point\_right: If send with submit\_type=**form**, then response is **Form HTML**.

```
<form id="alipaysubmit" name="alipaysubmit" action="https://intlmapi.alipay.com/gateway.do?_input_charset=utf-8" method="get"><input type="hidden" name="secondary_merchant_industry" value="5734"/><input type="hidden" name="_input_charset" value="utf-8"/><input type="hidden" name="subject" value="(IT)OTTPAYTESTINGPRD"/><input type="hidden" name="sign" value="Wd0nU28k+2Tya716lf3Y338jUDAZGYyFVzebAeMyOJyDQlI7SEZk/QbR5ar/KpQLlmP2Q7A4diaUBepB/lZtTtocVZIsz3S2paz5u/mNmc//eVDp2t3If7yD1ILQ29mIckVSz+OOyFsl97dT4/D9jp892U7EIlszQDkha/OlWIwhFJ6fdxoPbvHDtpXIHXkYz+npu/JAavU4Jkn2SUsXNQMl8pssg8wqEpCPFKvHPl1xt+z+Zh612QXo8a5XdBco8S1pU/JR9cts5Qbo8rfHPRfPhDmHCD8ZNsjgs3VBnU6cGf1rC+v9OoYNwf9Mb3BHbi74gwJBdIz/zrEEDtfbtA=="/><input type="hidden" name="notify_url" value="https://scanpay.ottpay.com/online/notify/"/><input type="hidden" name="product_code" value="NEW_OVERSEAS_SELLER"/><input type="hidden" name="secondary_merchant_id" value="ON00000097"/><input type="hidden" name="out_trade_no" value="AL6144562719294777"/><input type="hidden" name="partner" value="2088721517311327"/><input type="hidden" name="service" value="create_forex_trade"/><input type="hidden" name="total_fee" value="0.01"/><input type="hidden" name="secondary_merchant_name" value="ON**97store1(NortrrrrrrrrrhYork)"/><input type="hidden" name="return_url" value="https://uatqrpay.ottpay.com/ac/paymentsResult"/><input type="hidden" name="currency" value="CAD"/><input type="hidden" name="sign_type" value="RSA"/><input type="submit" value="OK" style="display:none;"></form><script>document.forms['alipaysubmit'].submit();</script>
```

The next action: **embed and show the form on your page and start to pay**

## :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    |                               |
|    remarks   | Remarks for order |     N    |                               |

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

```
{
"merchant_id":"QC00005496",
"order_id":"2020061019988O227O2154",
"finish_time":"2020-06-10 23:22:09",
"remarks":"this is a remark"
}
```
