Overview
The Novac Flutter plugin is the official plugin for the Novac Payment Gateway. It enables you to accept payments directly within your Flutter apps with support for cards, bank transfers, and mobile money — all with a customizable, secure checkout UI.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.
- A Flutter project with a minimum iOS version of 12.0 and minimum Android SDK version of 21
- A Novac account with dashboard access
Installation
Platform Setup
Because the SDK uses a webview for checkout, both iOS and Android need a URL scheme registered so that users are redirected back to your app after payment completes.iOS
Add the following to yourios/Runner/Info.plist. This registers a custom URL scheme that the payment gateway uses to deep link back into your app:
Android
Add the following intent filter inside the relevant<activity> block in your android/app/src/main/AndroidManifest.xml. This tells Android to route the payment redirect back to your app:
yourappscheme on both platforms with the same unique scheme. This value should also match whatever redirect URL is configured in your Novac dashboard.
Initialize the SDK
Before launching any payment, callNovacPaymentPlugin.initialize() once. Typically, at app startup or before your first checkout. This authenticates your app with Novac and optionally applies a custom theme to the checkout UI.
Launch the Checkout Flow
Once the SDK is initialized, calllaunchCheckout() to start a payment. The method is asynchronous and returns a PaymentResult object you can inspect to determine what happened.
launchCheckout(). Check its properties to determine the outcome of the payment.
Verify a Payment
After a successful checkout, you can independently verify the transaction status on your backend or client usingverifyPayment(). Pass the transaction reference returned from the checkout result:
verifyPayment(). Use this to confirm a transaction’s final status.
Error Handling
Wrap your checkout call in atry/catch block to handle both expected payment outcomes (failure, cancellation) and unexpected runtime errors gracefully:
- 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.