GithubHelp home page GithubHelp logo

muneersahel / shoket Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burnwood1911/shoket

0.0 0.0 0.0 134 KB

A Flutter wrapper for Shoket Payment API

License: MIT License

Dart 24.01% Kotlin 0.31% Swift 1.02% Objective-C 0.10% HTML 9.95% CMake 20.12% C++ 42.62% C 1.86%

shoket's Introduction

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.

shoket's People

Contributors

maen08 avatar burnwood1911 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.