Skip to content

antruongnguyen/uni_payments

 
 

Repository files navigation

Uni Payments

A Flutter plugin for making payments via different payment methods for accepting online payments in Flutter app.

Available Payment Methods

✅   Razorpay
✅   Paystack
✅   FlutterWave
✅   Paytm
✅   GooglePay

Razorpay Paystack


Paytm Flutter wave


GooglePay

🚀 Installation

This plugin is available on Pub: https://pub.dev/packages/uni_payments

Add this to dependencies in your app's pubspec.yaml

uni_payments : latest_version

🔖 Usage

Sample code to integrate can be found in example/lib/main.dart.

Integrate Razorpay Payment Gateway

 await UniPayments.razorPayPayment(
      razorpayKey: "ENTER_RAZORPAY_KEY",
      contactNumber: "ENTER_MOBILE_NUMBER",
      emailId: "ENTER_EMAIL_ID",
      amount: 2500,
      userName: "ENTER_USER_NAME",
      successListener: (UniPaymentResponse uniPaymentResponse) {
        /// here manage code for success payment. ///
        if (uniPaymentResponse.paymentStatus) {
          /// perform action on success here ///
        }
      },
      failureListener: (UniPaymentResponse uniPaymentResponse) {
        /// here manage code for failure or error in payment. ///
        if (uniPaymentResponse.paymentStatus) {
          /// perform action on failure here ///
        }
      },
    );

Integrate Paystack Payment Gateway

 UniPaymentResponse uniPaymentResponse = await PayStackService().openPaystackWithCard(
      context: context,
      emailId: "ENTER_EMAIL_ID",
      payStackKey: 'ENTER_PAYSTACK_KEY_HERE',
      amount: 2500,
    );
  if (uniPaymentResponse.paymentStatus) {
    /// perform action on success here ///
  } 

Integrate Paytm Payment Gateway

 UniPayments.paytmPayment(
      baseUrl: "ENTER_BASE_URL_FROM_BACKEND",
      bodyParameter: {
        /// Enter map of bodyparameter ///
      },
      headers: {
        /// Enter map of headers ///
      },
      paytmMerchantId: "ENTER_PAYTM_MERCHENT_ID",
      orderId: "ENTER_ORDER_ID",
      isTesting: true,
      amount: 2500,
      successListener: (UniPaymentResponse uniPaymentResponse) {
        /// here manage code for success payment. ///
        if (uniPaymentResponse.paymentStatus) {
          /// perform action on success here ///
        }
      },
      failureListener: (UniPaymentResponse uniPaymentResponse) {
        /// here manage code for failure or error in payment. ///
        if (uniPaymentResponse.paymentStatus) {
          /// perform action on failure here ///
        }
      },
    );

Integrate Flutterwave Payment Gateway

 await UniPayments.flutterWavePayment(
      buildContext: context,
      publicKey: 'ENTER_PUBLIC_KEY_HERE',
      encryptionKey: 'ENTER_ENCRYPTION_KEY',
      currencyCode: 'NGN',
      amount: '2500',
      receiptantName: 'ENTER_USER_NAME',
      emailId: 'ENTER_EMAIL_ID',
      phoneNumber: 'ENTER_CONTACT_NUMBER',
      isDebugMode: true,
      acceptCardPayment: true,
      successListener: (UniPaymentResponse uniPaymentResponse) {
        /// here manage code for success payment. ///
        if (uniPaymentResponse.paymentStatus) {
          /// perform action on success here ///
        }
      },
      failureListener: (UniPaymentResponse uniPaymentResponse) {
        /// here manage code for failure or error in payment. ///
        if (uniPaymentResponse.paymentStatus) {
          /// perform action on failure here /// 
        }
      },
    );****

<<<<<<< HEAD

Integrate Googlepay Payment Gateway

UniPayments.uniPaymentGooglePayButton(
                      paymentConfigurationAsset: 'ENTER_ASSET_PATH',
                      height: 150,
                      width: 150,
                      uniPaymentItemStatus: UniPaymentItemStatus.pending,
                      uniPaymentItemTypes: UniPaymentItemTypes.item,
                      payableAmount: "ENTER_AMOUNT_HERE",
                      uniPaymentGoogleButtonStyle:
                          UniPaymentGoogleButtonStyle.flat,
                      uniPaymentGoogleButtonType:
                          UniPaymentGoogleButtonType.donate,
                      paymentLabel: "ENTER_LABLE_PAYMENT",
                      failureListener: (UniPaymentResponse paymentResponse) {
                        /// here manage code for failure or error in payment. ///
                      },
                      successListener: (UniPaymentResponse paymentResponse) {
                        /// here manage code for failure or error in payment. ///
                      },
                      onPressed: () {
                        print("Universal Google Pay Button Pressed");
                      },
                    ),

❤️ Found this project useful?

If you found this project useful, then please consider giving it a ⭐ on Github and sharing it with your friends via social media.

=======


**** ## :🪄: Contributing, 😞 Issues and 🐛 Bug Reports >>>>>>> 8deb8d8fd1809d7a6a317c1ab8975edeb54d8d75 The project is open to public contribution. Please feel very free to contribute. Experienced an issue or want to report a bug? Please, [report it here](https://github.com/NehilKoshiya/uni_payments/issues). Remember to be as descriptive as possible.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 79.8%
  • HTML 8.2%
  • Ruby 4.9%
  • Kotlin 3.5%
  • Swift 2.0%
  • Objective-C 1.6%