open_payment

Last updated:

0 purchases

open_payment Image
open_payment Images
Add to Cart

Description:

open payment

Summary #
This flutter plugin lets you seamlessly integrate OPEN Payment Gateway with your flutter app and start collecting payments.
To know more about our SDKs and how to link them within the projects, refer to the documentation.
Pre-Requisites #
Payment Token: #
A payment token represents an order or a purchase. The first step to open up a payment page on your app is to create a payment_token.
A payment_token can be created by referring to create payment token API. This API should be always called from your server. You will receive payment_token as a response.
Access Token: #
Access key is a unique key which you can generate from your OPEN dashboard.
Android #
Change the minSdkVersion in your build.gradle file in the android/app/build.gradle has
minSdkVersion 19
copied to clipboard
iOS #
Minimum supported iOS version 14.0.
Get Started #
Installation #
Add the dependency in pubspec.yaml.
dependencies:
open_payment: ^2.0.0
copied to clipboard
Import #
import 'package:open_payment/open_payment.dart';
copied to clipboard
Usage #
Calling initiate payment function on click of button
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: onPaymentClick,
)
copied to clipboard
onPaymentClick function
Future<void> onPaymentClick() async {
OpenPaymentPayload openPaymentPayload = OpenPaymentPayload(
accessToken: "your-access-token",
paymentToken: "payment-token",
environment: PaymentEnvironment.live, //PaymentEnvironment.sandbox
logoUrl: "your-logo-url",
mainColor: "#83025c",
errorColor: "#ff0000"
);

await OpenPayment.initiatePayment(
openPaymentPayload: openPaymentPayload,
onTransactionComplete: (TransactionDetails transactionDetails) {
// Handle transaction result
},
onError: (String error) {
// Handle integration error
});
}
copied to clipboard
To see the whole implementation check example
Initialize OpenPaymentPayload #
You need to create a payload with the following parameters:



Parameter
Description




accessToken(Mandatory)
Access key is a unique key which you can generate from your Open dashboard. Throws exception in case of empty string


paymentToken(Mandatory)
To create the token using Create Payment Token API. Throws exception in case of empty string


environment(Mandatory)
Following ENUM can be passed to this method.PaymentEnvironment.live and PaymentEnvironment.sandbox


logoUrl
Image url for setting logo.


mainColor
Main color of Layer will be changed to this . Example: #f8c5c5


errorColor
Error color (icons/ error lines / error messages) of Layer will be changed to this . Example: #83025c



onTransactionComplete implementation: #
This is called whenever transaction is completed. Along with TransactionDetails passed as parameter.
TransactionDetails.status may either captured, failed , pending and cancelled.

NOTE - If onTransactionComplete is invoked it doesn't means that payment is successful. It may fail but transaction is completed is the only purpose.

onTransactionComplete: (TransactionDetails transactionDetails) {
// Handle transaction result
}
copied to clipboard
onError implementation: #
This is called whenever there is an integration errors.
onError: (String error) {
// Handle integration error
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.