Skip to content

Glomo React Native SDK v6

Official React Native SDK for integrating Glomo payment checkout flows into your mobile applications.

Current version: v6.0.0.

Upgrading from v5? Read the Migration Guide first. One behaviour changes and one exported type widens: onPaymentSuccess now fires only for a success your backend can verify, and "paymentVerification" joins the SdkError["field"] union. Only integrations that take bank-transfer payment links through the SDK see the behaviour change - see Unverifiable payment successes.

v6.0.0 also adds two optional props, onCheckoutStageChanged and onCheckoutClosed.

Upgrading from v4? Read the whole Migration Guide. jail-monkey is a required peer dependency as of v5 and the device compliance gate fails closed, so an upgrade that skips it takes live checkouts off the air. Mock and test keys are never blocked, so a test_ key QA pass will not catch it.

Full Changelog is also available.

Prerequisites

Before using this SDK, you need:

  • API credentials (Public Key) from your Glomo dashboard
  • An order ID created via the Glomo API (or a subscription ID for subscription payments)

System Requirements

RequirementVersion
Node.js>= 16.0.0
npm>= 8.0.0
React>= 17.0.0
React Native>= 0.68.0
react-native-webview^13.0.0
jail-monkey^2.6.0
react-native-blob-util (optional)^0.25.0
@react-native-documents/picker (optional)>= 10.1.3

jail-monkey was optional in v4 and is required in v5. The two optional packages enable document downloads; leaving them out is supported.

Installation

React Native CLI

npm install @glomopay/react-native-sdk react-native-webview jail-monkey@^2.6.0
cd ios && pod install

Expo

npx expo install @glomopay/react-native-sdk react-native-webview jail-monkey@^2.6.0

Required: Device Security Compliance

jail-monkey is a required peer dependency as of v5.

Without it, live checkouts are blocked. The SDK cannot tell a clean device from a compromised one, and on a live_ key it refuses to start rather than assume the device is safe: start() returns false and onSdkError fires with type: "device_forbidden".

Installing is not enough - jail-monkey ships native code, so the app must be rebuilt. An installed but unlinked module is treated exactly as if the package were absent.

Test and mock keys are never blocked, so QA on a rooted handset or an emulator still works.

Pin the 2.x line. jail-monkey@latest is 3.0.0, and on an app that has not enabled the New Architecture its native module does not compile at all: it passes a ReactApplicationContext to a no-argument constructor and reads an undeclared rootedCheck, so the build stops at :jail-monkey:compileReleaseJavaWithJavac before any Glomo code is reached. No 3.x patch exists. The SDK's peer range has always been ^2.6.0 and has not changed; what changed in v5.1.0 is that the install commands above pin it rather than resolving latest.

Required on Android: uiMode in android:configChanges

Declare uiMode on the activity that hosts the checkout, in android/app/src/main/AndroidManifest.xml, alongside the values you should already be declaring:

<activity
    android:name=".MainActivity"
    android:configChanges="uiMode|keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|fontScale|locale|layoutDirection|density"
    ... />

An OS theme change is an Android configuration change. Without uiMode declared, Android destroys and recreates your activity when the user switches between light and dark - which destroys the checkout along with it. A user toggling dark mode mid-payment loses that payment.

This is yours to configure and the SDK cannot do it for you: @glomopay/react-native-sdk ships no native Android code, so it cannot read or amend your activity's configuration, and it cannot detect that the declaration is missing in order to warn you. It applies whether or not you use appColorScheme, and react-native-webview documents the same hazard for its own props.

This is not new in v5.1.0, but it matters more now that users have a reason to toggle mid-payment.

Optional: Document Downloads

Some checkout flows offer a document - an agreement PDF, for example - for the customer to save. A web page cannot write a file to the device from inside a WebView, so the SDK does it, but only if both of these are installed:

npm install react-native-blob-util @react-native-documents/picker
cd ios && pod install

Leaving them out is a supported choice: the SDK does not advertise the capability, the checkout page keeps its own download behaviour, and nothing breaks.

Five things worth knowing before you install them:

  1. Installing is not enabling. Both ship native code, so the app must be rebuilt. Until then the SDK treats them exactly as if they were absent.
  2. Reset the Metro cache after installing (npx react-native start --reset-cache). A stale bundle resolves the old module graph and the capability stays off.
  3. Expo needs a development build. Neither package works in Expo Go. react-native-blob-util ships a config plugin; @react-native-documents/picker does not, so add it to your config plugins list yourself if your setup needs one.
  4. @react-native-documents/picker 11 and above requires React Native >= 0.79. On older React Native, pin 10.1.x - the API this SDK uses is identical.
  5. Degradation is silent by design, which is why it is noisy in development: start() logs an ungated warning naming the missing package, and onSdkError fires once per mount with field: "file.save". See Document Downloads for what that means for your error handler.

