> For the complete documentation index, see [llms.txt](https://docs.ottpay.com/payment-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ottpay.com/payment-api/in-app-alipay/payment-request-api.md).

# Payment Request with OTT Pay SDK

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

### :ballot\_box\_with\_check: **Parameters of API**

| **Params Name** | **Description**                            | **Required** | **Notes**                           |
| --------------- | ------------------------------------------ | ------------ | ----------------------------------- |
| server\_url     | OTT Pay in App API URL                     | Y            | <https://mppay.ottpay.com/inAppPay> |
| amount          | Transaction amount in cent                 | Y            | string, "100" for 1.00 dollar.      |
| bizType         | Business type                              | Y            | string, "ALIPAYONLINE"              |
| merchant\_id    | Merchant ID in OTT PAY                     | Y            | Provided by OTTPay                  |
| shop\_id        | OTT PAY store id，optional for future usage | N            | String                              |
| operator\_id    | Operator ID from OTT PAY                   | Y            | String , Provided by OTTPay         |
| order\_id       | Your own order id                          | N            | String, Your own order id           |
| call\_back\_url | Call back URL                              | Y            | Call back data from OTT Pay,        |

### :ballot\_box\_with\_check: **Request Code Example(Android)**

```
/**
call alipay sdk pay. 调用 SDK 支付
*/
public void pay(View v) {
 String server_url = "https://mppay.ottpay.com/inAppPay"; //OTT Pay inApp API URL
 String merchant_id= "ON00000097"//OTT PAY merchant id
 String shop_id= "";//OTT PAY store id，optional for future usage
 String operator_id= "";//OTT Pay operator Id
 String currency= "CAD"; //currency “CAD” or ”USD”
 String amount = "100"; //pay amount in cents
 String call_back_url= "https://www.eshops.com/call_back"; //call back URL
 String biz_type = “ALIPAYONLINE”; //if currency “USD”，using “APUSDONLINE”
 order_id = "123456"; // your own order id
 ConsumeStarter starter = new ConsumeStarter();
 
 starter.setOnCompleteListener(new OnCompleteListener() {
  @Override
  public void onComplete(String rspString) {
    Toast.makeText(MainActivity.this, rspString,
    Toast.LENGTH_SHORT).show();
  }
  });
  starter.consumeImp(MainActivity.this, server_url, merchant_id,
        shop_id, operator_id, currency, amount, order_id, call_back_url, biz_type);
}
```

## :ballot\_box\_with\_check: **Call-Back Message Data**

| **Params Name** | **Description**            | **Required** | **Notes**                     |
| --------------- | -------------------------- | ------------ | ----------------------------- |
| rsp\_code       | Response code              | Y            | Refer to Appendix B           |
| rsp\_msg        | Response message           | Y            |                               |
| merchant\_id    | Merchant ID                | Y            | Merchant ID                   |
| **data**        | Transaction Data Encrypted | y            | refer to **Data** table below |
| finish\_time    | Payment time               | Y            | YYYYMMDDHHMMSS (Beijing time) |
| order\_id       | Order ID                   | Y            |                               |
| amount          | Transaction amount         | Y            | String, "100" for 1.00 dollar |
| 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    |                                your                                |
|       amount      |   Transaction amount   |     Y    |                    string, "100" for 100 dollar.                   |
|        tip        |       Tip Amount       |     Y    |                    string, "100" for 100 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":"AL781266859681754",
 "tip":"0",
 "merchant_id":"QC00005496",
 "order_id":"2020041553699O153O0407",
 "finish_time":"20200416050429"
}
```

:point\_right: Call back data中的 **data**是加密过的数据，参考appendix A进行解密处理。

&#x20;        **Data** in Call back data in encrypted, refer to appendix A for decryption.

:point\_right: **Please reference our Android demo code for details.**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ottpay.com/payment-api/in-app-alipay/payment-request-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
