flutter_ozow_web 1.0.2

SDKflutter
Platformweb

A web implementation of the flutter_ozow package.

Flutter Ozow web

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_web 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_web to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flutter_ozow_web: ^latest_version

Run flutter pub get to install the package.

Usage

First, import the package:

import 'package:flutter_ozow_web/flutter_ozow_web.dart';

Then, use the FlutterOzowWeb widget in your widget tree:

FlutterOzowWeb(
  transactionId: 'your-transaction-id',
  privateKey: 'your-private-key',
  siteCode: 'your-site-code',
  bankRef: 'bank-reference',
  amount: 50.00,
  isTest: true,
)

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
isTestFlag to indicate test transactions.Yesbool
notifyUrlURL for notifications.NoString?
successUrlURL for successful payments.NoString?
errorUrlURL for failed payments.NoString?
cancelUrlURL for cancelled payments.NoString?
customNameCustom name for the transaction.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 FlutterOzowWeb 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.

License

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