fiatpe_payments_sdk 1.0.2 copy "fiatpe_payments_sdk: ^1.0.2" to clipboard
fiatpe_payments_sdk: ^1.0.2 copied to clipboard

The All-in-One FiatPe Payment Gateway Flutter library is a robust solution designed to simplify digital payment acceptance in your Flutter applications.

fiatpe_payments_sdk #

pub package license

fiatpe_payments_sdk is a Flutter SDK that simplifies the integration of UPI payment features into your Flutter applications. Designed for flexibility and scalability, this library aims to streamline payment processes with additional features coming soon.


fiatpe-payments-flutter


✨ Features #

  • 🔄 UPI Payments: Seamlessly integrate UPI payments into your Flutter app.
  • 🚀 Future-Ready: Support for more payment options like net banking and cards is coming soon.

🛠 Installation #

Add the following dependency to your pubspec.yaml file:

dependencies:
  fiatpe_payments_sdk: ^1.0.1
copied to clipboard

Alternatively, you can add the dependency directly to your Flutter project by running the following command in your terminal:

dart pub add fiatpe_payments_sdk
copied to clipboard

This will automatically update your pubspec.yaml file with the required dependency.

Then run:

flutter pub get
copied to clipboard

🛠 Android Configuration #

Add Internet Permission

For Android, ensure that you have the Internet permission set in your AndroidManifest.xml file. This permission is necessary for network communications between your app and the FiatPe payment servers.

Add the following line inside the <manifest> tag in your AndroidManifest.xml file:

  <uses-permission android:name="android.permission.INTERNET" />
copied to clipboard

This allows your application to access the Internet, which is crucial for processing payments.


🛠 iOS Configuration #

Update Info.plist

For iOS, you must configure your Info.plist to include the URL schemes of the payment apps your application will interact with. This step is crucial to ensure your app can check if these apps are installed and facilitate the UPI payment process.

Add the following configuration to your Info.plist:

  <key>LSApplicationQueriesSchemes</key>
  <array>
      <string>BHIM</string>
      <string>bhim</string>
      <string>com.amazon.mobile.shopping</string>
      <string>gpay</string>
      <string>imobile</string>
      <string>paytm</string>
      <string>paytmmp</string>
      <string>payzapp</string>
      <string>phonepe</string>
  </array>
copied to clipboard

This configuration allows your application to query for the installed status of popular payment apps like BHIM, Google Pay, iMobile, Paytm, and others.

📝 Usage Instructions #

1. Import the Library

Add the import statement to your Dart file:

import 'package:fiatpe_payments_sdk/fiatpe_payments_sdk.dart';
copied to clipboard

2. Initialize the SDK #

To start using fiatpe_payments_sdk, you need to initialize the SDK with your API Key and Salt Key. This should be done when your application starts.

FiatPePayments.init(
  keys: const FiatPeAuthKeys(
    api: "YOUR_API_KEY",  // Your FiatPe API key
    salt: "YOUR_SALT_KEY", // Your FiatPe Salt key
  ),
  onFailed: (msg) {
    print("Initialization failed: $msg");
  },
  onSuccess: (msg) {
    print("Initialization succeeded: $msg");
  },
);
copied to clipboard

Parameters

  • api: (Required) Your FiatPe API key, provided by FiatPe.
  • salt: (Required) Your FiatPe Salt key, provided by FiatPe.
  • onFailed: (Optional) Callback function triggered when initialization fails, providing the error message as a string.
  • onSuccess: (Optional) Callback function triggered when initialization is successful, providing a success message as a string.

3. Start a UPI Payment #

To initiate a UPI payment, call the startPayment method with the required parameters encapsulated in the PaymentParams class.

FiatPePayments.startPayment(
  context: context,
  params: PaymentParams(
    transactionId: "TRANSACTIONID", // Transaction Id
    amount: 100.0, // Amount to be paid
    customerName: "John Doe", // Customer's full name
    customerEmail: "customer@example.com", // Customer's email
    phoneNumber: "+911234567890", // Customer's phone number
    callbackURL: "https://example.com/payment_callback", // Payment callback URL
    udf1: "custom data 1", // Optional user-defined field
    udf2: "custom data 2", // Optional user-defined field
    udf3: "custom data 3", // Optional user-defined field
    udf4: "custom data 4", // Optional user-defined field
    udf5: "custom data 5", // Optional user-defined field
  ),
  onPaymentResult: (result) {
    switch (result) {
      case PaymentSuccess():
        print("Payment Successful. Transaction ID: ${result.details.transactionId}");
        break;
      case PaymentFailure():
        print("Payment Failed. Error: ${result.details?.transactionId}");
        break;
      case PaymentPending():
        print("Payment Pending. Transaction ID: ${result.details.transactionId}");
        break;
      case PaymentCancelled():
        print("Payment Cancelled.");
        break;
      case PaymentUnknown():
        print("Unknown Payment Status.");
        break;
    }
  },
);
copied to clipboard

