Skip to content

@usestack/react-native

Terminal window
npx expo install @usestack/react-native expo-secure-store expo-crypto expo-web-browser expo-clipboard react-native-svg

Peer dependencies: react 18+, react-native 0.74+, and the five Expo / SVG packages above. All of them are in Expo Go. Add the Face ID text in app.json:

["expo-secure-store", { "faceIDPermission": "Your App uses Face ID to confirm Stack payments." }]
<StackProvider publishableKey="pk_test_..." biometricPrompt="Confirm your order">
<App />
</StackProvider>
Prop
publishableKey required pk_test_… / pk_live_…. A secret key is refused.
apiUrl https://api.usestack.cc In development, your computer’s LAN address, not localhost.
appearance { accent?: string; radius?: number }
biometrics true Confirm payments with Face ID / fingerprint. Off: the PIN or an email code instead.
biometricPrompt 'Confirm your payment' The text in the system prompt.
connectRedirectUrl Reserved for Continue with Stack, which is coming soon. It has no effect yet.
fetch global fetch For tests.
const { presentPaymentSheet, loading } = usePaymentSheet();
const result = await presentPaymentSheet({ clientSecret });

The same as on the web: it resolves with a PaymentResult when the sheet closes and never rejects.

type PaymentResult =
| { status: 'succeeded'; paymentIntentId: string }
| { status: 'canceled' }
| { status: 'failed'; error: { type: string; message: string } };

{ isConnected, contactMasked, firstName, signOut }. signOut() also deletes the device key.

Prop
onPress required
variant 'dark' 'dark' or 'light'.
loading false Shows a spinner.
disabled false
style Extra styles for the button.
  • formatMoney(minor, currency).
  • StackApiError.
  • Types: PaymentResult, PaymentIntent, Appearance.