Mobile SDKs

Integrate Pine Labs Mobile SDKs for Android and iOS to deliver secure, app-native checkout flows with backend verification and webhook-backed reliability.

Pine Labs Mobile SDKs enable native in-app payment experiences on Android and iOS. The SDK manages checkout UI and payment method interactions natively while your backend handles order creation, credential security, and payment verification through webhooks.

When To Use Mobile SDKs

Use Mobile SDKs when your payment flow runs inside:

  • Native Android applications with in-app checkout
  • Native iOS applications with in-app payment flows
  • Flutter apps targeting native Android and iOS payment surfaces
  • App-first commerce journeys requiring UPI intent or native payment method selection
  • In-app subscription or repeat purchase flows

Choose Your Platform

Mobile Integration Architecture

Every Mobile SDK integration follows a three-layer model that keeps sensitive operations on the server and delivers native payment UX on the device.

LayerResponsibility
Mobile SDK (Android/iOS/Flutter)Render native checkout UI, detect available UPI apps, handle payment interaction callbacks
Merchant BackendGenerate auth tokens, create checkout links, validate payment responses, manage order state
WebhooksDeliver reliable, retry-safe payment lifecycle events for final status confirmation
Never embed credentials in app binaries

Store client_id and client_secret exclusively on your backend. Mobile app binaries can be decompiled. Any credential embedded in client code is compromised by definition.

Prerequisites

Before integrating any Mobile SDK, confirm the following:

  1. Active Pine Labs merchant account with API access enabled.
  2. client_id and client_secret stored securely in your backend infrastructure.
  3. Backend endpoints for the Generate Token API and Generate Checkout Link API.
  4. Webhook endpoint configured to receive and verify payment lifecycle events.
  5. Platform-specific app setup complete:
    • Android: minSdk 26+, internet permission, UPI app detection configured.
    • iOS: iOS 13.0+, UPI URL schemes declared in Info.plist.
    • Flutter: Flutter 3.24+, platform-specific configurations applied.
  6. UAT test matrix covering success, failure, cancellation, background/foreground transitions, network loss, and app-kill scenarios.

How Mobile SDK Checkout Works

1
App requests order from your backend

Your mobile app calls your backend API to initiate a payment. The backend generates an auth token using the Generate Token API, then creates a checkout link using the Generate Checkout Link API.

2
Backend returns checkout context to the app

Your backend responds with the redirect_url (or payment URL and success/failure URLs) that the mobile SDK needs to launch checkout.

3
App launches Mobile SDK checkout

The app initializes the SDK with the checkout URL. The SDK renders the payment page natively, detects available UPI apps (on Android/iOS), and presents payment method options.

4
Customer completes payment

The customer selects a payment method, authenticates (PIN, biometric, OTP), and completes the transaction. For UPI payments, the SDK handles intent-based redirection to the UPI app and return.

5
SDK fires payment callbacks

The SDK returns a result through platform-specific callbacks (onTransactionResponse, onCancelTxn, onErrorOccured) indicating the session outcome.

6
Backend verifies and confirms final state

Your backend receives the webhook event or calls Get Order by Order ID to confirm the authoritative payment state. The app then reflects the verified result to the customer.

Platform Requirements at a Glance

PlatformMinimum VersionKey DependencyUPI Support
AndroidAPI 26+ (Android 8.0)pine_payment_sdk or .aar libraryBuilt-in app detection
iOSiOS 13.0+PinePaymentSDK pod/frameworkURL scheme declaration required
FlutterFlutter 3.24+, Dart 3.9.2+pine_payment_sdk packageAutomatic via native layer

UPI App Detection and Intent Handling

Mobile SDKs include built-in support for UPI payments through native app intents:

PlatformHow UPI works
AndroidSDK automatically detects installed UPI apps (Google Pay, PhonePe, Paytm, CRED) and presents them as payment options. Payment launches via Android Intent.
iOSRequires UPI URL schemes declared in Info.plist (upi, phonepe, gpay, paytm, tez, credpay). SDK handles scheme-based app launch and return.
FlutterNative layer handles UPI detection and intent. No additional Dart configuration needed.

SDK Callback Methods

All Mobile SDK platforms share a consistent callback interface:

CallbackWhen it fires
onTransactionResponsePayment completed (success or failure returned from checkout)
onCancelTxnCustomer cancelled the payment flow
onErrorOccuredPayment page failed to load or SDK encountered an error
internetNotAvailableNetwork connectivity lost during the payment flow
onPressedBackButtonCustomer pressed back during payment
SDK callbacks are not authoritative

Mobile SDK callbacks reflect what happened in the app session. They can be missed if the app is killed, the network drops, or the OS reclaims memory. Always verify final payment state through your backend using webhooks or the Get Order by Order ID API.

Mobile-Specific Best Practices

AreaRecommendation
App lifecycleHandle background/foreground transitions gracefully — payment continues on Pine Labs infrastructure even if the app is suspended
Network resilienceImplement retry-safe status polling as a fallback if webhook delivery is delayed
SecurityNever embed API secrets in app binaries; use certificate pinning for backend calls
UX statesShow clear pending, processing, success, and failed states with appropriate messaging
ObservabilityLog correlation IDs (order ID, transaction ID, webhook event ID) for end-to-end traceability
TestingTest app-kill during payment, network toggle, UPI app not installed, and timeout scenarios
Deep linkingConfigure proper return URLs so UPI apps can redirect back to your app after payment

Integration Methods

Single Order Token (Recommended)

Pass a single token to the SDK. The SDK navigates to the Pine Labs Native SDK and handles success/failure routing automatically.

Next Steps

  • Choose your platform guide above to start integration.
  • Review Web SDKs if you also need browser-based checkout without native UI.
  • Configure Webhooks for reliable, event-driven payment reconciliation.
  • Use Error Codes to build robust error messages and retry logic.