Installation
Install @plexy/react-native and complete the Expo or manual native setup
Installation
Add the package to your React Native project:
yarn add @plexy/react-native
# or
npm install @plexy/react-nativeBecause the SDK wraps native iOS and Android code, installation is finished in one of two ways:
- Expo integration — a config plugin applies all native changes during prebuild. Use this if your project uses Expo.
- Manual integration — you edit the native iOS and Android projects yourself. Use this for bare React Native apps.
Expo Integration
The SDK is not compatible with Expo Go — it contains native modules. It is designed for Continuous Native Generation (npx expo prebuild) and development builds.
Add the @plexy/react-native plugin to your app.json:
{
"expo": {
"plugins": ["@plexy/react-native"]
}
}The plugin accepts two options:
| Option | Description |
|---|---|
merchantIdentifier | Adds your Apple Pay Merchant ID to your iOS app's entitlements file. Empty by default. |
useFrameworks | Adjusts the native import on iOS when your Podfile has use_frameworks! enabled. |
With options, the plugin entry becomes an array:
{
"expo": {
"plugins": [
[
"@plexy/react-native",
{
"merchantIdentifier": "merchant.com.your-merchant-id",
"useFrameworks": true
}
]
]
}
}Then regenerate the native projects:
npx expo prebuild --cleanIf the plugin misbehaves, inspect the generated ios/ and android/ folders after npx expo prebuild --clean — the plugin's changes (AppDelegate handler, entitlements, activity setup) should be visible there.
Manual Integration
cd ios && pod installRedirect payment methods (3D Secure, bank apps) return the shopper to your app through a URL. Forward it to the SDK:
import Plexy
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return RedirectComponent.applicationDidOpen(from: url)
}If you also use RCTLinkingManager or another deep-linking library, call the SDK handler first:
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return RedirectComponent.applicationDidOpen(from: url) ||
RCTLinkingManager.application(app, open: url, options: options)
}For Universal Link support, also handle continue userActivity:
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL,
RedirectComponent.applicationDidOpen(from: url) {
return true
}
return RCTLinkingManager.application(
application,
continue: userActivity,
restorationHandler: restorationHandler
)
}Add a custom URL scheme (for example yourapp://) to your app so redirects can find their way back. You will use this scheme as the returnUrl in your configuration.
Follow the Apple Pay setup guide to create a merchant identifier and enable the Apple Pay capability in Xcode.
Provide the activity that hosts checkout to the SDK in MainActivity.kt:
import money.plexy.reactnative.PlexyCheckout
import android.os.Bundle
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null)
PlexyCheckout.setLauncherActivity(this)
}Needed for standalone (non-Drop-in) redirect components. Add to your checkout activity in AndroidManifest.xml:
<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="yourapp" android:path="/payment" />
</intent-filter>Also for standalone redirect components, forward incoming intents in MainActivity.kt:
import android.content.Intent
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
PlexyCheckout.handleIntent(intent)
}The native payment UI requires your app theme to extend Theme.MaterialComponents:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Your configuration here -->
</style>Verify the install
Wrap a screen with <PlexyCheckout> and check isReady from the hook:
import { Text } from 'react-native';
import { PlexyCheckout, usePlexyCheckout } from '@plexy/react-native';
function Probe() {
const { isReady } = usePlexyCheckout();
return <Text>{isReady ? 'SDK ready' : 'Loading…'}</Text>;
}If the app builds and renders without a native-module error, installation is complete. Next, set up your configuration and pick a flow: