πŸ’³ Ozow Flutter SDK

The easiest way to accept payments in South Africa using Flutter.

πŸš€ 3 lines to get started πŸ” Production-ready architecture πŸ”₯ Firebase integration included

Get Started β€’ Production Setup β€’ Example App


πŸŽ₯ Demo

Watch the plugin in action:

πŸ‘‰ https://youtube.com/shorts/H1KOdCjFCEk?feature=share

This demo shows:

  • Payment flow
  • Ozow checkout UI
  • Result handling (success / cancel / error)

ozow_payment_plugin

pub.dev Flutter Platform Production Ready License

A production-ready Flutter SDK for the Ozow payment gateway, built for African developers.

Accept Card, Pay by Bank, PayShap, and Voucher payments with minimal setup, secure backend support, and Firebase-ready architecture.

⚑ Built for startups, fintech apps, marketplaces, and ride-hailing platforms.


✨ Features

  • βœ… 3 lines of code to start accepting payments
  • βœ… Secure WebView checkout (Ozow hosted page)
  • βœ… All payment methods β€” Card, Pay by Bank, PayShap, Vouchers
  • βœ… SHA512 signing support
  • βœ… Result callbacks β€” success, cancelled, error, pending
  • βœ… Bank-branded UI buttons
  • βœ… PCI compliant β€” no card data handled by your app
  • βœ… Firebase-ready architecture
  • βœ… Android, iOS & Web support

πŸš€ Quick Start (Testing Only)

final result = await OzowPaymentPlugin.startPayment(
  context: context,
  config: OzowConfig(
    siteCode: 'YOUR_SITE_CODE',
    privateKey: 'YOUR_PRIVATE_KEY',
    apiKey: 'YOUR_API_KEY',
    amount: 150.00,
    transactionReference: 'ORDER-001',
    bankReference: 'My Store',
  ),
);

⚠️ This method is for testing only β€” do NOT use in production


In production:

  • Private keys stay on your backend
  • Hash is generated securely
  • Flutter app never exposes secrets
final paymentData = await MyBackend.createPayment();

final result = await OzowPaymentPlugin.startPayment(
  context: context,
  config: OzowConfig(
    siteCode: paymentData.siteCode,
    privateKey: '',
    apiKey: paymentData.apiKey,
    amount: paymentData.amount,
    transactionReference: paymentData.reference,
    bankReference: 'My Store',
    hashCheck: paymentData.hash,
  ),
);

πŸ—οΈ Architecture (Production)

Flutter App ⬇ Firebase Cloud Function / Backend ⬇ Secret Manager / Environment Variables ⬇ Ozow API


πŸ” Production Backend Setup (Firebase)

Follow these steps to securely integrate Ozow in production.


1️⃣ Install Node.js

Download and install Node.js (LTS).

Verify:

node -v
npm -v

2️⃣ Install Firebase CLI

npm install -g firebase-tools
firebase --version

3️⃣ Login to Firebase

firebase login

4️⃣ Initialize Firebase Functions

From your project root:

firebase init functions

Select:

  • JavaScript
  • Your Firebase project
  • Install dependencies

5️⃣ Add your Cloud Function

Inside functions/index.js:

const functions = require("firebase-functions");
const crypto = require("crypto");

exports.createOzowPayment = functions.https.onRequest((req, res) => {
  const { amount, reference } = req.body;

  const siteCode = process.env.OZOW_SITE_CODE;
  const privateKey = process.env.OZOW_PRIVATE_KEY;

  const data = `${siteCode}${reference}${amount}${privateKey}`;

  const hash = crypto
    .createHash("sha512")
    .update(data)
    .digest("hex");

  res.json({
    siteCode,
    apiKey: process.env.OZOW_API_KEY,
    amount,
    reference,
    hash,
    bankReference: "My Store",
    isTest: true
  });
});

6️⃣ Install dependencies

cd functions
npm install firebase-admin firebase-functions

7️⃣ Add environment variables

Create functions/.env:

OZOW_SITE_CODE=YOUR_SITE_CODE
OZOW_API_KEY=YOUR_API_KEY
OZOW_PRIVATE_KEY=YOUR_PRIVATE_KEY

8️⃣ Protect your secrets

Add to .gitignore:

functions/.env

9️⃣ Deploy your functions

From project root:

firebase deploy --only functions

πŸ”Ÿ Use your backend URL

After deployment, Firebase will give you:

https://YOUR_REGION-YOUR_PROJECT.cloudfunctions.net/createOzowPayment

Use this in your Flutter app.


πŸ§ͺ Optional: Test before deploy

cd functions
node -e "require('./index.js'); console.log('OK')"

⚠️ Common Errors

npm not recognized β†’ Install Node.js and restart terminal

404 from backend β†’ Check your function URL is correct

Cannot find module β†’ Check folder structure and file names


πŸ”₯ Firebase Integration

Remote Config (Safe Usage)

Use Remote Config for:

  • Feature toggles
  • Payment enable/disable
  • Test vs live mode
final isTest = remoteConfig.getBool('ozow_is_test');

⚠️ Never store secrets in Remote Config


πŸ“¦ Result Handling

if (result.isSuccess) {
  // Payment successful
} else if (result.isCancelled) {
  // User cancelled
} else if (result.isError) {
  // Payment failed
} else if (result.isPending) {
  // Processing
}

🎯 Use Cases

  • Ride-hailing apps
  • E-commerce platforms
  • Wallet systems
  • Subscription apps
  • Fintech products

🏦 Supported Payments

  • πŸ’³ Card (Visa / Mastercard)
  • 🏦 Pay by Bank (EFT)
  • ⚑ PayShap
  • 🎫 Vouchers

πŸ” Security

  • Hosted checkout (Ozow)
  • No card data handled in-app
  • SHA512 request signing
  • TLS encryption
  • Backend-secured secrets

⚠️ Important

Never store your Ozow private key in your Flutter app.


🀝 Contributing

Pull requests are welcome.


πŸ“ž Support

  • GitHub Issues
  • Ozow Support

Built with ❀️ by Tilly Legodi for the African Flutter community πŸ‡ΏπŸ‡¦