Link Stripe to React Native
Use this guide after you create a Stripe account and deploy your own payments backend.
Quick Answer
Update the app config with your backend URL, your Stripe publishable key, your Apple Pay merchant ID if used, and Google Pay mode if used. Keep Stripe secret keys on the backend only.
1. Find the Payment Config
Depending on your app, the payment config is usually in one of these places:
- the app-specific config file under
src/; src/config/index.tsorsrc/config/index.tsx;src/core/payments/api/local/paymentMethods.ts.
Search the project for STRIPE_CONFIG, stripe_ENV, PUBLISHABLE_KEY, or ANDROID_PAYMENT_MODE.
2. Update the Backend URL
Point the app to your own payments backend:
stripe_ENV: {
API: {
baseURL: 'https://your-payments-backend.example.com/',
timeout: 9000,
},
},
This URL should be your hosted server, Firebase Function, Cloud Run service, or Heroku app.
3. Update Stripe Client Config
STRIPE_CONFIG: {
PUBLISHABLE_KEY: 'pk_test_your_publishable_key',
MERCHANT_ID: 'merchant.com.yourcompany.yourapp',
ANDROID_PAYMENT_MODE: 'test',
},
Use:
pk_test_...while developing;pk_live_...only for production;- your Apple Merchant ID when Apple Pay is enabled;
testor the production value expected by your app for Google Pay.
4. Confirm Secret Keys Are Not in the App
The React Native app must not contain:
sk_test_...sk_live_...whsec_...- PayPal client secrets
- Braintree private keys
Those values belong in backend environment variables.
5. Test Checkout
In Stripe test mode:
- Start the payments backend.
- Start the React Native app.
- Place a test order.
- Confirm the payment appears in the Stripe Dashboard.
- Confirm the order status is updated in your app backend.
- Test payment cancellation and payment failure.
Use Stripe's official test cards from the Stripe documentation when testing. Do not use real card numbers in development.
Troubleshooting
| Problem | Fix |
|---|---|
| App calls the wrong backend | Check stripe_ENV.API.baseURL and rebuild the app. |
| Payment sheet does not open | Confirm the backend returns the expected client secret and customer values. |
| Payment succeeds but order is not updated | Check webhook handling and order finalization on the backend. |
| Live payment fails | Confirm live publishable and secret keys are both configured for live mode. |
| Apple Pay does not appear | Confirm the merchant ID, Apple capability, Stripe Apple Pay setup, and real device testing. |