Quick Start

import React, { useRef } from "react";
import { View, Button } from "react-native";
import {
  GlomoCheckout,
  ASYNC_PAYMENT_EVENTS,
  type GlomoCheckoutRef,
  type GlomoCheckoutPayload,
  type GlomoTerminationPayload,
  type SdkError,
} from "@glomopay/react-native-sdk";

export default function PaymentScreen() {
  const checkoutRef = useRef<GlomoCheckoutRef>(null);

  const handlePay = async () => {
    const started = await checkoutRef.current?.start();
    if (!started) {
      console.log("Checkout could not start - check onSdkError for details");
    }
  };

  return (
    <View style={{ flex: 1 }}>
      <Button title="Pay Now" onPress={handlePay} />

      <GlomoCheckout
        ref={checkoutRef}
        publicKey="live_pk_abc123"
        orderId="order_xyz789"
        onPaymentSuccess={(payload: GlomoCheckoutPayload) => {
          // As of v6 a success always carries both; the type still marks them optional
          // because a failure payload may not.
          if (payload.paymentId && payload.signature) {
            confirmOnOurBackend(payload.paymentId, payload.signature);
          }
        }}
        onPaymentFailure={(payload: GlomoCheckoutPayload) => {
          console.log("Payment failed:", payload.orderId);
        }}
        onPaymentTerminate={(payload: GlomoTerminationPayload) => {
          console.log("Checkout ended without a payment outcome:", payload.source);
        }}
        onConnectionError={(error) => {
          console.log("Connection error:", error);
        }}
        onUserJourneyCompleted={(payload) => {
          switch (payload.journeyType) {
            case ASYNC_PAYMENT_EVENTS.BANK_TRANSFER_SUBMITTED:
              console.log("Bank transfer submitted:", payload.orderId);
              break;
            case ASYNC_PAYMENT_EVENTS.PAY_VIA_BANK_COMPLETED:
              console.log("Pay via bank completed:", payload.status);
              break;
          }
        }}
        onUserRefusedDevicePermissions={() => {
          console.log("User refused a device permission the bank's page asked for");
        }}
        onSdkError={(errors: SdkError[]) => {
          // field: "file.save" is not a misconfiguration - see Document Downloads
          const blocking = errors.filter((e) => e.field !== "file.save");
          blocking.forEach((e) => console.error(e.type, e.message, e.field));
        }}
      />
    </View>
  );
}

Subscriptions Checkout

To process subscription payments, pass a subscriptionId instead of an orderId:

<GlomoCheckout
  ref={checkoutRef}
  publicKey="live_pk_abc123"
  subscriptionId="sub_xyz789"
  onPaymentSuccess={(payload) => {
    console.log("Subscription payment success:", payload.orderId);
  }}
  onPaymentFailure={(payload) => {
    console.log("Subscription payment failed:", payload.orderId);
  }}
  onSdkError={(errors) => {
    errors.forEach((e) => console.error(e.type, e.message));
  }}
/>

When subscriptionId is provided:

  • The SDK skips order type detection (no API call)
  • The subscriptionId must start with sub_
  • onUserJourneyCompleted is not applicable - subscriptions are card-only (onPaymentSuccess / onPaymentFailure)
  • Do not pass both orderId and subscriptionId - the SDK will fire onSdkError
  • The detecting_order_type status is not emitted for subscription flows

Features

  • Cross-platform - works on both iOS and Android
  • TypeScript - full type definitions for all exports
  • Unified checkout - renders the correct checkout flow automatically based on your order
  • Asynchronous payment flows - single onUserJourneyCompleted callback for bank transfer and pay via bank events
  • Device permissions - built-in camera handling for bank authentication, on every checkout flow. Now also on LRS
  • Document downloads - saves a document the page offers to the customer's device, on every checkout flow, behind two optional peer dependencies. New in v5
  • Dark mode - ask the checkout page for a light or dark scheme, or let it follow your app's own appearance. New in v5.1.0
  • Origin policy - payment results and document saves are accepted only from Glomo checkout pages, never from a bank or 3-D Secure page. New in v5.2.0
  • Verified successes only - onPaymentSuccess fires only for a payment carrying a paymentId and signature your backend can verify. New in v6.0.0
  • Checkout progress events - where the customer reached in an LRS checkout, and why it closed. New in v6.0.0
  • Device security - required jail-monkey integration for rooted/jailbroken device detection, failing closed on live keys
  • Input validation - publicKey and orderId format enforcement before checkout starts
  • Mock mode - test with test_ / mock_ prefixed keys without hitting production

API Reference

GlomoCheckout Component

The unified checkout component. Place it in your render tree and control it via a ref.

<GlomoCheckout ref={checkoutRef} {...props} />

Props (GlomoCheckoutProps)

