> 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;
