Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
/ shoket Public archive
forked from Burnwood1911/shoket

A Flutter wrapper for Shoket Payment API

License

Notifications You must be signed in to change notification settings

ShoketHQ/shoket

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shoket Flutter Wrapper

A simple Flutter wrapper for the shoket payment API, for more information on the API visit Shoket Official website.

Getting Started

Prerequisites

  • Ensure you have your API keys.

Installation

  • Add the dependency

In your pubspec.yaml file add:

shoket: 0.0.4

Import in your file:

import"package:shoket/shoket.dart";

run flutter pub get

Usage

  1. Create a Shoket instance by calling the constructor Shoket(). The constructor accepts an API KEY as parameter. It returns an instance of Shoket which we then call the async method .charge() or .verify() on.
final shoket = Shoket(apiKey: "apiKey");
  1. Create a payment object with the payment details
var paymentDetails = Payment(
                      amount: "1000",
                      customerName: "John DOe",
                      email: "[email protected]",
                      numberUsed: "255717000000",
                      channel: "Halotel");
  1. Get the response by calling .charge() method passing paymentDetails object as a parameter. NOTE chargeresponse can be null
final ChargeResponse? response = await shoket.charge(paymentDetails);
  1. Handle the response
if (response == null) {
  // the transaction failed
} else {
  var status = response.status;
  if (status == "success") {
    // provide value to customer
  } else {
    // check message
    print(response.message);
  }
}

Extra

Check example app provided for further assistance

Credits

License

This project is licensed under the MIT License.

About

A Flutter wrapper for Shoket Payment API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 42.7%
  • Dart 24.0%
  • CMake 20.1%
  • HTML 9.9%
  • C 1.9%
  • Swift 1.0%
  • Other 0.4%