PropTypeRequiredDescription
publicKeystringYesYour Glomo public key (must start with live_, mock_, or test_)
orderIdstringNo*Order ID from the Glomo API (must start with order_)
subscriptionIdstringNo*Subscription ID (must start with sub_). Bypasses order type detection.
onPaymentSuccess(payload: GlomoCheckoutPayload) => voidYesCalled when a payment succeeds and carries a paymentId and signature. A success without them no longer reaches this prop - see Unverifiable payment successes. Changed in v6.0.0
onPaymentFailure(payload: GlomoCheckoutPayload) => voidYesCalled when payment fails
onConnectionError(error: unknown) => voidNoCalled on network/connection errors
onPaymentTerminate(payload: GlomoTerminationPayload) => voidNoCalled when the checkout ends without a payment outcome. payload.source names how. An existing () => void handler stays assignable. Changed in v5
onSdkError(errors: SdkError[]) => voidYesCalled on validation errors, device compliance failures, and a missing download capability. Filter on field, not type - see Document Downloads
onUserJourneyCompleted(payload: GlomoUserJourneyCompletedPayload) => voidNoCalled when an asynchronous payment flow completes (bank transfer submission, pay via bank completion) - not a confirmed payment. Check payload.journeyType to determine the flow. Accepted on GlomoCheckout but silently ignored on LRS orders, which never produce an asynchronous journey.
onUserRefusedDevicePermissions() => voidNoCalled when the user denies a device permission the bank's page asked for - camera today. Android only; see Device Permissions. Renamed in v5 from onUserRefusedCameraPermissions
appColorSchemeGlomoColorSchemeNoThe colour scheme to request from the checkout page: "auto" (default), "light" or "dark". A request, not an instruction - see Dark mode. New in v5.1.0
onCheckoutStageChanged(event: GlomoCheckoutStageChangedEvent) => voidNoCalled when the customer reaches a new checkout stage, or a new step within one. LRS only - see Checkout progress events. New in v6.0.0
onCheckoutClosed(event: GlomoCheckoutClosedEvent) => voidNoCalled at most once when the checkout closes, with the last stage it reached and why - see Checkout progress events. New in v6.0.0

*Exactly one of orderId or subscriptionId must be provided. If both or neither are set, onSdkError fires and start() returns false.

Ref Methods (GlomoCheckoutRef)

MethodSignatureDescription
start()() => Promise<boolean>Validates inputs, and opens the checkout modal. Resolves true if successful, false otherwise.
getStatus()() => CheckoutStatusReturns the current checkout status.

CheckoutStatus

StatusDescription
readyInitial state - checkout can be started
detecting_order_typeOrder type detection in progress (after start(), before checkout opens)
payment_in_progressCheckout modal is open, user is interacting
payment_successfulPayment completed successfully. Cannot restart with same order
payment_failedPayment failed. Can retry with same order
payment_cancelledUser dismissed checkout mid-flow. Can retry
bank_transfer_submittedUser submitted bank transfer details
pay_via_bank_completedPay via bank flow completed

Type Definitions

GlomoCheckoutPayload

interface GlomoCheckoutPayload {
  orderId: string;
  paymentId?: string;
  signature?: string;
}

paymentId and signature are optional on the type, because a failure payload can still arrive without them. As of v6.0.0 a payload passed to onPaymentSuccess always carries both - see Unverifiable payment successes - so the narrowing a success handler needs is a formality rather than a real branch. A payload passed to onPaymentFailure is unchanged and may have neither.

ASYNC_PAYMENT_EVENTS

enum ASYNC_PAYMENT_EVENTS {
  BANK_TRANSFER_SUBMITTED = "bank_transfer_submitted",
  PAY_VIA_BANK_COMPLETED = "pay_via_bank_completed",
}

GlomoUserJourneyCompletedPayload

interface GlomoUserJourneyCompletedPayload {
  journeyType: ASYNC_PAYMENT_EVENTS;
  orderId?: string;
  status?: string;
  senderAccountNumber?: string;
  transactionReference?: string; // Always undefined: the checkout page does not send it
}

TERMINATION_SOURCES

New in v5.

enum TERMINATION_SOURCES {
  CHECKOUT_CLOSED = "checkout_closed",        // the page's own close control
  DEVICE_BACK_BUTTON = "device_back_button",  // Android hardware back or back gesture
  MODAL_DISMISS = "modal_dismiss",            // iOS swipe-down on the modal
}

The back chevron over a bank flow is deliberately not in this list. It returns the user to the checkout with the session intact and the ability to pay, so reporting it as a termination would be false - and for a merchant who cancels the order on terminate, it would cancel live orders every time a customer backed out of one bank to try another.

GlomoTerminationPayload

New in v5.

interface GlomoTerminationPayload {
  source: TERMINATION_SOURCES;
}

An object rather than a bare enum, so a later field can be added without changing the signature or redefining what an existing value means.

GlomoColorScheme

