React Native SDK
React Native SDK for Elebne Pay checkout — render the hosted embed in a WebView, re-verify server-side, and show a native success screen.
React Native SDK
@elebne/pay-react-native is the client SDK for Elebne Pay on React Native — the RN counterpart of @elebne/pay-react. Same behaviour, same backend contract: it renders the hosted /embed surface in a react-native-webview WebView instead of an iframe, re-verifies the result server-side, and shows a native success screen.
Install
npm install @elebne/pay-react-native react-native-webviewreact, react-native, and react-native-webview (>= 13) are peer dependencies.
@elebne/pay-react-native is at 0.1.0. While it is being published to npm it is also available via the Elebne private registry — request access from dev@elebne.ai.
The three flows
The API mirrors the React SDK exactly — see that page for the props tables. The three flows are identical.
Merchant backend (recommended). Your server mints the intent with its sk_ key (PHP / Java) and returns the clientSecret.
import { ElebneCheckoutProvider, EmbedCheckout } from '@elebne/pay-react-native';
<ElebneCheckoutProvider
config={{ env: 'production' }}
options={{ fetchClientSecret: async () => (await createIntentOnMyServer()).clientSecret }}
>
<EmbedCheckout
presentation="modal"
onPaid={(s) => console.log('paid', s.referenceNumber)}
onCancelled={() => {}}
onError={(e) => console.error(e.code)}
/>
</ElebneCheckoutProvider>No backend (stored price).
<ElebneCheckoutProvider
config={{ env: 'production' }}
options={{ publishableKey: 'pk_live_…', priceId: 'abc123', quantity: 2 }}
>
<EmbedCheckout presentation="inline" onPaid={handlePaid} />
</ElebneCheckoutProvider>Verify callback (legacy).
<ElebneCheckoutProvider
config={{ env: 'production' }}
options={{ publishableKey: 'pk_live_…', merchantOrderId: 'ORDER-1', flow: 'verify' }}
>
<EmbedCheckout onPaid={handlePaid} />
</ElebneCheckoutProvider>Presentation
presentation="modal"opens a full-screen RN<Modal>with a header and close control.cancelOnClosealso cancels the intent when the modal is dismissed.presentation="inline"mounts the WebView in the view tree, with a height driven by the embed's resize events (default 480).
Guarantees
- Server re-verification — the WebView
postMessage(delivered viawindow.ReactNativeWebView.postMessage) is only a hint; the SDK callsGET /checkout/sessionand firesonPaidonly when the server confirms a terminalPAID. - No secret leakage — the
clientSecrettravels only in the WebView URL fragment (#cs=), never a query string; nosk_key ever touches the SDK. - Fallback poll — if the bridge message never arrives, a 3 s poll of
GET /checkout/sessionstill settles the checkout (disable withpoll={false}).
Success screen & imperative control
A native <SuccessScreen> renders on a confirmed terminal status. Override it with renderSuccess={(session) => <MyView/>}, or disable it with showSuccess={false} and handle onPaid yourself. useElebneCheckout() (inside the Provider) returns { status, session, error, cancel }.
Environments & sandbox
config={{ env: 'production' }} // https://api.elebne.ai/api/v1 + https://elebne.ai/embed
config={{ env: 'staging' }} // https://api.staging.elebne.ai/api/v1 + https://pay.staging.elebne.ai/embed
// Local dev only — override both endpoints
config={{ baseUrl: 'http://localhost:3000/api/v1', embedUrl: 'http://localhost:3100/embed' }}Sandbox vs live is decided by the key: a pk_test_ / sk_test_ key yields a sandbox intent, surfaced as session.sandbox (a badge on the success screen). There is no separate sandbox hostname.
Next steps
- React SDK — the full props reference (same API)
- Flutter SDK — the same checkout for Flutter
- PHP SDK / Java SDK — mint the
clientSecretfor Flow A - Webhooks — confirm payments server-side
Was this page helpful?
React SDK
React web SDK for Elebne Pay checkout — render the hosted embed, re-verify the result server-side, and show a success screen. Three integration flows.
Flutter SDK
Flutter SDK for Elebne Pay checkout — render the hosted embed in a WebView, re-verify server-side, and show a native success screen.