EdfaPay Payment Gateway Flutter SDK
EdfaPay is a white-label payment software provider. Thanks to our 15+ years of experience in the payment industry, we’ve developed a state-of-the-art white-label payment system that ensures smooth and uninterrupted payment flow for merchants across industries.
EdfaPay Flutter SDK was developed and designed with one purpose: to help the Flutter developers easily integrate the EdfaPay API Payment Platform for a specific merchant.
Installation
[!IMPORTANT]
Configure Repository
This Flutter plugin is a wrapper of Android and iOS native libraries.
Setup Android
You must add the
jitpackrepository support to the Gradle to access and download the native dependency.Add below to the
./android/build.gradleof your projectallprojects { repositories { ... // Add below at the same location maven { url 'https://jitpack.io' } } }
Or add below to the
./android/settings.gradleof your projectdependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { ... // Add below at the same location maven { url "https://jitpack.io" } } }Setup iOS
iOS does not require any setup just install Flutter plugin. If you need to enable
Apple Payin your app it can be enabled by following the instructions at Link[!IMPORTANT]
Intalling Flutter Plugin
In the
dependencies:section of yourpubspec.yaml, add the following lines:dependencies: intl: ^0.17.0 edfapg_sdk: any[!IMPORTANT]
Configuring the Proguard Rule
Android
If your project is obfuscated with proguard, please add the rule below to your android project proguard-rules.pro
-keep class com.edfapg.sdk.** { public protected private *; }
Usage
[!IMPORTANT]
Initialize SDK
EdfaPgSdk.instance.config( key: MERCHANT_CLIENT_KEY, // Your Secret Merchant Key password: MERCHANT_CLIENT_PASSWORD, // Your Secret Merchant Password enableDebug: true );[!TIP]
Get Ready for Payment
Create
EdfaPgSaleOrderModelfinal order = EdfaPgSaleOrder( id: EdfaPgSdk.instance.HELPER.generateUUID(), description: "Test Order", currency: "SAR", amount: 1.00//Random().nextInt(9)/10, // will not exceed 0.9 );Create
EdfaPgPayerModelfinal payer = EdfaPgPayer( firstName: "First Name", lastName: "Last Name", address: "EdfaPay Payment Gateway", country: "SA", city: "Riyadh", zip: "123768", email: "support@edapay.com", phone: "+966500409598", ip: "66.249.64.248", options: EdfaPgPayerOption( // Options middleName: "Middle Name", birthdate: DateTime.parse("1987-03-30"), address2: "Usman Bin Affan", state: "Al Izdihar" ) );Payment with Card
EdfaCardPay() .setOrder(order) .setPayer(payer) .setDesignType(EdfaPayDesignType.one) .setLanguage(EdfaPayLanguage.ar) .onTransactionSuccess((response){ print("onTransactionSuccess.response ===> ${response.toString()}"); }).onTransactionFailure((response){ print("onTransactionFailure.response ===> ${response.toString()}"); }).onError((error){ print("onError.response ===> ${error.toString()}"); }).initialize(context);Pay With ApplePay - iOS Only
EdfaApplePay() .setOrder(order) .setPayer(payer) .setApplePayMerchantID(APPLEPAY_MERCHANT_ID) .onAuthentication((response){ print("onAuthentication.response ===> ${response.toString()}"); }).onTransactionSuccess((response){ print("onTransactionSuccess.response ===> ${response.toString()}"); }).onTransactionFailure((response){ print("onTransactionFailure.response ===> ${response.toString()}"); }).onError((error){ print("onError.response ===> ${error.toString()}"); }).initialize(context);Addon's
Create
EdfaPgSaleOrder&EdfaPgPayerModel Like ThisCreate
EdfaPgSaleOptionModelfinal saleOption = EdfaPgSaleOption( channelId: "channel-id-here", // channel-id if its enable for merchant recurringInit: true // Make sure recurring is enabled for merchant and [true=if want to do recurring, false=if don't want do recurring] );Create
EdfaPgCardModelfinal card = EdfaPgCard( number: "1234567890987654", expireMonth: 01, expireYear: 2028, cvv: 123 );Sale Transaction - Make sure to pass null to
saleOption:and false toisAuth:EdfaPgSdk.instance.ADAPTER.SALE.execute( order: order, card: card, payer: payer, saleOption: null, isAuth: false, onResponse: SaleResponseCallback( success: (EdfaPgSaleSuccess result) { debugPrint(result.toJson().toString()); }, decline: (EdfaPgSaleDecline result) { debugPrint(result.toJson().toString()); }, recurring: (EdfaPgSaleRecurring result) { debugPrint(result.toJson().toString()); }, redirect: (EdfaPgSaleRedirect result) { debugPrint(result.toJson().toString()); }, secure3d: (EdfaPgSale3DS result) { debugPrint(result.toJson().toString()); }, error: (EdfaPgError result) { debugPrint(result.toJson().toString()); } ), onResponseJSON: (data){ debugPrint(data); }, onFailure: (result) { debugPrint(result.toJson().toString()); } );Recurring Transaction
- Make sure to pass false to
isAuth:- Card Number should be passed the same used for the first
SalewithEdfaPgSaleOption.recurringInit==trueEdfaPgRecurringOptions.firstTransactionId:shouldtransactionIdfrom first successSalewithEdfaPgSaleOption.recurringInit==true
EdfaPgRecurringOptions.token:Should be recurringToken from first successSalewithEdfaPgSaleOption.recurringInit==trueEdfaPgSdk.instance.ADAPTER.RECURRING_SALE.execute( cardNumber: "1234567890123456", isAuth: false, order: order, payerEmail: "support@edfapay.com", recurringOptions: EdfaPgRecurringOptions( firstTransactionId: "c9f9b51b-72f4-4e2d-8a49-3b26c97b2f50", token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9" ), onResponse: RecurringSaleResponseCallback( success: (EdfaPgSaleSuccess result) { debugPrint(result.toJson().toString()); }, decline: (EdfaPgSaleDecline result) { debugPrint(result.toJson().toString()); }, recurring: (EdfaPgSaleRecurring result) { debugPrint(result.toJson().toString()); }, redirect: (EdfaPgSaleRedirect result) { debugPrint(result.toJson().toString()); }, secure3d: (EdfaPgSale3DS result) { debugPrint(result.toJson().toString()); }, error: (EdfaPgError result) { debugPrint(result.toJson().toString()); } ), onResponseJSON: (data){ debugPrint(data); }, onFailure: (result) { debugPrint(result.toJson().toString()); } );Capture Transaction
transactionId:shouldtransactionIdfrom successSalewithisAuth:true- Card Number should be passed the same used for the
SalewithisAuth:truecardNumber:should authorized bySalewithisAuth:true
amount:should be the same asSalewithisAuth:trueEdfaPgSdk.instance.ADAPTER.CAPTURE.execute( amount: 1.0, transactionId: "c9f9b51b-72f4-4e2d-8a49-3b26c97b2f50", cardNumber: "1234567890123456", payerEmail: "support@edfapay.com", onResponse: CaptureResponseCallback( success: (EdfaPgCaptureSuccess result){ debugPrint(result.toJson().toString()); }, decline: (EdfaPgCaptureDecline result){ debugPrint(result.toJson().toString()); }, error: (EdfaPgError result){ debugPrint(result.toJson().toString()); } ), onResponseJSON: (data){ debugPrint(data); }, onFailure: (result) { debugPrint(result.toJson().toString()); } );Credit Void Transaction
transactionId:shouldtransactionIdfrom successSalewithisAuth:true- Card Number should be passed the same used for the
SalewithisAuth:truecardNumber:should authorized bySalewithisAuth:true
amount:should be the same asSalewithisAuth:trueEdfaPgSdk.instance.ADAPTER.CREDIT_VOID.execute( amount: 1.0, transactionId: "c9f9b51b-72f4-4e2d-8a49-3b26c97b2f50", cardNumber: "1234567890123456", payerEmail: "support@edfapay.com", onResponse: CreditVoidResponseCallback( success: (EdfaPgCreditVoidSuccess result){ debugPrint(result.toJson().toString()); }, error: (EdfaPgError result){ debugPrint(result.toJson().toString()); } ), onResponseJSON: (data){ debugPrint(data); }, onFailure: (result) { debugPrint(result.toJson().toString()); } );Transaction Detail
transactionId:should be from the last transaction,
cardNumber:should be passed the same used for the last transactionEdfaPgSdk.instance.ADAPTER.TRANSACTION_DETAILS.execute( transactionId: "c9f9b51b-72f4-4e2d-8a49-3b26c97b2f50", cardNumber: "1234567890123456", payerEmail: "support@edfapay.com", onResponse: TransactionDetailsResponseCallback( success: (EdfaPgTransactionDetailsSuccess result){ debugPrint(result.toJson().toString()); }, error: (EdfaPgError result){ debugPrint(result.toJson().toString()); } ), onResponseJSON: (data){ debugPrint(data); }, onFailure: (result) { debugPrint(result.toJson().toString()); } );Transaction Status
transactionId:should be from the last transaction,
cardNumber:should be passed the same used for the last transactionEdfaPgSdk.instance.ADAPTER.TRANSACTION_STATUS.execute( transactionId: "c9f9b51b-72f4-4e2d-8a49-3b26c97b2f50", cardNumber: "1234567890123456", payerEmail: "support@edfapay.com", onResponse: TransactionStatusResponseCallback( success: (EdfaPgTransactionStatusSuccess result){ debugPrint(result.toJson().toString()); }, error: (EdfaPgError result){ debugPrint(result.toJson().toString()); } ), onResponseJSON: (data){ debugPrint(data); }, onFailure: (result) { debugPrint(result.toJson().toString()); } );
Getting help
To report a specific issue or feature request, open a new issue.
Or write a direct letter to the support@edfapay.sa.
License
MIT License. See the LICENSE file for more details.
Contacts

Website: https://edfapay.com/home/
Phone: +966920031242
Email: support@edfapay.sa
7637
Othman Bin Affan St., 2123 Al Ezdihar Dist.,
12487 Riyadh, Riyadh, Saudi Arabia
© 2022 - 2023 EdfaPay. All rights reserved.