New in v5.1.0.

type GlomoColorScheme = "auto" | "light" | "dark";

See Dark mode for what "auto" resolves to on React Native, which is not what it resolves to on the other Glomo SDKs.

SdkError

interface SdkError {
  type: "validation_error" | "device_forbidden";
  message: string;
  field?:
    | "publicKey"
    | "orderId"
    | "subscriptionId"
    | "baseCheckoutUrl"
    | "generatedCheckoutUrl"
    | "file.save"
    | "paymentVerification";
}

field: "file.save" and field: "paymentVerification" are the two values that do not mean the integration is misconfigured. See Document Downloads and Unverifiable payment successes.

"paymentVerification" is new in v6.0.0 and widens the exported SdkError["field"] union. Nothing changes at runtime for the values that were already there, but an exhaustive switch over field with a never check stops compiling until it handles the new case. Match on field, not on the message text, to tell a dropped unverifiable success apart from a configuration fault such as a bad public key.

Unverifiable payment successes

Changed in v6.0.0. A payment.success without a paymentId and signature is no longer passed to onPaymentSuccess. There is nothing in it for your backend to verify, so the SDK does not report it as a success. This matches the Android and iOS SDKs.

Who is affected: integrations that take bank-transfer payment links through the SDK. That is the one case where the checkout sent such a success - a bank-transfer payment link reported paid while checkout was still open. No other payment flow is affected, and failure callbacks are unchanged.

What happens instead:

  1. onSdkError fires with type: "validation_error" and field: "paymentVerification". Match on the field, not on the message text.
  2. The checkout stays open on its own success screen.
  3. When the customer closes it, onPaymentTerminate fires with source: "checkout_closed" - even though the order may be paid.
onSdkError={(errors) => {
  for (const error of errors) {
    if (error.field === "paymentVerification") {
      // The order may be paid. Ask your backend, do not offer a retry.
      void refreshOrderStatusFromBackend(orderId);
      continue;
    }
    reportConfigurationProblem(error);
  }
}}

Confirm the order's status from your backend or webhooks, not from the SDK callback. Do not treat that onPaymentTerminate as an abandoned payment, and do not offer a retry, until you have checked the order status.

There is no switch to keep the old behaviour: reporting an unverifiable success is the bug this release fixes. To roll back, pin v5.2.0.

Checkout progress events

New in v6.0.0. Two optional props on GlomoCheckout report how far a customer got through an LRS checkout and why the checkout closed. They are the React Native equivalent of the checkout.stage_changed and checkout.closed events on the web - see Checkout events for the contract they relay: every stage, step, close reason and field, and what each one means.

They are enabled per merchant and off by default. Until they are switched on for your business, the checkout behaves exactly as it does today and neither prop fires. Talk to your Glomo contact to turn them on; the same switch adds progress to the payment webhook, so you do not need to ask twice.

Both are optional, so existing integrations need no change.

<GlomoCheckout
  ref={checkoutRef}
  // ... the required props
  onCheckoutStageChanged={(event) => {
    analytics.track("checkout_stage", {
      orderId: event.resource.id,
      journeyId: event.journeyId,
      stage: event.stage,
      step: event.step,
      provider: event.provider,
    });
  }}
  onCheckoutClosed={(event) => {
    if (event.reason === "completed") return;
    analytics.track("checkout_abandoned", {
      lastStage: event.lastStage,
      reason: event.reason,
    });
  }}
/>

GlomoCheckoutStageChangedEvent

Fires each time the customer reaches a new stage, or a new step within one. Stages arrive in order and each stage and step pair fires at most once per checkout, so appending them builds a drop-off funnel without deduplication.

interface GlomoCheckoutStageChangedEvent {
  v: number;
  resource: GlomoCheckoutResource;
  journeyId: string;
  at: string;
  flow: GlomoCheckoutFlow;
  method?: GlomoCheckoutMethod;
  paymentId?: string;
  stage: GlomoCheckoutStage;
  step?: GlomoCheckoutStep;
  provider?: GlomoCheckoutProvider;
  journeyType?: GlomoCheckoutJourneyType;
  errorCode?: string;
  segment?: GlomoCheckoutSegment;
}
FieldDescription
vPayload version. 1 today - see Versioning
resourceWhat the checkout was opened for. type is "order" on LRS, id is the order ID
journeyIdIdentifies one checkout open. Every event from the same open carries the same value
atISO 8601 UTC timestamp from the customer's device clock
flowWhat the checkout is for. "payment" today
methodThe payment method. Known: "lrs"
paymentIdThe payment attempt. Present from the attempt_created stage onward
stageThe stage reached - see Payment stages
stepThe screen within the stage - see Steps
providerThe bank the customer chose. Present from method_selected onward
journeyType"redirect" or "native". Present from method_selected onward
errorCodeOnly on stage: "failed", and not always present there
segmentReserved. Not sent today

