This article describes how to set up the Payment Links SDK for Android.
Requirements
Step 1 | Import the SDK
To import the Android Payment Links SDK, add the following implementation to your build.gradle file:
implementation("com.appcharge:android-payment-links:1.3.0")
Then add the following to your settings.gradle file:
repositories {
mavenCentral()
}
In the Manifest file, add the necessary permissions to access the network state and enable incoming deeplink over HTTPS:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>
Next, add support for checkout activity and deeplink scheme:
<activity
android:name="com.appcharge.core.CheckoutActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="unspecified"
android:exported="true"
android:launchMode="singleTask"
tools:ignore="DiscouragedApi">
<!-- Custom scheme -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="acnative-{IDENTIFIER}"/>
<data android:host="action"/>
<data android:scheme="https"/>
</intent-filter>
</activity>
The intent-filter includes a scheme "acnative-{IDENTIFIER}". Change the {IDENTIFIER} to the last sequence of your package name. For example, if your package name is com.appcharge.mysupergame, the identifier will be mysupergame. This name must be lowercase with no spaces.