Overview
The Novac iOS SDK allows you to easily collect payments within your iOS apps using Novac’s secure checkout experience. It provides APIs for payment initialization and verification, along with a built-in UI that handles the full checkout flow for you.Prerequisites
See details
See details
Before you begin, ensure that you’ve completed the following steps:
- Obtain your API keys: required for making authenticated API calls.
- Xcode project with Swift Package Manager support
- A Novac account with dashboard access
Installation
Initialize the SDK
Before launching any payment, you need to set up two things: anAPIClient (which authenticates your requests using your API key) and a PaymentCoordinator (which manages the entire checkout flow). Both are configured inside your ViewController.
You’ll need your apiKey from the Novac dashboard. The optional CustomTheme lets you style the checkout UI to match your brand.
Launch the Checkout Flow
Once the coordinator is set up, you can trigger a payment from any user action — in this case, a button tap. You create aPaymentRequest with the transaction details and pass it to the coordinator, which handles the rest.
Handle Payment Outcomes
ThePaymentDelegate protocol defines three callback methods that the SDK calls depending on what happens during checkout. Implement all three in your ViewController to handle every possible outcome.
Configure Redirect URL
After a user completes checkout in the SDK’s webview, the payment gateway redirects them back to your app using a URL scheme. You need to register this scheme in yourInfo.plist so iOS knows to route that redirect back to your app.
exampleapp with your own unique scheme. This value must match whatever redirect URL is configured in your Novac dashboard.
Advanced Usage
Ensure you use your Novac test key during development.
- Always use a unique
referencevalue for each transaction, duplicate references will be rejected. - Start with small test amounts (₦100) to validate your integration before going live.
- Check your sandbox dashboard to confirm transaction results and inspect any errors.