GlomoCheckoutClosedEvent

Delivered at most once per checkout. No progress events follow it - no stage changes, and no second close.

interface GlomoCheckoutClosedEvent {
  v: number;
  resource: GlomoCheckoutResource;
  journeyId: string;
  at: string;
  flow: GlomoCheckoutFlow;
  method?: GlomoCheckoutMethod;
  paymentId?: string;
  lastStage?: GlomoCheckoutStage;
  lastStep?: GlomoCheckoutStep;
  reason: GlomoCheckoutCloseReason;
}

lastStage is the last stage the page reported, and is absent when the checkout closed before any stage arrived. reason is one of "user_dismissed", "user_cancelled", "completed", "error" or "confirmation_timeout" - see Close reasons.

Open string types

GlomoCheckoutStage, GlomoCheckoutStep, GlomoCheckoutMethod, GlomoCheckoutProvider, GlomoCheckoutCloseReason, GlomoCheckoutJourneyType and GlomoCheckoutResourceType are open string unions: they list the values known today while still accepting any other string. New values can appear within v: 1, and the SDK forwards them rather than filtering them out.

That means a switch over one of them gets no exhaustiveness check and always needs a default branch. The known values are also exported as runtime arrays, for validating or labelling a value you received:

import {
  CHECKOUT_EVENT_CONTRACT_VERSION,
  PAYMENT_STAGES,
  KYC_STAGES,
  CHECKOUT_CLOSE_REASONS,
  CHECKOUT_JOURNEY_TYPES,
  CHECKOUT_RESOURCE_TYPES,
  KNOWN_PAYMENT_STEPS_BY_STAGE,
  KNOWN_CHECKOUT_METHODS,
  KNOWN_LRS_PROVIDERS,
} from "@glomopay/react-native-sdk";

KYC_STAGES is reserved - flow: "kyc" is defined in the contract but not sent today.

Which closes the SDK reports itself

Several ways out of a checkout never reach the page, so the SDK writes the close event for them: a native dismissal (Android back, iOS swipe-down), a connection error, a refused camera permission, and the payment outcome itself. The reason it writes is completed after a successful payment, error after a failed one or a connection error, and user_dismissed otherwise.

A close is not guaranteed: a checkout closed before any stage arrived, or unmounted mid-flow, reports none.

On a declined payment, lastStage is the stage before failed, because the page reports the failure ahead of that stage and the checkout closes on the failure.

What it is not

onCheckoutClosed is not a payment outcome. After a dismissal the payment can still complete on the server, so read the result from the payment status API or your webhook, never from reason.

It does not replace onPaymentTerminate, which is unchanged. On the close path onPaymentTerminate comes first where it fires at all - it does not on a payment outcome, a connection error or a refused permission - but it is not confined to that path: a late onPaymentTerminate can still land in the window while the checkout is closing.

Only v1 payloads

The SDK delivers v: 1 payloads only. An empty or differently versioned payload reports nothing, which is also what you see while the events are switched off for your account.

Asynchronous Payment Flows

The SDK fires onUserJourneyCompleted when an asynchronous payment flow completes. Use payload.journeyType to determine which flow triggered the callback:

onUserJourneyCompleted={(payload) => {
  switch (payload.journeyType) {
    case ASYNC_PAYMENT_EVENTS.BANK_TRANSFER_SUBMITTED:
      /**
       * User submitted bank transfer details.
       * Relevant fields: orderId, senderAccountNumber
       * Note: fields may be absent if the checkout page omits them.
       */
      console.log("Transfer submitted for order:", payload.orderId);
      break;
    case ASYNC_PAYMENT_EVENTS.PAY_VIA_BANK_COMPLETED:
      /**
       * Pay via bank journey completed.
       * Relevant fields: orderId, status
       * The SDK deduplicates this event - fires only once per session.
       */
      console.log("Pay via bank status:", payload.status);
      break;
  }
}}

The checkout status transitions to bank_transfer_submitted or pay_via_bank_completed respectively. Use getStatus() for granular programmatic checks.

Document Downloads

New in v5. Available on every checkout flow.

Some checkout flows offer a document for the customer to save. A page cannot write a file to the device from inside a WebView, so the SDK does it - when the two optional peer dependencies in Optional: Document Downloads are installed and the app has been rebuilt.

The capability is advertised to the checkout page only when both packages load successfully. When it is not advertised, the page keeps its own download behaviour and nothing breaks.

What this changes about onSdkError

Check this if your onSdkError handler aborts the checkout or shows a blocking error.

In v4, onSdkError only ever meant the integration was misconfigured - a malformed publicKey, a missing orderId - so treating any error on that callback as fatal was a reasonable reading. In v5 it also fires once per mount, with type: "validation_error" and field: "file.save", when the two document-download packages are not installed. Nothing is wrong in that case: the checkout works and the page keeps its own download path.

