This guide covers everything you need to integrate account linking into your Android app: how it works, setup, authentication, order retrieval, background processing, account management, and references.
How It Works
- Connect — The user links their retailer account through your app. The SDK handles authentication, including two-factor authentication and CAPTCHA challenges.
- Verify — The SDK verifies the credentials against the retailer.
- Retrieve — The SDK fetches purchase history from the linked account and returns structured order data.
- Enrich (optional) — If Product Intelligence is enabled, line items are matched against the product catalog for UPC, brand, and category.
Credentials are encrypted and stored locally on the device. They never leave the device and are only used when the retailer session expires and re-authentication is required.
Requirements
| Requirement | Version |
|---|---|
| Android Min SDK | 23+ (Android 6.0+) |
| Android Compile SDK | 36+ |
| Java | 17+ |
| Architecture | armeabi-v7a, arm64-v8a |
Installation
- Add the Maven repository:
Kotlin DSL:
repositories {<br> mavenCentral()<br>}Groovy:
repositories {
mavenCentral()
}- Add the dependencies:
Kotlin DSL:
dependencies {
implementation(platform("com.microblink.blinkreceipt:blinkreceipt-bom:1.9.13"))
implementation("com.microblink.blinkreceipt:blinkreceipt-account-linking")
}Groovy:
dependencies {
implementation platform("com.microblink.blinkreceipt:blinkreceipt-bom:1.9.13")
implementation "com.microblink.blinkreceipt:blinkreceipt-account-linking"
}→ Android SDK Repository (GitHub)
License Keys
You need two keys: a license key and a Product Intelligence key.
Option A: Android Manifest
<meta-data
android:name="com.microblink.LicenseKey"
android:value="YOUR-LICENSE-KEY"
/>
<meta-data
android:name="com.microblink.ProductIntelligence"
android:value="YOUR-PROD-INTEL-KEY"
/>Option B: Programmatically
Kotlin:
BlinkReceiptSdk.licenseKey = "YOUR-LICENSE-KEY"
BlinkReceiptSdk.productIntelligenceKey = "YOUR-PROD-INTEL-KEY"Java:
BlinkReceiptSdk.licenseKey("YOUR-LICENSE-KEY");
BlinkReceiptSdk.productIntelligenceKey("YOUR-PROD-INTEL-KEY");Initialize the SDK
Kotlin:
BlinkReceiptSdk.initialize(this, object : InitializeCallback {
override fun onComplete() {
// Ready to use
}
override fun onException(throwable: Throwable) {
// Log exception
}
})Java:
BlinkReceiptSdk.initialize(this, new InitializeCallback() {
@Override
public void onComplete() {
// Ready to use
}
@Override
public void onException(@NonNull Throwable throwable) {
// Log exception
}
});Authentication, Retrieval & Configuration
After installation and initialization, the account linking flow (authentication options, verification, order retrieval, background processing, account management) follows the same concepts across iOS and Android. For detailed Android code and examples:
- Getting Started — Account linking setup
- Configuring the Client — Connection configuration and options
- How to Use — Linking, verifying, and retrieving orders
- Running in the Background — WorkManager background processing
- Fetch Orders from All Retailers — Bulk retrieval
- Error Codes — Full error reference
Order Types
| Type | Description |
|---|---|
| In-Store | Purchases made in a physical store (if visible in the retailer account) |
| Delivery | Online purchases shipped to the customer |
| Pickup | Online purchases picked up in store |
| Digital | Movies, eBooks, songs, digital storage, etc. |
Not all order types are available for every retailer. Target, Walmart, and Kroger are examples of retailers that surface in-store purchases through their online accounts.
Order Status
Each order can include status information at three levels:
| Level | What it tracks |
|---|---|
| Order status | Overall order status (ordered, completed, cancelled, refunded, returned) |
| Shipment status | Status of a specific shipment within the order (delivery orders only) |
| Product status | Status of a specific product within the order |
Important: Account linking returns each order only once. If an order’s status changes after it has been retrieved (e.g., shipped → delivered), you need to reset the order history and re-retrieve to get the updated status.
Configuration Options
| Setting | What it does | Default |
|---|---|---|
dayCutoff | How many days of purchase history to retrieve | 15 days |
dateCutoff | Specific earliest date to retrieve from | None |
webviewAuthEnabled | Use retailer webview instead of host app credentials | false |
Error Handling
Common error codes and what they mean:
| Error | Description | How to handle |
|---|---|---|
verificationNeeded | Retailer requires 2FA, CAPTCHA, or other user input | Present the provided view controller |
verificationCompleted | User successfully completed additional authentication | Dismiss the view controller |
invalidCredentials | Username or password is incorrect | Prompt the user to re-enter credentials |
noCredentials | No credentials provided | Ensure credentials are set on the connection |
unsupportedRetailer | Retailer is not supported | Check the supported retailers list |
cancelled | Operation was cancelled | Dismiss any presented view controllers |
webViewClosed | User dismissed the webview | Dismiss any presented view controllers |
→ Full Android Error Codes Reference
Account Management
Unlinking
Users can unlink a retailer account at any time. Unlinking removes stored credentials from the device.
Important: Unlinking does not reset the order history cache. If the same user re-links, the SDK will only return orders since the last successful retrieval. To reset the cache, explicitly call the reset history method for that retailer.
Changing Credentials
Modifying credentials on an existing connection is not supported. To change credentials, unlink the account first, then create and link a new connection with the updated credentials. It is recommended to verify the new credentials before linking.
Multiple Accounts
Linking multiple accounts for the same retailer is not supported. Unlink the existing account before linking a different one for the same retailer.
Testing Recommendations
- Test linking and verification for multiple retailers
- Test 2FA and CAPTCHA flows (most retailers trigger these intermittently)
- Test with accounts that have both in-store and online purchase history
- Verify that
dayCutoffcontrols the retrieval window correctly - Test unlinking and re-linking with the same and different credentials
- Test background order retrieval
- Remember to call reset history between test runs, or you will only see new orders since the last retrieval
Implementation Timeline
| Scope | Estimated Dev Time |
|---|---|
| Standard integration (single retailer) | ~1 week + QA |
| Full integration (all retailers + background) | ~2 weeks + QA |