# Payment Request API

## :white\_check\_mark: **Process Flow Diagramima**

<figure><img src="https://1288750261-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ld5XVMQHp74noDIXTus%2Fuploads%2FqNiVJAscsjl6SIRcCd5e%2Felavon%20hosted%20payment.png?alt=media&#x26;token=14201a2f-83e8-49dc-8756-e14ad138c9c0" alt=""><figcaption></figcaption></figure>

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

|                                               Params Name                                               |          Description         | Required |          Notes         |
| :-----------------------------------------------------------------------------------------------------: | :--------------------------: | :------: | :--------------------: |
|                                                  action                                                 | Action name (Constant Value) |     Y    |           <p>          |
| <br> “<strong>CC\_PURCHASE</strong>” /</p><p>“<strong>CC\_PREAUTH</strong>” (for pre-authorization)</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
{
    "action":"CC_PURCHASE",
    "version":"2.0",
    "merchant_id":"QC00005496",
    "data": "zTadPG0YM4gD1WOFqxg7wn3vmU20NjCnCUOOnE9mTTkxYraQDflljA8W3azYG9MuOvOyl3cZhafH+io6PiWdZCwRmi3HGa19BvT215IIxRy2HvYe0Sqs2lxshm9E4y5F1gJ7HHMTqpY0wIA4DsuWA97UC55adB2G86VbanI7B5a3kErApr5mbAoE7wcNbDJfGh4CBbSoRxQyiGZ48SvYuIW/sclT4yu6okjo6CY3xL4=",
    "md5":"6AFB2E94A70D9A208F101723700EB287"
}
```

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

|      Params Name      |            Description            | Required |                                                                      Notes                                                                     |
| :-------------------: | :-------------------------------: | :------: | :--------------------------------------------------------------------------------------------------------------------------------------------: |
|        orderId        |              Order ID             |     N    | String, Order ID should be unique, it could be generated by OTTPAY or generated by client’s code with no more than of 20 numbers and alphabets |
|          <p>          |                                   |          |                                                                                                                                                |
| <br> merchant\_id</p> |            Merchant ID            |     Y    |                                                           String, Provided by OTTPAY                                                           |
|      operator\_id     |            Operator ID            |     Y    |                                                           String, provided by OTTPay                                                           |
|        txnTime        |          Transaction Time         |     Y    |                                                         String, format “yyyyMMddHHmmss”                                                        |
|         txnAmt        |         Transaction Amount        |     Y    |                                                          String, "100" for 1.00 dollar                                                         |
|        frontUrl       |       Redirect notification       |     Y    |                                               String, e.g. <http://purchase.merchant.com/notify>                                               |
|        backUrl        |           Call back URL           |     Y    |                                              String, e.g: <http://purchase.merchant.com/callback>                                              |
|      channelType      | UnionPay Payment Channel identity |     Y    |                                                                  "ELAVONECOM"                                                                  |
|       biz\_type       |           Message Digest          |     Y    |                                                             "&#xD;converge\_hosted"                                                            |
|    cc\_channelType    |          Payment Channel          |     Y    |                                                                      "web"                                                                     |

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

```
{
  "orderId":"2020041468976O124O000857",
  "merchant_id":"ON00000097",
  "operator_id":"0000020156",
  "txnTime":"20191125162635",
  "txnAmt":"100",
  "cc_number":"5160736813962037",
  "frontUrl":"https://www.ezshops.ca/UPI_OTTPAY_result.php",
  "backUrl":"https://www.ezshops.ca/UPI_TTPAY_callback.php",
  "channelType":"ELAVONECOM",
  "bizType":"converge_hosted",
  "cc_channelType":"web"
}
```

## :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":"RqlbPF0gZ0VnGnpQPnO/v1FSeVY81iMrJd0ejTx+g8Bj8y3XImosyzBF75PW LxyHffCAidLCVxW7lfr60lHVK9FtsEP+V0F1Wp6xDW0ZnJyCpC6inmC9i4NV iEqo50yGS4vtaf+mHz6ZtoWtn9ihYNAOEr1grr/F684cJ+f0D4ZaAkdkI5HV H4BTUPG78lAiJqv1hNmYZIIDucxxyghKFAEdgrfkM13f6Jig9CIHhXW8Xkfl nVSEoVz6v63jX2NS1Ls0bAZTeJC9YFS/hkTjbloaR7hvKU+zx5SZrhGNpjTX OjpKopp57IzWMd4LF4TgXsV8Eqib/ygz6n6wJ5zR6HtcWexC0DnxVoE0DMAz FW3cIIsCDLVkw++eZAZohk6e+Zpbke82apdigJm8xtLam5Esn2N3khpBFpfu oQ3LTPqKnj9mxjUtm/slblJ+ve3hOQ6ZA01QJHBEOxx4UJgm+pTxdyIQuRAH 7Df8XIfP0NE=",
"md5":"3D3B2F0000EFBF3427A5A67E656E838B"
}
```

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

| Params Name |    Description   | Required |                                                  Notes                                                  |
| :---------: | :--------------: | :------: | :-----------------------------------------------------------------------------------------------------: |
|   respcode  |     rsp Code     |     Y    |                       Returned by the Payment Service Provider (e.g. "PROCESSING")                      |
|   respmsg   | response Message |     Y    |                                            e.g. "User paying"                                           |
|   codeUrl   |   redirect link  |     Y    | dynamic link with access token that will be redirect the client browser to Elavon’s hosted payment page |
|    amount   |      amount      |     Y    |                                    String(e.g.  100 for 1.00 dollars)                                   |

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

```
{
"bizType":"000201",
"orderId":"20200330171617",
"encoding":"UTF-8",
"respcode":"SUCCESS",
"txnTime":"20200331051624",
"respmsg":"??[0000000]",
"merId":"ON00000001",
"tn":"846928574863970942520"
}
```

## :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          |     Y    |                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) |
|    merchant\_id   |       Merchant ID      |     Y    |                         Provided by OTT Pay                        |
|  convenience\_fee |     Convenience fee    |     O    |                                                                    |

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

```
{
 "amount":"1",
 "bizpay_order_id":"AL781266859681754",
 "tip":"0",
 "merchant_id":"QC00005496",
 "order_id":"2020041553699O153O0407",
 "finish_time":"20200416050429",
 "convenience_fee":"0"
}
```