Filter on field rather than on type:

onSdkError={(errors) => {
  const blocking = errors.filter((e) => e.field !== "file.save");
  if (blocking.length > 0) {
    // your existing handling
  }
}}

The report is deliberately not tied to whether a page actually requests a download: whether this build can write a file to the device is a property of the build, so you learn it once at integration rather than the first time a customer taps download in production.

A save that fails also reports through onSdkError with field: "file.save", and never affects the payment session.

Device Permissions

Some bank pages require camera access for authentication. The SDK handles permission prompts automatically on every checkout flow, but you must declare the permissions in your native project config.

File upload permissions are requested by react-native-webview itself and never reach the SDK, so they do not surface through onUserRefusedDevicePermissions.

Android

Add to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />

iOS

Add to ios/<YourApp>/Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera access is required for identity verification during checkout</string>

Behavior

  • Android: SDK prompts the user via a native permission dialog. If denied, checkout closes and onUserRefusedDevicePermissions fires.
  • iOS: SDK grants the WebView permission request; iOS shows its own system prompt. If the user denies at the system level, the WebView handles the denial and never reports it back, so onUserRefusedDevicePermissions does not fire on iOS.

LRS checkouts had no permission handling on either platform before v5, so a bank page requesting camera access got no prompt on Android and no grant on iOS. LRS now behaves identically to the standard checkout, and onUserRefusedDevicePermissions is forwarded to it.

Platform Behavior

  • iOS: Checkout opens as a pageSheet modal (swipe-down to dismiss). Dismissing fires onPaymentTerminate with source: "modal_dismiss".
  • Android: Checkout opens fullscreen. The hardware back button dismisses it and fires onPaymentTerminate with source: "device_back_button".

Dark mode

New in v5.1.0. appColorScheme tells the Glomo checkout page which scheme to present:

<GlomoCheckout
  ref={checkoutRef}
  publicKey={publicKey}
  orderId={orderId}
  appColorScheme="auto" // "auto" | "light" | "dark"
  // ...
/>

It requests a scheme, it does not force one. The page decides, against your merchant dashboard settings. Setting "dark" does not guarantee a dark checkout, and dark mode is enabled per account - until it is enabled for yours, checkout stays light whatever you pass. See Dark mode across the SDKs for what that gating means.

What "auto" resolves to here. Appearance.getColorScheme(), which is your app's effective appearance - not the device setting underneath it. If your app calls Appearance.setColorScheme(), that value is what the SDK sees, because React Native overwrites the device value in place and exposes nothing that reports what it overwrote.

That is why this is spelled auto rather than system, and why it resolves differently here than on the native iOS and Android SDKs, where the device value is reachable. Only "light" and "dark" mean the same thing on every Glomo SDK - see the cross-SDK table.

If your app has its own theme toggle that does not go through Appearance, drive the prop yourself:

appColorScheme={myAppIsDark ? "dark" : "light"}

When "auto" is read. At start(), not when the component renders - a screen that mounts the checkout early and calls start() on a button press picks up whatever the appearance is at the press. After that the page is kept in step by injection, including across its own reloads.

Changing it mid-checkout is supported. Pass a new value and the SDK hands it to the live page without reloading, so a payment in flight survives the change. Do not remount the checkout to change the scheme - that reloads the WebView and loses the payment.

On Android, this needs uiMode in android:configChanges. Without it, an OS theme toggle destroys the checkout regardless of this prop.

Android WebView algorithmic darkening is explicitly off as of v5.1.0 on every WebView the SDK renders, including bank and 3DS pages. Previously the platform could invert a page that handles its own colours. Nothing to configure.

Origin Policy

New in v5.2.0. The SDK now decides for itself which pages belong to Glomo, and refuses the privileged bridge messages from everything else. There is nothing to integrate - no prop, no configuration and no new dependency - and the callbacks your app receives from a normal payment are unchanged.

Payment results and document saves are accepted only from Glomo checkout pages

The redirect overlay loads the bank and 3-D Secure pages at the top level, and the SDK's injected bridge is reachable from whatever document is on screen. A payment.success, payment.failure or file.save posted from one of those pages is now dropped.

Bank-driven navigation is untouched. A bank page closing the overlay after a 3-D Secure challenge works exactly as before - window.open, window.close and the page's own navigation arrive from bank origins by design, and gating them would strand the user on a finished bank page.

The overlay no longer reports payment results at all

Every outcome now comes from the main checkout page, which polls for it. Previously a result posted inside the bank overlay could complete a checkout.

If your app relied on a result posted by the bank page, it now comes from the checkout page's poll instead - slightly later, with the same payload. The SDK still takes the overlay down as part of handling the result, so the user sees the same thing. Nothing changes in what your callbacks receive.

What a refused message does

