Payment Web API
  • Payment API Solutions Map
  • API Common Specifications
  • Payment Status Query API (Common)
  • Refund & Refund Query API (Common)
  • Query Exchange Rate API (Common)
  • Payment Process Flow with Mobile App (Common)
  • API for PC Browser with Wechat Pay/Alipay/UnionPay
    • Payment Request with WeChat Pay
    • Payment Request with Alipay
    • Payment Request with UnionPay-SecurePay
      • Query Transaction with UnionPay-SecurePay
  • API for WeChat Browser with WeChat Pay
    • Payment Request API
    • Query Transaction with WeChat Pay
  • API for WeChat Mini-Program with WeChat Pay
    • Payment Request API
    • Query Transaction API
  • API for Mobile Browser with Alipay
    • Payment Request API
    • Query Transaction API
  • API for Mobile Browser with WeChat
    • Payment Request API
    • Query Transaction API
  • API for Mobile with UnionPay-SecurePay
    • Payment Request API
    • Query Transaction API
    • Code Samples(Web App, Android, iOS)
  • API for Mobile App with WeChat Pay
    • Payment Request API
    • Query Transaction API
  • API for Mobile App with Alipay
    • Payment Request with OTT Pay SDK
    • Implementation with Android App SDK
    • Implementation with iOS App SDK
  • API for In-Store Channels(via Merchant POS/Terminal)
    • API Process Flows
    • Payment Request API
    • Query Transaction API
  • API for Elavon Converge-Hosted payment
    • Payment Request API
    • Query Transaction API
  • API for Global payments PORTICO Ecomm Payment
    • Payment Request API
    • Query Transaction API
  • API for Checkout payment
    • Payment Request API
    • Query Transaction API
  • Appendix A (Data Encryption / Decryption)
  • Appendix B (Response Code)
  • FAQ
  • > Back to Top Page
Powered by GitBook
On this page
  • Import the SDK aar into your Android project
  • Implement the SDK in your Android project

Was this helpful?

  1. API for Mobile App with Alipay

Implementation with Android App SDK

PreviousPayment Request with OTT Pay SDKNextImplementation with iOS App SDK

Last updated 4 years ago

Was this helpful?

Import the SDK aar into your Android project

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

• Choose “import .JAR/.AAR Package”

• Browse to path of the file “sdk-alipay_release.aar”, select it by click “OK”, then“finish”

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

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

• implement the payment SDK as following the code sample


/**
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);
}

Implement the SDK in your Android project

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.

Here is the sdk for android app for download

✅
☑️
👉
✅
291KB
androidsdk-ottalipay_release.zip
archive
API SDK for Android App