flutter_ozow 1.1.7

SDKflutter
Platformandroidios

A simple flutter plugin to integrate Ozow payment gateway into your flutter app.

Flutter Ozow

Ozow links businesses of all sizes in South Africa with 47 million bank account holders to transact simply and securely. Sign up today!

For more information and reference, visit ozow.com.

Disclaimer: The developers of this package are independent and are not affiliated with Ozow. All Ozow images and trademarks are owned by Ozow.

pub package

Flutter_ozow is a Flutter package that simplifies the integration of the Ozow payment gateway into your Flutter apps. Utilizing the webview_flutter package, it loads the Ozow payment portal directly within your app for a seamless user experience.

Features

  • Easy Initialization: Minimal setup with required parameters.
  • URL Support: Optional URLs for payment outcomes such as success, error, and cancellation.
  • Extra Parameters: Allows for additional optional parameters for further customization.
  • In-App Payment: Built-in WebView for a seamless payment process.

Requirements

AndroidiOS
SupportSDK 19+ or 20+11.0+
android {
    defaultConfig {
        minSdkVersion 19
    }
}

Installation

To get started, add flutter_ozow to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flutter_ozow: ^latest_version

Run flutter pub get to install the package.

Usage

First, import the package:

import 'package:flutter_ozow/flutter_ozow.dart';

Then, use the FlutterOzow widget in your widget tree:

FlutterOzow(
  transactionId: 'your-transaction-id',
  privateKey: 'your-private-key',
  siteCode: 'your-site-code',
  bankRef: 'bank-reference',
  apiKey:'your-ozow-api-key',
  amount: 50.00,
  isTest: true,
  notifyUrl: 'your-notify-url'
  onComplete: (OzowTransaction? transaction, OzowStatus status) {
    //TODO: Something cool here    
  },
)

Parameters

ParameterDescriptionRequiredType
transactionIdUnique transaction ID from your backend.YesObject
privateKeyYour Ozow private key.YesString
siteCodeYour Ozow site code.YesString
bankRefReference for the user's bank statement.YesString
amountAmount to be paid.Yesdouble
apiKeyYour Ozow API key.YesString
isTestFlag to indicate test transactions.Yesbool
onCompleteCallback function for when the transaction is complete.NoFunction(OzowTransaction?,OzowStatus)?
notifyUrlURL for notifications.YesString
successUrlURL for successful payments.NoString?
errorUrlURL for failed payments.NoString?
cancelUrlURL for cancelled payments.NoString?
optional1Additional optional parameter.NoString?
optional2Additional optional parameter.NoString?
optional3Additional optional parameter.NoString?
optional4Additional optional parameter.NoString?
optional5Additional optional parameter.NoString?

Handling Ozow Responses

Handling Ozow responses is crucial for merchants to update their backend systems properly. There are two types of responses you'll need to manage:

Types of Responses

  1. Redirect Response
  2. Notification Response

For more information, you can visit Ozow Documentation.

Hash Validation

It's important to validate the received responses to confirm their authenticity. You can do this by generating a hash on your end and comparing it with the one sent by Ozow.

Hash String Order

The order in which you concatenate the variables to generate the hash string is crucial. Below is a PHP example showing how to generate this hash string based on the variables you've provided:

$hashStr = $siteCode . "ZA" . "ZAR" . $amount . $transactionId . $bank_reference . $customer . $optional1 . $optional2 . $optional3 . $optional4 . $optional5 . $notifyUrl . $successUrl . $errorUrl . $cancelUrl . $isTest . $privateKey;

Note: Omit any variables that you did not provide on the FlutterOzow widget.

By following these steps, you'll be able to effectively handle and validate Ozow responses in your merchant system.

Handling response on your flutter app

Refer to the example app

Examples

For more examples, see the example directory.

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.