Nothing reaches your app. A refused message is dropped and recorded in the SDK's own diagnostics; no callback fires for it, and onSdkError is deliberately not used - raising an error from an untrusted page would hand a bank page a way to end a checkout it can no longer speak for.

Which origins are trusted

  • https on glomopay.com or glomo.one, including subdomains, on the default port. A suffix rule rather than a fixed host list, so a shipped SDK keeps working if a checkout host moves or redirects between the two.
  • The checkout hosts the SDK itself navigates to, from its own resolved configuration. That is what covers the LRS education carousel, staging and local integrations, with no extra setup.

The injected message relays also forward only same-document messages, so a third-party frame embedded in a Glomo page cannot have a payment event relayed on its behalf.

Nothing about signature verification changes. Confirm every payment on your server as before - the origin check narrows what can reach your callbacks, it does not replace verification.

Device Security Compliance

The SDK uses jail-monkey to detect rooted (Android) or jailbroken (iOS) devices. As of v5 it is a required peer dependency and the gate fails closed: a device the SDK cannot verify is refused on a live key rather than assumed clean.

Devicetest_ / mock_ keylive_ key
Cleanallowedallowed
Emulator / simulatorallowedallowed
Rooted / jailbrokenallowedblocked
Unverifiable (jail-monkey missing)allowedblocked

When blocked, start() returns false and onSdkError fires with type: "device_forbidden". The message distinguishes a compromised device from an unverifiable one.

Emulators are allowed on live keys, deliberately. Android emulators ship AOSP test-keys and debuggable system properties, which trip two of the checks behind isJailBroken() - so the aggregate verdict reports every stock emulator as rooted. The SDK computes its own verdict from jail-monkey's per-check breakdown and ignores those two, because merchants integration-test with live keys on emulators and an emulator is not the threat this gate exists for. Every strong root indicator (su binaries, Magisk, root-manager apps, remounted system paths) is still enforced.

The cost is custom-ROM detection on physical devices, the weakest signal in the set. On iOS, and on any build that exposes no breakdown, the SDK falls back to isJailBroken() unchanged.

Mock Mode

The SDK infers mock mode from the publicKey prefix:

PrefixModeEnvironment
live_LiveProduction
test_MockTest/sandbox
mock_MockTest/sandbox

Mock mode keys route to the sandbox backend. No real transactions are created.

In v4 a mock_ key passed validation and then ran against live. If you have been using a mock_ key and compensating for it, stop - v5 runs it in mock mode.

Connection Handling

The SDK detects connection errors from the WebView and fires onConnectionError:

  • iOS: NSURLErrorDomain codes (-1001 timeout, -1003 host not found, -1004 connection refused, -1009 offline)
  • Android: ERR_EMPTY_RESPONSE, ERR_CONNECTION_REFUSED, ERR_NAME_NOT_RESOLVED, ERR_INTERNET_DISCONNECTED, ERR_CONNECTION_TIMED_OUT, ERR_NETWORK_CHANGED

The checkout modal is automatically dismissed on connection errors.

Input Validation

The SDK validates inputs before starting the checkout:

FieldRule
publicKeyMust start with live_, mock_, or test_. Min 6 characters.
orderIdMust start with order_. Min 7 characters. Required when subscriptionId is absent.
subscriptionIdMust start with sub_. Trimmed and checked for emptiness. Required when orderId is absent.

Validation failures fire onSdkError with type: "validation_error" and the relevant field name. start() returns false.

Providing both orderId and subscriptionId (or neither) also fires onSdkError.

useGlomoCheckout Hook (Deprecated)

Deprecated - Legacy hook, will be removed in a future major version.

useGlomoCheckout is a legacy placeholder from the v1.x hook-based API. In v1.x, the equivalent hook (useLrsCheckout) provided reactive WebView state and rendering primitives that merchants used to build custom checkout UIs. In v3+, the inner checkout components are no longer exported, making this hook ineffective for custom rendering.

The hook's public return type (UseGlomoCheckoutReturn) exposes:

  • start() - identical to GlomoCheckoutRef.start(). Returns Promise<boolean>.
  • getStatus() - returns a point-in-time CheckoutStatus snapshot. Not reactive - does not trigger re-renders when status changes.

Use the GlomoCheckout component with a ref instead:

import React, { useRef } from "react";
import { GlomoCheckout, type GlomoCheckoutRef } from "@glomopay/react-native-sdk";

const checkoutRef = useRef<GlomoCheckoutRef>(null);

// Start checkout
const started = await checkoutRef.current?.start();

// Check status (point-in-time, same as hook)
const status = checkoutRef.current?.getStatus();

The component-based API provides the same functionality with proper lifecycle management.

Troubleshooting

start() returns false

