هاهو الملف README.md كاملاً ليمكنك نسخه دفعة واحدة وحفظه في مشروعك:

# 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:

```yaml
dependencies:
  multi_payment_gateway: latest

Run these commands in the terminal:

dart run global activate multi_payment_gateway
dart run multi_payment_gateway:setup

Then, set up Stripe:

StripeSetup.setup(publishableKey: "PUBLISHABLE_KEY");

Examples

Stripe

Future<void> payWithStripe() async {
  var token = "${dotenv.env["SECRET_KEY"]}";
  final SetupStripePayment intent = SetupStripePayment(token: token);
  await StripeService.instance.pay(setupPayment: intent);
}

Create Customer in Stripe

CustomerService.instance.createCustomer(
  name: "customer name",
  token: "your token"
);

PayPal

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);
}

Author

Ahmed Wael – Flutter Developer
📧 ahmedwael99104@gmail.com
🔗 GitHub Profile