Last updated:
0 purchases
shoket
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
copied to clipboard
Import in your file:
import"package:shoket/shoket.dart";
copied to clipboard
run flutter pub get
Usage #
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");
copied to clipboard
create a payment object with the payment details
var paymentDetails = Payment(
amount: "1000",
customerName: "John DOe",
email: "[email protected]",
numberUsed: "255717000000",
channel: "halotel");
copied to clipboard
Get the response by calling .charge() method passing paymentDetails oject as paramenter. NOTE chargeresponse can be null
final ChargeResponse? response = await shoket.charge(paymentDetails);
copied to clipboard
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);
}
}
copied to clipboard
Extra #
check Example app provided for further assistance
Credits #
Alex Rossi
License #
This project is licensed under the MIT License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.