The Paydock Android MobileSDK seamlessly integrates with Paydock services to easily build a payments flow in your Android app. The SDK provides a customisable experience with pre-built UI widgets that handle and support various payment methods.
Once you have setup and initialised the MobileSDK in your application, you can use the MobileSDK widgets to access payment flows. These include interacting with GooglePay and Paypal. You can also complete 3DS challenges, capture addresses, securely collect gift card details, and tokenise card details.
- Android 7.0 (API level 24) and above
- Setup the Paydock API Integration by contacting Paydock to signup for a sandbox account, and then following our integration guide .
- Setup the Android SDK.
- Configure repository access.
- Add the SDK dependency to your app.
- Use the following guide to initialize your SDK.
This repository includes a sample application (sample/) that demonstrates how to integrate and use the Paydock Android Mobile SDK. This example app showcases various features of the SDK and provides a practical guide for developers looking to implement Paydock payments in their own Android applications.
Before you can run the sample app, you'll need to have the following installed:
- Paydock Integration Ensure you have setup your Paydock account and signed up for your Sandbox account. (As indicated in step 1)
- Android Studio: The latest stable version of Android Studio is recommended. You can download it from the official Android Studio website.
- Android SDK: Ensure you have the necessary Android SDK platforms and build tools installed via the Android Studio SDK Manager.
- Git: You'll need Git to clone the repository.
The sample app uses a config.properties file to manage environment-specific settings. Each build flavor has a corresponding config.properties file containing key-value pairs used during the build process. These values are injected into the app via build.gradle.
Note:
You only need to create and configure the
config.propertiesfile for the flavors you are actively working on. For example, if you are working onsandboxandprod, you can omit the file forstaging, as it is not required for your current build. Ensure the necessary configuration files are in place before running the app to avoid missing variable errors.
- Flavors: The sample app supports three flavors:
staging,sandbox, andprod. You'll need to provide values for each flavor. - Location: Create a file named
config.propertiesin thesample/src/[flavor]directory of the project. - Structure: The
config.propertiesfile should contain key-value pairs for each configuration setting. - Required Fields: The following fields are required in the
config.propertiesfile:
ACCESS_TOKEN_API: The Paydock API access token for the specified environment (e.g., sandbox, staging, production). This token is used by the sample app to make direct calls to the Paydock API for tasks like creating customers or managing transactions.ACCESS_TOKEN_WIDGET: The Paydock Widget/UI access token for the specified environment. This token is used by the Paydock SDK to authenticate and authorize the use of the pre-built UI widgets for payment processing.SERVICE_ID_MPGS: Your Paydock service ID for the MPGS (Mastercard Payment Gateway Services) gateway. This ID is required to process card payments, handle 3D Secure (3DS) authentication, and manage other card-related transactions.SERVICE_ID_MPGS_TEST: Your Paydock service ID for the MPGS (Mastercard Payment Gateway Services) gateway. This ID should use an MPGS merchant id starting with TEST* for using MPGS supported test cards and 3ds challenge emulator.SERVICE_ID_PAYPAL: Your Paydock service ID for the PayPal gateway. This ID is necessary to enable PayPal as a payment method within the sample app.SERVICE_ID_COLES_PAY: Your Paydock service ID for the Coles Pay gateway. This ID is required to enable Coles Pay as a payment method.SERVICE_ID_AFTERPAY: Your Paydock service ID for the Afterpay gateway. This ID is required to enable Afterpay as a payment method.SERVICE_ID_CLICK_TO_PAY: Your Paydock service ID for the ClickToPay gateway. This ID is required to enable ClickToPay as a payment method.SERVICE_ID_GOOGLE_PAY_MPGS: Your Paydock service ID for the Google Pay gateway. This ID is required to enable Google Pay as a payment method.SERVICE_ID_GPAYMENTS: The Paydock service ID for Standalone 3DS (3D Secure) authentication, specifically using the GPayments service. This ID is used when you need to perform 3DS authentication outside of a regular payment flow.MERCHANT_ID_GOOGLE_PAY: Your Paydock merchant identifier, which is required for Google Pay. This identifier is used to associate your transactions with your Google Pay merchant account.WALLET_ID_COLES_PAY: The walled ID provided to Coles Pay. The wallet id is used to tag the wallet that is being used (e.g. Beem).
Example config.properties:
# Authentication ACCESS_TOKEN_API="your_api_access_token" ACCESS_TOKEN_WIDGET="your_widget_access_token" # MPGS SERVICE_ID_MPGS="your_gateway_id_mpgs" # AFTERPAY SERVICE_ID_AFTERPAY="your_gateway_id_after_pay" # GOOGLE PAY SERVICE_ID_GOOGLE_PAY_MPGS="your_gateway_id_google_pay" MERCHANT_ID_GOOGLE_PAY="your_merchant_id_google_pay" # CLICK TO PAY SERVICE_ID_CLICK_TO_PAY="your_service_id_click_to_pay" # COLES PAY SERVICE_ID_COLES_PAY="your_gateway_id_coles_pay" WALLET_ID_COLES_PAY="your_wallet_id_coles_pay" # GPAYMENTS (Standalone 3ds) SERVICE_ID_GPAYMENTS="your_gpayments_service_id" # PAYPAL SERVICE_ID_PAYPAL=your_gateway_id_pay_pal Note:
Replace the placeholder values (e.g.,
your_api_access_token) with your actual keys and IDs.
- Clone the Repository: bash git clone https://github.com/PayDock/android-mobile-sdk.git
- Open in Android Studio: Open the
sample/directory in Android Studio. - Select a Build Variant: In Android Studio, go to
Build>Select Build Variant...and choose one of the following:
stagingDebugsandboxDebugprodDebug
- Run the App: Click the "Run" button (green play icon) in Android Studio to build and run the sample app on an emulator or a connected device.
For JS-driven webflows (Click to Pay, 3DS), the JS runtime inside the WebView will reinitialize if the hosting Activity is recreated (e.g., orientation change). To avoid losing in-page state:
- Prefer hosting these flows in a dedicated Activity and opt out of Activity recreation for orientation/size changes:
<activity android:name=".feature.WebActivity" android:exported="true" android:launchMode="singleTop" android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustResize" />Apply the same to 3DS demo Activities. The SDK also:
- Uses saveable WebView state and stable HTML generation to minimize reloads.
- Avoids persisting sensitive card data (PAN/CVV/expiry) across process death; rely on OS Autofill to re-fill when needed.
If you cannot opt out of recreation, pass a resumable session/token to the widget config so the flow can re-bootstrap after restore.