multi_payment_gateway 0.0.2
multi_payment_gateway: ^0.0.2 copied to clipboard
A Flutter package to simplify integrating multiple payment gateways like Paymob, PayPal, and Stripe.
MultiPaymentGateway #
A Flutter package that provides an easy way to handle multiple payment gateways, including Stripe, Paymob, and PayPal. This package simplifies the process for developers to integrate these payment services without worrying about the underlying details.
Features #
- Stripe: A complete payment gateway for handling payments through Stripe.
- Paymob: A gateway for processing payments through Paymob.
- PayPal: Easily integrate PayPal payment functionality into your Flutter app.
- Simplified payment flows for users with no need to enter complex configurations.
- Handles exceptions and actions for each gateway.
Installation #
Add this to your pubspec.yaml
file:
dependencies:
multi_payment_gateway: latest
Run these command in terminal
- dart run global activate multi_payment_gateway
- dart run multi_payment_gateway:setup
Examples #
Stripe #
Future<void> payWithStripe() async {
var token = "${dotenv.env["SECRET_KEY"]}";
final SetupStripePayment intent = SetupStripePayment(token: token);
await StripeService.instance.pay(setupPayment: intent);
}
To Create Custoomer In Stripe #
```dart
CustomerService.instance.createCustomer(
name : "customer name",
token : "your token"
);
# Paypal
```dart
void payWithPaypal(BuildContext context) async {
final paypalModel = SetupePaypalPayment(
context: context,
clientId: "${dotenv.env["PAYPAL_CLIENT_ID"]}",
secretKey: "${dotenv.env["PAYPAL_SECRET_KEY"]}",
);
await PaypalService.instance.pay(setupPayment: paypalModel);
}
Paymob #
Future<void> payWithPaymob(BuildContext context) async {
final SetupPaymobPayment setupPayment = SetupPaymobPayment(
context: context,
frameId: "839579",
integrationId: int.parse("${dotenv.env["INTEGRATION_ID"]}"),
apiKey: "${dotenv.env["PAYMOB_API_KEY"]}");
await PaymobPaymentService.instance.pay(setupPayment: setupPayment);
}