ozow_payment_plugin 1.0.1
ozow_payment_plugin: ^1.0.1 copied to clipboard
A Flutter Plugin for Ozow payment gateway - Supports Card, Pay by Bank and PayShap
π³ 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 #
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
π Production Integration (Recommended) #
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 πΏπ¦