@usestack/react-native
npx expo install @usestack/react-native expo-secure-store expo-crypto expo-web-browser expo-clipboard react-native-svgPeer 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>
Section titled “<StackProvider>”<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. |
usePaymentSheet()
Section titled “usePaymentSheet()”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.
Guests can pay by card or bank transfer without signing in. The sheet asks for first name, last
name and email if the payment intent does not include them, then offers optional Stack setup
after payment. Stack Balance appears as ₦0 for a guest and is disabled. Stack records a
provisional identity and sends a receipt after a successful payment.
type PaymentResult = | { status: 'succeeded'; paymentIntentId: string } | { status: 'canceled' } | { status: 'failed'; error: { type: string; message: string } };useStackSession()
Section titled “useStackSession()”{ isConnected, contactMasked, firstName, signOut }. signOut() also deletes the device
key.
<PayWithStackButton>
Section titled “<PayWithStackButton>”| Prop | ||
|---|---|---|
onPress |
required | |
variant |
'dark' |
'dark' or 'light'. |
loading |
false |
Shows a spinner. |
disabled |
false |
|
style |
Extra styles for the button. |
Other exports
Section titled “Other exports”formatMoney(minor, currency).StackApiError.- Types:
PaymentResult,PaymentIntent,Appearance.