Requirements#
| Dependency | Minimum | Notes |
|---|---|---|
| React Native | 0.63+ | Bare app or Expo dev client (not Expo Go). |
| iOS | 13.0+ | Set by the podspec. Apple Pay networks have their own minimums. |
| Xcode | 16+ | Needed for the bundled OPPWAMobile.xcframework. |
| Android | minSdk 24 | Builds with compileSdk 35 / targetSdk 35 by default — overridable. |
| HyperPay account | — | Access token and entity ID(s), test and live. |
The native SDKs are bundled — OPPWA Mobile 7.11.0 on Android and the IPWorks 3DS SDK on both platforms — so there is nothing to download from HyperPay.
Installation#
npm install react-native-hyperpay-sdk
yarn add react-native-hyperpay-sdk
pnpm add react-native-hyperpay-sdk
iOS
cd ios && pod install
Android
Nothing to add — auto-linking registers the native module. Rebuild the app after installing.
Expo: this is a native module, so it doesn’t run in Expo Go. Use a bare app, or Expo with a custom dev client (npx expo prebuild).
Initialize#
Call HyperPay.init() once before any payment — in your entry file, or when the checkout screen mounts.
import HyperPay from 'react-native-hyperpay-sdk';
HyperPay.init({
shopperResultURL: 'com.yourapp.payments://result', // deep link back into your app
mode: 'TestMode', // 'TestMode' | 'LiveMode'
// Apple Pay (iOS only)
countryCode: 'SA', // ISO 3166-1 alpha-2
merchantIdentifier: 'merchant.com.yourapp',
companyName: 'Your Store', // shown as "Pay Your Store"
supportedNetworks: ['Visa', 'MasterCard', 'mada'],
currencyCode: 'SAR', // ISO 4217
});
Config options
| Option | Type | Description |
|---|---|---|
shopperResultURLrequired | string | Where the shopper returns after an async or 3-D Secure flow. Must match a scheme your app registers — see Return URL. |
mode | 'TestMode' | 'LiveMode' | Payment environment. Defaults to 'TestMode'. |
countryCodeApple Pay | CountryCodes | Merchant country, e.g. 'SA', 'AE', 'EG'. |
merchantIdentifierApple Pay | string | Merchant ID from your Apple Developer account. |
companyNameiOS | string | Name in the Apple Pay sheet, after “Pay”. |
supportedNetworksiOS | SupportedNetworks[] | Networks Apple Pay accepts — see networks. |
currencyCodeiOS | string | ISO 4217 currency for the Apple Pay sheet. |
Return URL#
3-D Secure challenges and async brands can take the shopper to the issuer’s page. HyperPay sends them back to your shopperResultURL, so register its scheme on both platforms.
iOS
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>payments</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.yourapp.payments</string>
</array>
</dict>
</array>
Android
<activity android:name=".MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.yourapp.payments" />
</intent-filter>
</activity>
Keep the scheme lowercase and unique to your app. You can override it per payment with the shopperResultURL param.
Quick start#
A complete checkout screen: get a checkout from your server, pay by card, then confirm and map the result.
import React from 'react';
import { ActivityIndicator, Alert, Button, View } from 'react-native';
import HyperPay, { useTransactionLoading } from 'react-native-hyperpay-sdk';
HyperPay.init({ shopperResultURL: 'com.yourapp.payments://result', mode: 'TestMode' });
const API = 'https://api.yourapp.com';
export function CheckoutScreen() {
const isLoading = useTransactionLoading();
const pay = async () => {
try {
// 1. Your server creates the checkout
const { checkoutID } = await fetch(`${API}/checkouts`, { method: 'POST' }).then(r => r.json());
// 2. Charge the card through the native SDK
await HyperPay.createPaymentTransaction({
paymentBrand: 'VISA',
holderName: 'Sara Ahmed',
cardNumber: '4200000000000000', // test card
expiryMonth: '12',
expiryYear: '2030',
cvv: '123',
checkoutID,
});
// 3. Your server asks HyperPay for the final result
const result = await fetch(`${API}/checkouts/${checkoutID}/status`).then(r => r.json());
const { status, description } = HyperPay.getPaymentStatus(result.code);
Alert.alert(status === 'successfully' ? 'Paid' : 'Payment failed', description);
} catch (e: any) {
Alert.alert('Payment error', e?.message ?? String(e));
}
};
return (
<View>
{isLoading && <ActivityIndicator size="large" />}
<Button title="Pay 100 SAR" onPress={pay} disabled={isLoading} />
</View>
);
}
Card payment#
Pass the card details and the checkoutID from your server. The SDK submits them straight to HyperPay and runs 3-D Secure if the issuer asks.
const response = await HyperPay.createPaymentTransaction({
paymentBrand: 'MADA', // any CardAccountBrands value
holderName: 'Sara Ahmed',
cardNumber: '4464040000000007',
expiryMonth: '12', // 2 digits
expiryYear: '2030', // 4 digits
cvv: '123',
checkoutID, // from your server
shopperResultURL: 'com.yourapp.payments://result', // optional override
});
// {
// status: 'successfully' | 'pending' | 'rejected' | 'risk' | 'chargeback' | 'declines',
// checkoutId: string,
// redirectURL: string // non-empty when the shopper was sent to a web page
// }
Always verify on your server. The response says how the in-app step ended, not whether money moved. Check the payment status from your backend before fulfilling — see Server integration.
The promise rejects when a payment can’t start — invalid parameters, a network error, or (Android) no foreground activity — so wrap calls in try / catch.
Apple Pay#
- Create a Merchant ID in your Apple Developer account and set up Apple Pay with HyperPay for it.
- In Xcode: Signing & Capabilities → + Capability → Apple Pay, then tick the Merchant ID.
- Pass
merchantIdentifier,countryCode,supportedNetworksandcurrencyCodetoinit().
import { Platform } from 'react-native';
if (Platform.OS === 'ios') {
const result = await HyperPay.applePay({
checkoutID,
amount: '100.00', // shown in the Apple Pay sheet
companyName: 'Your Store', // optional, overrides init
currencyCode: 'SAR', // optional, overrides init
});
// { resourcePath?: string } synchronous — verify now from your server
// { redirectURL?: string } async — verify when the shopper returns
}
Show the same amount as the checkout your server created.
Loading state#
useTransactionLoading() returns true while a transaction is processing. It listens to the native onProgress event, so there’s no state to manage.
const isLoading = useTransactionLoading();
return <Button title="Pay" onPress={pay} disabled={isLoading} />;
Outside a component
Pass onProgress as the second argument. The listener removes itself when loading ends.
await HyperPay.createPaymentTransaction(params, (isLoading) => {
store.setPaying(isLoading);
});
await HyperPay.applePay(params, (isLoading) => console.log('Apple Pay busy:', isLoading));
Payment status#
getPaymentStatus() maps a HyperPay result code to a description and one of five statuses. It runs locally — no network call.
HyperPay.getPaymentStatus('000.000.000');
// { code: '000.000.000', description: 'Transaction succeeded', status: 'successfully' }
HyperPay.getPaymentStatus('999.999.999');
// { code: '999.999.999', description: 'This status code is invalid', status: 'error' }
| Status | Meaning | What to do |
|---|---|---|
| successfully | Succeeded, including “review manually” successes. | Fulfil. Flag 000.400.* codes for review. |
| pending | Waiting on the shopper, bank or a risk check. | Don’t fulfil yet; check again later. |
| rejected | Declined by bank, 3-D Secure, risk or validation. | Show the reason; let the shopper retry. |
| Chargeback | Chargeback-related code. | Handle in your back office. |
| error | Unknown code. | Log it; treat as failed. |
Result code lookup#
Search the same table the SDK ships — by code, part of a code, or a word in the description.
Server integration#
Two endpoints on your backend complete the flow. Shown with Node and Express — any stack works, it’s plain HTTPS.
// Keep the token on the server — never ship it in the app
const HOST = 'https://eu-test.oppwa.com'; // live: https://eu-prod.oppwa.com
const TOKEN = process.env.HYPERPAY_TOKEN;
const ENTITY = process.env.HYPERPAY_ENTITY_ID; // MADA usually has its own entity ID
// 1. Create a checkout
app.post('/checkouts', async (req, res) => {
const body = new URLSearchParams({
entityId: ENTITY,
amount: '100.00',
currency: 'SAR',
paymentType: 'DB', // DB = debit (capture now)
merchantTransactionId: req.body.orderId,
});
const r = await fetch(`${HOST}/v1/checkouts`, {
method: 'POST',
headers: { Authorization: `Bearer ${TOKEN}` },
body,
});
const data = await r.json();
res.json({ checkoutID: data.id });
});
// 2. Get the payment result
app.get('/checkouts/:id/status', async (req, res) => {
const url = `${HOST}/v1/checkouts/${req.params.id}/payment?entityId=${ENTITY}`;
const r = await fetch(url, { headers: { Authorization: `Bearer ${TOKEN}` } });
const data = await r.json();
res.json(data.result); // { code: '000.100.110', description: '...' }
});
Pass result.code to HyperPay.getPaymentStatus() in the app. Full parameter list: HyperPay developer docs.
API reference#
import HyperPay, { useTransactionLoading } from 'react-native-hyperpay-sdk';
Stores the merchant configuration in the native SDK. Call once before any payment. Returns the applied config. See config options.
Submits a card payment for a server-created checkout and runs 3-D Secure if needed.
| Param | Type | Description |
|---|---|---|
paymentBrandrequired | CardAccountBrands | Card brand, e.g. 'VISA', 'MADA'. |
holderNamerequired | string | Name on the card. |
cardNumberrequired | string | Card number, digits only. |
expiryMonthrequired | string | Two digits, e.g. '07'. |
expiryYearrequired | string | Four digits, e.g. '2030'. |
cvvrequired | string | Security code. |
checkoutIDrequired | string | From your server’s /v1/checkouts call. |
shopperResultURL | string | Overrides the value from init(). |
onProgress | (isLoading: boolean) => void | Second argument; called as processing starts and ends. |
iOS only. Presents the Apple Pay sheet and submits the token to HyperPay.
| Param | Type | Description |
|---|---|---|
checkoutIDrequired | string | From your server. |
amount | string | Amount shown in the sheet, e.g. '100.00'. |
companyName | string | Overrides init(). |
currencyCode | string | Overrides init(). |
Maps a result code to { code, description, status }. Unknown codes return status: 'error'.
React hook: true while a transaction is in progress, false when it completes or fails.
TypeScript types#
import type {
Config,
CreateTransactionParams,
CreateTransactionResponseType,
ApplyPayParams,
ApplePayCallback,
PaymentStatus,
} from 'react-native-hyperpay-sdk';
type CreateTransactionResponseType = {
status: 'pending' | 'rejected' | 'risk' | 'chargeback' | 'declines' | 'successfully';
checkoutId: string;
redirectURL: string;
};
type ApplePayCallback = { redirectURL?: string; resourcePath?: string };
type PaymentStatus = {
code: string;
description: string;
status: 'successfully' | 'rejected' | 'Chargeback' | 'pending' | 'error';
};
Card brands#
Values for paymentBrand. Highlighted brands are the most used in the Gulf and Egypt; your HyperPay entity must have each brand enabled.
MADA cards go with paymentBrand: 'MADA' and a checkout created with your MADA entity ID. MEEZA (Egypt) and BCMC are processed asynchronously.
Apple Pay networks#
Values for supportedNetworks, matched case-insensitively. Devices ignore networks their iOS version doesn’t support.
| Network | Min iOS | Region |
|---|
Android configuration#
Optional: override the SDK versions the library builds with.
ext {
HyperPay_compileSdkVersion = 35
HyperPay_minSdkVersion = 24
HyperPay_targetSdkVersion = 35
}
Go-live checklist#
- Set
mode: 'LiveMode'and point your server ateu-prod.oppwa.comwith live credentials. - For iOS release builds, swap
ipworks3ds_sdk.xcframeworkforipworks3ds_sdk_deploy.xcframeworkin the podspec, as the package notes. - Use the right entity ID per brand on the server (e.g. a separate MADA entity).
- Confirm every payment from your server before fulfilling an order.
- Register the
shopperResultURLscheme on both platforms and test a 3-D Secure challenge end to end. - Enable Apple Pay with the production Merchant ID and certificate configured in HyperPay.
- Never log or store card numbers or CVV in your app or analytics.
Troubleshooting#
“The package doesn't seem to be linked”
Run cd ios && pod install, rebuild the app (a Metro reload isn’t enough), and make sure you aren’t in Expo Go.
Status comes back pending
The shopper may still be on a 3-D Secure or bank page. Check redirectURL, wait for the return through shopperResultURL, then query the status from your server.
The app doesn’t reopen after 3-D Secure
The scheme isn’t registered or doesn’t match shopperResultURL exactly. Re-check Return URL on both platforms.
The Apple Pay sheet doesn’t appear
Check the Apple Pay capability and Merchant ID in Xcode, that merchantIdentifier and countryCode were passed to init(), and that the device has a card on one of your networks.
Android build errors about SDK versions
Raise your app’s compileSdkVersion to 35, or set the overrides in Android configuration.
Roadmap (TODO)#
Today the SDK covers card brands and Apple Pay. HyperPay offers more payment methods than that, and several of them already exist in the bundled OPPWA SDK or in the package’s type files (VirtualAccountBrands). These are next.
Wallets
| Method | Brand value | Platform | Region | Status |
|---|---|---|---|---|
| Card payments | VISA, MADA, … | iOS · Android | Global | Shipped |
| Apple Pay | APPLEPAY | iOS | Global | Shipped |
| STC Pay | STC_PAY | iOS · Android | Saudi Arabia | TODO |
| Google Pay | GOOGLEPAY | Android | Global | TODO |
| Samsung Pay | SAMSUNGPAY | Android | Global | TODO |
| PayPal | PAYPAL | iOS · Android | Global | TODO |
Buy now, pay later
| Method | Brand value | Platform | Region | Status |
|---|---|---|---|---|
| Tabby | TABBY | iOS · Android | Gulf | TODO |
| valU | VALU | iOS · Android | Egypt | TODO |
| Klarna | KLARNA_PAYMENTS_* | iOS · Android | Europe | TODO |
Bank transfers & local methods
| Method | Brand value | Platform | Region | Status |
|---|---|---|---|---|
| SADAD | SADAD_VA | iOS · Android | Saudi Arabia | TODO |
| CliQ | CLIQ | iOS · Android | Jordan | TODO |
| Alipay | ALIPAY | iOS · Android | China | TODO |
| WeChat Pay | WECHAT_PAY | iOS · Android | China | TODO |
SDK features
Saved cards (tokenization)TODO
Store a card on the first payment and charge it later with a token, no card form.
Ready UI checkoutTODO
Open HyperPay’s prebuilt checkout screen listing every brand enabled on the entity.
Card brand detectionTODO
Detect VISA / MADA / MASTER from the card number as the shopper types.
Typed native errorsTODO
Reject promises with stable error codes instead of raw native messages.
Each method must also be enabled on your HyperPay entity. Need one sooner? Open an issue or send a pull request.
Example app#
A runnable app with card and Apple Pay flows lives in example/.
git clone https://github.com/RMabroukS/react-native-hyperpay-sdk cd react-native-hyperpay-sdk yarn bootstrap # dependencies + pods yarn example android yarn example ios
Contributing & license#
Issues and pull requests are welcome on GitHub — please use conventional commits (see CONTRIBUTING.md).
Released under the MIT License. HyperPay and OPPWA are trademarks of their owners; this is a community-maintained bridge.