Mobile Integration Guide
This guide will help you integrate the Dodo Payments API into your mobile applications.
Prerequisites
To integrate the Dodo Payments API into your mobile app, you’ll need:
- A Dodo Payments merchant account
- API Credentials (API key and webhook secret key) from dashboard
- A mobile app project (Android, iOS, Flutter, or React Native)
If you don’t have an account yet, you can get your business approved by contacting the founder or by filling out this form.
Dashboard Setup
-
Navigate to the Dodo Payments Dashboard
-
Create a product (one-time payment or subscription)
-
Test the checkout flow:
- Click the share button on the product page
- Open the link in your browser
- Use test card number:
4242 4242 4242 4242
- Enter any future expiration date and any 3-digit CVV
-
Generate your API key:
- Go to Settings > API
- Detailed Guide
- Copy the API key to use in your mobile app
-
Configure webhooks:
- Go to Settings > Webhooks
- Create a webhook URL for payment notifications
- Detailed Guide
- Copy the webhook secret key
Mobile Integration
Dodo Payments can be integrated into mobile apps using our payment links. The integration involves:
- Creating a payment link using our API
- Opening the payment link in a WebView or browser
- Handling the payment completion callback
Android Integration
Using WebView
Using Custom Tabs
iOS Integration
Using WKWebView
Using SFSafariViewController
Handling Apple Pay Redirects in SFSafariViewController
When integrating Apple Pay via SFSafariViewController in iOS, you can automatically detect payment completion without requiring users to manually tap the ‘Done’ button. This section explains how to implement this using custom URL schemes or Universal Links.
Objective
Enable seamless detection of Apple Pay completion by intercepting redirect URLs inside your iOS app.
Implementation Steps
-
Configure the Redirect URL When generating the Dodo Payments payment link, set the
redirect_url
to a custom scheme or Universal Link: -
Handle the Redirect in AppDelegate For custom URL schemes, implement this method:
-
Add Notification Observer in View Controller
-
Present SFSafariViewController
Benefits
- Apple Pay completes in Safari View
- Redirect triggers a URL your app can capture
- App dismisses SFSafariViewController automatically
- Provides a smooth, professional user experience without manual steps
Flutter Integration
React Native Integration
Best Practices
-
Security:
- Never store API keys in your app’s code
- Use secure storage solutions for sensitive data
- Implement proper SSL pinning
- Validate all payment responses
-
User Experience:
- Show loading indicators during payment processing
- Handle network errors gracefully
- Provide clear error messages
- Implement proper back navigation
-
Testing:
- Test with test card numbers in development
- Test different payment scenarios
- Test network error handling
- Test on different device sizes and OS versions
Additional Resources
For any questions or support, please contact our support team.