Applies to: In-App Payments SDK - Android | In-App Payments SDK - iOS
Learn how to add the In-App-Payments SDK to your mobile development environment.
Applies to: In-App Payments SDK - Android | In-App Payments SDK - iOS
Learn how to add the In-App-Payments SDK to your mobile development environment.
To use the example code in this guide, make sure you have your Square application ID. Find your application ID on the Credentials page of your Square application in the Developer Console.
The In-App Payments SDK is supported in the Square Sandbox.
Add the Square SDK public repository in the build.gradle file for your project.
repositories {
google()
maven {
url 'https://sdk.squareup.com/public/android'
}
}
Add a compile option to support Java version 1.8 in the build.gradle file for your :app
module.
android { ... compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ... }
Add the In-App Payments SDK dependency to the module build.gradle file.
dependencies {
implementation "com.squareup.sdk.in-app-payments:card-entry:REPLACE_WITH_LATEST_IAP_SDK_VERSION"
}
Update the ProGuard-rules.pr file in the solution application folder to apply rules to In-App Payment SDK classes.
-keep class sqip.** { *; }
To configure the In-App Payments SDK, you must set the Square application ID for your application in AndroidManifest.xml. Open the AndroidManifest.xml file for your application Gradle module and add the following XML to set the application ID.
To test an application in the Square Sandbox, set the Developer Console to Sandbox Settings mode before completing the following instructions in this step:
Copy your application ID from the Credentials page.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
...>
<meta-data
android:name="sqip.SQUARE_APPLICATION_ID"
android:value="REPLACE_WITH_YOUR_SQUARE_APPLICATION_ID"/>
</application>
</manifest>
If AndroidManifest.xml doesn't already have application permissions set, add the following two permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Now that the In-App Payments SDK is installed, use one of the following build guides to add it to your mobile application:
If you need more assistance, contact Developer and App Marketplace Support or ask for help in the Developer Forums.