Before proceeding, make sure you’ve read the Online Payments Guide to understand how to create payment requests and handle webhooks.Integrate HitPay payments into your mobile app by opening the checkout URL in an in-app browser. This provides a seamless payment experience while keeping users within your app.
Open the HitPay checkout URL in an in-app browser for the best user experience. Use SFSafariViewController on iOS or Chrome Custom Tabs on Android - they load faster than WebViews and share cookies with the system browser.
Copy
Ask AI
import SafariServicesclass PaymentViewController: UIViewController, SFSafariViewControllerDelegate { func openCheckout(paymentUrl: String) { guard let url = URL(string: paymentUrl) else { return } let safariVC = SFSafariViewController(url: url) safariVC.delegate = self present(safariVC, animated: true) } // Handle redirect back to your app func safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo URL: URL) { if URL.host == "yourdomain.com" && URL.path == "/payment/success" { controller.dismiss(animated: true) { self.showPaymentSuccess() } } } func safariViewControllerDidFinish(_ controller: SFSafariViewController) { // User closed the browser - check payment status via backend }}
In many cases, presenting a webview may not provide the best user experience for your mobile app. This is especially true for QR code-based payment methods where users need to scan a code with their banking app.When to use each approach:
Payment Method
Recommended Approach
Card payments
In-app browser
PayNow, QRPH, DuitNow QR
Embedded QR codes
For QR code payment methods like PayNow, QRPH, or DuitNow QR, use the Embedded QR Code API to generate a native QR code and display it directly in your app. This provides a smoother experience as users don’t need to leave your app to view the QR code.Build your own payment method selectorFor the best user experience, consider building your own payment method selection screen:
Display available payment methods to the user
If the user selects a card payment → Use the in-app browser approach
If the user selects a QR code method (PayNow, QRPH, DuitNow QR) → Use the embedded QR code approach
This hybrid approach gives you full control over the UI while leveraging the most appropriate checkout flow for each payment type.