Pine LabsDOCS

Web SDKs

Integrate Pine Labs Web SDKs across React, Android, iOS, and Flutter with secure backend token generation, callback handling, and webhook-based payment verification.

Pine Labs Web SDKs help you embed secure payment checkout directly into browser-based applications. The SDK handles checkout UI rendering in the client while your backend manages order creation, signature validation, and payment verification through webhooks.

When To Use Web SDKs

Use Web SDKs when your customer pays through:

  • Web applications built with React or JavaScript frameworks
  • Android apps using WebView-based checkout
  • iOS apps using WKWebView-based checkout
  • Flutter apps targeting browser checkout surfaces
  • Desktop and mobile browser sessions on merchant storefronts

Choose Your Platform

Core Integration Architecture

Every Web SDK integration follows a three-layer model that keeps sensitive operations server-side.

LayerResponsibility
Frontend (Web SDK)Render checkout UI, capture payment interaction, and return callbacks
Backend APIsCreate orders, generate auth tokens, produce checkout links, and validate signatures
WebhooksDeliver payment lifecycle events for reliable, tamper-proof status confirmation
Security requirement

Never call Pine Labs APIs directly from the frontend. Store client_id and client_secret exclusively on your backend. Frontend API calls expose credentials and carry legal implications.

Prerequisites

Before integrating any Web 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.
  3. Backend endpoint to call the Generate Token API and Generate Checkout Link API.
  4. Webhook endpoint configured to receive payment lifecycle events.
  5. UAT test plan covering success, failure, cancellation, timeout, and network interruption scenarios.

How Web SDK Checkout Works

1
Generate auth token on your backend

Your server calls the Generate Token API with client_id and client_secret to receive a time-limited access token.

2
Create a checkout link

Using the access token, your backend calls the Generate Checkout Link API with order details (amount, currency, merchant reference). The API returns a redirect_url.

3
Pass redirect URL to the Web SDK

Your frontend initializes the platform-specific Web SDK with the redirect_url. The SDK opens the Pine Labs hosted checkout page.

4
Customer completes payment

The customer interacts with the checkout page, selects a payment method, and completes authentication.

5
Handle SDK callbacks

The SDK fires callback methods (onTransactionResponse, onCancelTxn, onErrorOccured) to inform your app of the outcome.

6
Verify payment on your backend

Your backend calls the Get Order by Order ID API or processes the webhook event to confirm the final payment state before fulfilling the order.

Platform Requirements at a Glance

PlatformMinimum VersionKey Dependency
ReactReact 16.8+, Node.js 14+react-native-webview
AndroidSDK 21+ (Lollipop)EDGE-SDK.aar library
iOSiOS 12.0+, Swift 5.0PineLabsWebSDK.xcframework
FlutterFlutter 3.24+, Dart 3.9.2+pine_payment_sdk package

SDK Callback Methods

All Web SDK platforms share a consistent callback interface:

CallbackWhen it fires
onTransactionResponsePayment completed (success or failure)
onCancelTxnCustomer cancelled the payment
onErrorOccuredCheckout page failed to load
internetNotAvailableNetwork connectivity lost during checkout
onPressedBackButtonCustomer pressed back during payment flow
Always verify server-side

SDK callbacks indicate what happened in the browser session but are not tamper-proof. Always confirm the final payment state through your backend using the Get Order by Order ID API or webhook events.

Best Practices

Focus areaRecommendation
PerformanceLoad SDK only on checkout intent to avoid blocking initial page render
ReliabilityTreat webhook status as the authoritative source of truth for payment state
SecurityKeep all API credentials, token generation, and signature validation on backend only
ConversionMinimize checkout steps and provide clear progress indicators
Error handlingMap all callback states to user-friendly messages with retry options where applicable
TestingCover success, failure, timeout, back-press, and app-kill scenarios in UAT

Integration Methods

Single Redirect URL (Recommended)

Pass a single redirect_url to the SDK. The SDK navigates to the Pine Labs hosted checkout page and handles success/failure routing automatically.

Separate Success and Failure URLs

Provide distinct successUrl and failureUrl endpoints. The SDK redirects to the appropriate URL based on checkout outcome. Useful when your app needs different post-payment landing flows.

Next Steps

  • Choose your platform guide above to start integration.
  • Review Mobile SDKs if you also need native app checkout without WebView.
  • Use Webhooks for reliable, event-driven payment state handling.
  • Refer to Error Codes to build robust error messaging.