Overview
The app uses the@stripe/stripe-react-native SDK to handle payment flows. While the current implementation uses a mock payment service for demonstration purposes, the infrastructure is fully prepared for real Stripe integration.
Payment features
TableOrder’s payment system includes:- Virtual card preview: Real-time card number and expiry masking
- Payment validation: Client-side checks for card number, expiry, and CVV format
- Mock processing: Simulated payment intent with realistic latency
- Error handling: Graceful failure states with retry options
- Receipt generation: Automatic PDF ticket creation via
expo-print - Receipt dispatch: PDF sent to Telegram for back-office tracking
- Push notifications: Local notification on successful payment
Getting started
Create a Stripe account
Visit stripe.com/register and sign up for a free account. Stripe provides test mode access immediately—no identity verification required for development.
Obtain your publishable key
Navigate to Developers → API Keys in the Stripe Dashboard.Copy your Publishable key—it starts with
pk_test_ for test mode or pk_live_ for production.Publishable keys are safe to include in client applications. They can only create payment intents and cannot access sensitive account data.
Configure the plugin
The Stripe plugin is already configured in
app.json:app.json
The
merchantIdentifier is required for Apple Pay integration (iOS only). Google Pay is enabled by default for Android.Mock payment implementation
The current payment service simulates a real Stripe integration for demonstration purposes. The implementation is located insrc/lib/core/payments/paymentService.ts:
src/lib/core/payments/paymentService.ts
Why mock payments?
Real Stripe payment processing requires a backend server to:- Create a Payment Intent securely (using your secret key)
- Return the
client_secretto the mobile app - Confirm the payment after card collection
- Handle webhooks for payment status updates
Payment flow architecture
Here’s how the mock payment integrates with the rest of the app:Implementing real Stripe payments
To replace the mock service with real Stripe integration:Initialize the Stripe provider
Wrap your app with the Stripe provider in your root layout:
app/_layout.tsx
Replace mock service with real payment
Update
paymentService.ts to call your backend and use Stripe hooks:Testing card numbers
When you implement real Stripe payments, use these test cards in test mode:| Card Number | Brand | Behavior |
|---|---|---|
4242 4242 4242 4242 | Visa | Succeeds |
4000 0000 0000 9995 | Visa | Declined (insufficient funds) |
4000 0000 0000 0002 | Visa | Declined (generic) |
4000 0025 0000 3155 | Visa | Requires authentication (3D Secure) |
Use any future expiry date (e.g.,
12/34) and any 3-digit CVV (e.g., 123) for test cards.Security best practices
Follow these guidelines when implementing real payments:
- Never log or store raw card numbers
- Use HTTPS for all API communication
- Validate amounts server-side (never trust client input)
- Implement idempotency keys to prevent duplicate charges
- Use Stripe’s SCA-ready payment flow for European customers
- Set up proper error handling for network failures
- Monitor failed payments in the Stripe Dashboard
Troubleshooting
”Stripe key not configured” error
Cause: MissingEXPO_PUBLIC_STRIPE_KEY in .env
Solution: Add the key and restart the dev server. Rebuild the native app if using a production build.
Payments always fail immediately
Cause: The mock service has a 15% failure rate by design Solution: This is expected behavior. Try multiple times to test both success and failure flows.Google Pay button not showing on Android
Cause: Google Pay requires additional setup for production Solution: For development, Google Pay works in test mode automatically. For production, register your app in the Google Pay Business Console.Apple Pay not available on iOS
Cause: Missing merchant identifier or incorrect entitlements Solution: VerifymerchantIdentifier in app.json matches your Apple Developer account. Ensure Apple Pay capability is enabled in Xcode.
Payment limits and pricing
Stripe pricing for standard card payments:| Region | Rate |
|---|---|
| US | 2.9% + $0.30 per successful charge |
| Europe | 1.4% + €0.25 per successful charge |
| International | 3.9% + $0.30 per successful charge |
No monthly fees or setup costs. You only pay for successful transactions.
Next steps
Mapbox setup
Configure delivery routing
Telegram bot
Enable receipt dispatch