> 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/android-dev-enviroment.md).

# Implementation with Android App SDK

### :white\_check\_mark: Import the SDK aar into your Android project

![](/files/-M6kPnsSJ4gz_lM8AbRY)

#### &#x20;In Android Studio, choose File→Project Structure→Dependencies • In “Modules”panel, choose “+”

• Choose “**import .JAR/.AAR Package**”

![](/files/-M6kR-QFgL5-8JCyRhHU)

• Browse to path of the file “**sdk-alipay\_release.aar**”, select it by click “OK”, then“finish”&#x20;

![](/files/-M6kR_sUSTYPCQkYTlBb)

• The package will be imported to the project as dependency of your app in your Android project&#x20;

![](/files/-M6kRm9P_nCbnZG-hxqM)

### :white\_check\_mark: Implement the SDK in your Android project

• In you payment activity, import **com.ottpay.sdk.\***

• implement the payment SDK as following the code sample&#x20;

```

/**
call alipay sdk pay. 调用 SDK 支付
*/
public void pay(View v) {
 String server_url = //OTT Pay inApp API URL
 String merchant_id= //OTT PAY merchant id
 String shop_id= //OTT PAY store id，optional for future usage
 String operator_id= //OTT Pay operator Id
 String currency= //currency “CAD” or ”USD”
 String amount XXXXXXXXXXXXXXXXXX//pay amount in cents
 String call_back_url=XXXXXXXXXXXXXXXXXX//call back URL
 String biz_type = “ALIPAYONLINE” //if currency “USD”，using
“APUSDONLINE”
 order_id = XXXXXXXXXXXXXXXXXX // your own user 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: Replace the server\_url, merchant\_id, operator\_id with the values from OTT PAY. Create an instance of **ConsumeStarter**, set the OnCompleteListener, and then invoke the **consumeImp** method to activate the payment page in your mobile’s Alipay app.

![](/files/-M6kTog9YXGtM4sChkwH)

:point\_right: Here is the sdk for android app for download

{% file src="/files/-M6leU6KsRFcevbvXhGM" %}
API SDK for Android App
{% endfile %}

&#x20;


---

# 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/android-dev-enviroment.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.
