Mobile Integration
IOS Integration
This guide will help you integrate the Dodo Payments API into your IOS mobile application.
iOS Integration
Using SFSafariViewController
Important: SFSafariViewController is required for Apple Pay integration. This is because Apple Pay requires the secure context and authentication capabilities that only SFSafariViewController provides. If your app needs to support Apple Pay payments, you must use 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
Note: Make sure to register your custom URL scheme in your app’s Info.plist file under URL Types.