GitHub Repository
The Expo, React Native, and Dodo Payments boilerplate.
Overview
The Expo boilerplate is a working Expo app that sells a subscription plan through Dodo Payments hosted checkout. It has two parts: an Expo Router app in TypeScript, and a small Express server inserver/ that creates checkout sessions with your API key. The app asks the server for a checkout URL, opens it in the system browser with expo-web-browser, and receives the result through a deep link.
The boilerplate uses Expo SDK 54, Expo Router, and TypeScript. The API key stays on the server. The app only knows the server’s URL.
Prerequisites
- Node.js 18 or later.
- Expo CLI or EAS CLI.
- A Dodo Payments account with a product. Create the product under Products in the dashboard.
- An iOS Simulator, an Android Emulator, or a physical device.
Quick Start
1
Clone the Repository
Clone the boilerplate repository and go to the project directory:
2
Get Your API Credentials
Get your API key from the Dodo Payments dashboard in test mode:
- API Key: Go to Developer → API Keys in your dashboard.
3
Configure Environment Variables
The app and the server each read their own In In the root
.env file. Copy both example files:server/.env, add your API key. DODOPAYMENTS_RETURN_URL must use the scheme from app.json, which is dodoexpo in the boilerplate:server/.env
.env, set EXPO_PUBLIC_BACKEND_URL to the server’s URL, for example http://localhost:3000. The app sends checkout requests to EXPO_PUBLIC_BACKEND_URL/checkout.Then open server/server.js and replace your-product-id with the ID of your product. Product IDs start with pdt_.4
Install Dependencies
Install the packages for the app and for the server:
5
Start the Development Server
Start the backend in one terminal, then start Expo in a second terminal:Press
i for the iOS Simulator or a for the Android Emulator, or scan the QR code on your device. The project includes expo-dev-client, and the dodoexpo:// return link needs your app’s own scheme, so run the app in a development build (npx expo run:ios or npx expo run:android) rather than Expo Go.A physical device can’t reach localhost on your computer. To test on a device, set EXPO_PUBLIC_BACKEND_URL to your computer’s local network address, for example http://192.168.1.10:3000.The home screen shows a plan card with a checkout button. Tap it to open checkout, pay with the test card
4242 4242 4242 4242, and the app opens its payment result screen.What’s Included
The boilerplate includes:Checkout Integration
A demo server that creates checkout sessions, and an app service that requests and opens them.
Payment Handling
A result screen that reads the
status from the dodoexpo://payment/result deep link and shows success or failure.TypeScript Support
TypeScript configuration with types for the checkout request and response.
Expo Router
File-based navigation with Expo Router, including a tab layout and the payment result route.
Project Structure
These are the main files in the repository:Next Steps
After the boilerplate runs:1
Create Your Products
Add products in your Dodo Payments dashboard, and use their IDs in
server/server.js.2
Customize the Integration
Change the plan text in
config/product.ts, and change the app name, scheme, and bundle identifiers in app.json. If you change the scheme, update DODOPAYMENTS_RETURN_URL to match.3
Test on Real Devices
Test the payment flow and the deep-link return on physical iOS and Android devices.
4
Go Live
Replace the demo server with your own backend that authenticates users and grants access from webhooks. Then switch to a live mode API key and build your app for production.
Building for Production
Build store-ready binaries with EAS Build:1
Install EAS CLI
2
Configure EAS
The repository has no
eas.json. This command creates one:3
Build Your App
For iOS:For Android:
Additional Resources
Mobile Integration Guide
The mobile checkout SDKs, deep-link setup, and mobile checkout settings.
Integration Guide
Checkout sessions, payment links, and webhooks.
API Reference
Every Dodo Payments API endpoint.
Support
For help with the boilerplate:- Ask questions in the Discord community.
- Report issues in the GitHub repository.
- Email the support team.