Auto Debit Integration Guide for Google
Auto Debit occurs when a user purchases merchandise on a merchant platform and the merchant deducts funds from the user's account by using an access token. To use this payment product, the merchant must obtain the user's authorization in advance.
For Auto Debit payment for Google, the Alipay+ Android SDK encapsulates Google's Android APK Authentication API, so the authorization process is simplified.
Help the user to handle the authentication process on the MPP side.
Before you begin
Make sure that you have added the Alipay+ Android SDK to your project. For more information about the installation procedures, see Get Started. You also need to implement showAuthPage API and getAuthCode API.
Declare the activity for Auto Debit payment for Google
According to Google's document on Android Authentication, for Android native authentication, the integrator should implement an Android activity. But if you integrate Alipay+ Android SDK, which has already implemented the activity, you only need to declare the activity in Alipay+ Android SDK as follows in your AndroidManifest.xml file：
The full process of Auto Debit payment for Google is:
- The user chooses the target MPP in Google Play.
- The user triggers the process of signing the contract in Google Play.
- Google Play jumps to MPP APP's activity which is implemented by Alipay+ Android SDK.
- If the authorization URL is constructed by MPP, Alipay+ Android SDK will call MPP's getAuthCode API to get the auth code. If the authorization URL is constructed by Alipay+, Alipay+ Android SDK will first call showAuthPage API to obtain the referenceAgreementId and then call getAuthCode API to get the auth code.
- Alipay+ Android SDK returns the result of signing contract process to Google Play at Google's request.