Check onSdkError for details. Common causes:

  • Invalid publicKey format (must start with live_, mock_, or test_)
  • Invalid orderId format (must start with order_)
  • Invalid subscriptionId format (must start with sub_, non-empty after trimming)
  • Both orderId and subscriptionId provided (or neither)
  • Device is rooted or jailbroken, on a live_ key
  • Device security could not be verified on a live_ key, because jail-monkey is missing or its native module is not linked. Install it and rebuild the app; the console warning names this case.

Checkout opens but shows a blank screen

  • Verify network connectivity
  • Check that the publicKey and orderId are valid

Document downloads do nothing

The capability is only advertised when both react-native-blob-util and @react-native-documents/picker load successfully, and the checkout page falls back to its own behaviour when it is absent. Check, in order:

  • Both packages installed, and the app rebuilt afterwards - installing alone is not enough
  • Metro cache reset (npx react-native start --reset-cache)
  • Not running in Expo Go, which cannot load either package
  • On React Native < 0.79, @react-native-documents/picker pinned to 10.1.x

start() logs an ungated warning naming the package it could not load, and onSdkError fires once per mount with field: "file.save".

Camera permission denied

  • Ensure AndroidManifest.xml and Info.plist include camera permission declarations
  • onUserRefusedDevicePermissions fires when the user denies camera permission to your app, on Android only

A payment result arrives later than it used to

Expected on v5.2.0. The bank redirect overlay no longer reports outcomes; the main checkout page polls for them, so the callback fires when that poll resolves rather than the moment a bank page posts a result. The payload is the same, and the SDK still closes the overlay when it handles the result. See Origin Policy.

Expected on v6.0.0. That success carried no paymentId and no signature, so the SDK reports onSdkError with field: "paymentVerification" instead and leaves the checkout open. Read the order status from your backend. See Unverifiable payment successes.

An exhaustive switch over SdkError["field"] stopped compiling

Expected on v6.0.0. "paymentVerification" is a new member of the union; add a case for it. See SdkError.

onCheckoutStageChanged and onCheckoutClosed never fire

Checkout progress events are enabled per merchant and off by default, and they are LRS-only. Talk to your Glomo contact to turn them on. See Checkout progress events.

onUserJourneyCompleted not firing

  • Ensure you are passing onUserJourneyCompleted as a prop to GlomoCheckout
  • Verify the checkout flow involves an asynchronous payment (bank transfer or pay via bank). It never fires on an LRS order.

Exports

// Components
export { GlomoCheckout } from "@glomopay/react-native-sdk";

// Hooks (deprecated - use GlomoCheckout component with ref instead)
export { useGlomoCheckout } from "@glomopay/react-native-sdk";

// Enums
export { ASYNC_PAYMENT_EVENTS, TERMINATION_SOURCES } from "@glomopay/react-native-sdk";

// Checkout progress events - known values (new in v6.0.0)
export {
  CHECKOUT_EVENT_CONTRACT_VERSION,
  PAYMENT_STAGES,
  KYC_STAGES,
  CHECKOUT_CLOSE_REASONS,
  CHECKOUT_JOURNEY_TYPES,
  CHECKOUT_RESOURCE_TYPES,
  KNOWN_PAYMENT_STEPS_BY_STAGE,
  KNOWN_CHECKOUT_METHODS,
  KNOWN_LRS_PROVIDERS,
} from "@glomopay/react-native-sdk";

// Types
export type {
  GlomoCheckoutRef,
  GlomoCheckoutProps,
  GlomoCheckoutPayload,
  CheckoutStatus,
  GlomoUserJourneyCompletedPayload,
  GlomoTerminationPayload,
  GlomoColorScheme,
  UseGlomoCheckoutReturn, // deprecated
  SdkError,
} from "@glomopay/react-native-sdk";

// Checkout progress event types (new in v6.0.0)
export type {
  GlomoCheckoutStageChangedEvent,
  GlomoCheckoutClosedEvent,
  GlomoCheckoutFlow,
  GlomoCheckoutStage,
  GlomoCheckoutStep,
  GlomoCheckoutMethod,
  GlomoCheckoutProvider,
  GlomoCheckoutCloseReason,
  GlomoCheckoutJourneyType,
  GlomoCheckoutResource,
  GlomoCheckoutResourceType,
  GlomoCheckoutSegment,
} from "@glomopay/react-native-sdk";

Security

The SDK loads checkout pages in an isolated WebView. No PAN, CVV, or sensitive payment data passes through the React Native bridge - all sensitive input is handled within the WebView's sandboxed context.

Device integrity checking is required via jail-monkey (see Device Security Compliance).

As of v5.2.0, payment results and document saves are accepted only from Glomo checkout pages - a bank or 3-D Secure page in the redirect overlay can no longer report one. See Origin Policy.

As of v6.0.0, a payment success that carries no paymentId and no signature is not reported as a success at all, because there is nothing in it for your backend to verify. See Unverifiable payment successes.

To report a security vulnerability, email security@glomopay.com. Do not open a public GitHub issue for security reports.