UPI Payments Demo #

fiatpe-payments-flutter-flow fiatpe-payments-flutter-flow


📄 PaymentParams Class #

The PaymentParams class encapsulates the details required to process a payment. Below is a breakdown of its fields:

Field Type Required Description
amount double ✅ Yes The payment amount.
customerName String ✅ Yes Full name of the customer.
customerEmail String ✅ Yes Email address of the customer.
phoneNumber String ✅ Yes Phone number of the customer.
callbackURL String ✅ Yes URL to which the payment result is sent.
udf1 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf2 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf3 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf4 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf5 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.

📄 PaymentResult Class #

The PaymentResult class represents the possible outcomes of a payment process. It uses a sealed class structure to handle different results like success, failure, pending, cancellation, and unknown status.

Variants #

Variant Field Type Required Description
PaymentSuccess details TransactionDetails ✅ Yes Detailed information about the successful transaction.
PaymentFailure errorCode String ✅ Yes Error code associated with the payment failure.
NOT_INITIALIZED / PAYMENT_FAILED
errorMessage String ✅ Yes Description of the error.
details TransactionDetails? ❌ No Additional transaction details if available.
PaymentPending details TransactionDetails ✅ Yes Detailed information about the pending transaction.
PaymentCancelled details TransactionDetails ✅ Yes Detailed information about the cancelled transaction.
reason String? ❌ No Optional reason for cancellation.
PaymentUnknown rawResponse String ✅ Yes Raw response for debugging unknown or unexpected results.

📄 TransactionDetails Class #

The TransactionDetails class provides detailed information about a transaction during the payment process.

Field Type Required Description
id int ✅ Yes Unique identifier for the transaction.
paymentMode String? ❌ No Mode of payment used (e.g., UPI, card, net banking).
transactionId String ✅ Yes Unique identifier for the transaction.
transactionRefId dynamic ❌ No Reference ID used internally.
rrnNo dynamic ❌ No Retrieval reference number, if applicable.
status String ✅ Yes Current status of the transaction (e.g., success, failure).
amount int ✅ Yes The payment amount.
udf1 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf2 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf3 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf4 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
udf5 String? ❌ No Optional user-defined field for custom data e.g. Order Id, Address, Invoice ID, Internal Transaction ID or any other custom field.
txnDateTime DateTime ✅ Yes Date and time of the transaction.
message String ✅ Yes Additional information or messages about the transaction.

Notes on Required Fields: #

  • id: Ensures every transaction is uniquely identifiable.
  • transactionId: Necessary for referencing the specific transaction.
  • status: Vital for determining the outcome of the transaction.
  • amount: Specifies the monetary value involved in the transaction.
  • txnDateTime: Provides the timestamp for transaction logging and auditing.
  • message: Offers additional context or feedback regarding the transaction.

📦 Upcoming Features #

  • 💳 Card Payments: Support for credit and debit card transactions.
  • 💼 Net Banking: Simplified integration with major banks.

🛡 License #

This project is licensed under the MIT License. See the LICENSE file for details.


🛠 Support #

For issues or feature requests, please raise an issue on the GitHub Repository.


📫 Connect with Us #

0
likes
100
points
48
downloads

Publisher

verified publisherfiatpe.com

Weekly Downloads

2024.10.04 - 2025.04.18

The All-in-One FiatPe Payment Gateway Flutter library is a robust solution designed to simplify digital payment acceptance in your Flutter applications.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

bloc, built_value, crypto, dio, flutter, flutter_bloc, freezed_annotation, intl, json_annotation, logger, lottie, plugin_platform_interface, pretty_dio_logger, retrofit, rxdart

More

Packages that depend on fiatpe_payments_sdk