iOS Integration Guidelines
For end‑to‑end context and field definitions, see Hosted Payment Page.
Integration Steps
On iOS, integrating the Hosted Payment Page involves four steps:
Initiating a payment request on your backend
Opening the Hosted Page in the device browser
Handling the redirect back into your app
Confirming the transaction status.
1. Initiate Payment Request
Your backend calls Codapay’s Payment/init API to create a transaction and uses the returned txnId to build the Hosted Page URL:
Sandbox
https://sandbox.codapayments.com/airtime/begin?browser_type=mobile-web&txn_id={txnId}Production
https://airtime.codapayments.com/airtime/begin?browser_type=mobile-web&txn_id={txnId}Return this URL to your app.
2. Display Hosted Payment Page
From your iOS app, open the Hosted Page URL in the system's default browser
3. Redirect URLs
After payment success or failure, Codapay redirects the user to your configured Redirect URL. On iOS, you need to capture this redirect and return the user into your app session.
Two options are available:
Universal Links (recommended) – Provide the smoothest user experience and better security.
Custom URL Schemes (alternative) – Simpler to implement, but can be intercepted and are less reliable.
4. Check Payment Status
Do not rely only on the redirect URL, since it can be forged. Always check the actual status with Codapay.
Webhook notification (recommended): Codapay sends the final result to your backend.
Inquiry API: If the webhook has not yet been received, your backend can query the transaction status.
Best practice:
Codapay sends webhook notification to your backend.
Browser redirects user back into the app (Universal Link or scheme).
App queries backend for the result.
Backend updates the user’s inventory or entitlements.
Implementation Details
This section provides the step-by-step configuration needed to support redirects on iOS. Use this if you need the full Apple setup.
Universal Links (recommended)
Configure Associated Domains in your Apple Developer account:
In Apple Developer, create or edit your App Identifier and enable Associated Domains.
Note your Team ID and Bundle ID — together they form the App ID you will declare in the JSON file.
Create and host
apple-app-site-associationon your domainDefine the file content using your App ID (Team ID + Bundle ID) and the URL paths you want to match (e.g., success, pending, failure). See an example below.
Save the file exactly as
apple-app-site-associationUpload the file to
https://<your-domain>/.well-known/apple-app-site-association
Example:
Enable Associated Domains in Xcode: In Signing & Capabilities, add Associated Domains and register your domain with the
applinks:prefixHandle Universal Links in the app
Custom URL Schemes (alternative)
Use only when Universal Links cannot be used. Behaviour is undefined if multiple apps register the same scheme.
Universal Links are recommended for a smoother experience.
Register the scheme in Info.plist
Add your custom scheme under CFBundleURLTypes
Example:
Handle the scheme in the app
Security Considerations
Do not trust redirect URLs alone. They can be forged. Always cross-check payment status with your backend using webhook or inquiry
Validate all incoming URLs. Ensure they come from your expected domain (for Universal Links) or your registered scheme (for custom URLs)
Universal Links are safer than custom schemes. They verify domain ownership and prevent interception by other apps
Last updated
Was this helpful?