搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.6+1

flutter_fawry_pay

此外掛程式適用於 FawryPay。它已實作原生 SDK,以在 Flutter 環境中運作。

AndroidiOSWeb
近 30 天下載
9
喜歡數
60
Pub 分數
140

安裝套件

flutter pub add flutter_fawry_pay

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Flutter Fawry Pay 是一個 Flutter 插件,可將 FawryPay 的原生支付 SDK 整合至 Flutter 應用程式中,讓 Android、iOS 和 Web 上的無縫應用內付款成為可能。它讓開發者能夠利用 FawryPay 安全的支付網關,在埃及及其他支援地區進行交易。此外,該插件簡化了在 Flutter 應用中啟動付款、處理回呼以及管理交易狀態的流程。它設計為與 FawryPay 現有的基礎設施搭配運作,確保與其最新安全與支付標準相容。

適用情境

  • 應用內購買在埃及市場
  • 接受 FawryPay 的電子商務平台
  • 需要本地支付整合的行動應用程式
  • 數位服務訂閱
  • 線上帳單支付

主要特色

  • 支援 Android、iOS 和 Web 平台
  • 與 FawryPay SDK 的安全整合
  • 處理支付回調和狀態更新
  • 用於啟動交易的簡單 API
  • 內建錯誤處理和記錄

適合對象

  • 面向埃及用戶的開發者
  • 需要 FawryPay 作為支付方式的應用程式
  • 使用 Flutter 的跨平台應用
  • 電子商務和訂閱服務
  • 需要本地支付網關的專案

使用建議

  • 需要 FawryPay 帳戶和憑證
  • 僅限 FawryPay 營運的地區
  • 每個平台都需要正確的設定
  • 可能需要額外的後端驗證
  • 依賴 FawryPay SDK 的更新以取得新功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter FawryPay

pub.dev Donate Paypal GitHub Follow

Explain

This plugin is for FawryPay. It's implemented the native SDKs of Mobile, and Web to work on Flutter environment.

It works for Android fine. iOS works fine on Real Device only (FawryPay Requirements).

Contribution: Eng. Ahmed Mahmoud

Getting Started

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_fawry_pay: ^0.0.6
Android

You have to edit AndroidManifest.xml file with following.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" />
    <application
        tools:replace="android:theme,android:label,android:name">
    </appliaction>
</manifest>

And download this file, and put it in app/libs folder (If not exist, create it).

In Release Mode

Please add these two lines in app/gradle

buildTypes {
    release {
        // ....
        shrinkResources false
        minifyEnabled false
    }
}
iOS

No actions needed, just work on Real Device only. Need xCode 12.x and SWIFT 5.3.x.

Web

No actions needed, just go ahead.

Usage

You just have to import the package with

import 'package:flutter_fawry_pay/flutter_fawry_pay.dart';

Then, you need to initialize the SDK.

FlutterFawryPay.instance.init(
    // Set the merchant ID here for one time only.
    merchantID: Keys.merchantID,
    style: Style.STYLE1,
    // If set to true, you must set username and email.
    skipCustomerInput: true,
    // Must be a phone number.
    username: "01234567890",
    email: "abc@test.com",
    // For web how you show the Fawry screen.
    webDisplayMode: DisplayMode.SIDE_PAGE,
    // You should set environment here.
    environment: Environment.TEST, 
);

And when you are ready for production you have to set the environment to LIVE.

Now, you can stream the result data that from SDK.

FlutterFawryPay.instance.callbackResultStream().listen((event) {
  FawryResponse response = FawryResponse.fromMap(data);
  print(response);
});

Let's now make our first payment initialize, you must set your merchantID that token from FawryPay system, and set your FawryItems that the user will pay for.

Note that: there's error in native FawryPay SDK for Android and iOS to retrieve again customParam.

FlutterFawryPay.instance.initialize(
    returnUrl: "test.com", // For Web use only.
    items: [
    FawryItem(sku: "1", description: "Item 1", qty: 1, price: 20.0),
    ],
    customParam: {
    "order_id": "123213",
    "price": 231.0,
    },
);

You can set some parameters like: merchantRefNumber, customParam.

So now, it was initialized well, how to start payment? You have TWO ways.

First way: Native Fawry Button

You can use the native button for FawryPay SDK. through this only widget.

FawryButton()
Second way: Your custom widget

You can use your own widget with a function to call with FlutterFawryPay.instance.startProcess().

RaisedButton(
  onPressed: () async {
  FawryResponse response = await FlutterFawryPay.instance.startProcess();
  },
  child: Text("Start Payment"),
)

There's a function in FawryPay is CardTokenizer (Android & iOS only, not for Web), you can use it like this way:

Note that: there's error in native FawryPay SDK for android to retrieve again customParam.

FlutterFawryPay.instance.initializeCardTokenizer(
  customerMobile: "01234567890",
  customerEmail: "abc@test.com",
  customParam: {
    "order_id": "123213",
    "price": 231.0,
  },
);

Last function you can use is reset the initialization (Android & Web only), doing that:

FlutterFawryPay.instance.reset();

Objects

class FawryItem {
  String sku;
  String description;
  int qty;
  double price;
  double? originalPrice;
  int? height;
  int? length;
  double? weight;
  int? width;
  String? variantCode;
  List<String>? reservationCodes;
  String? earningRuleID;
  String? imageUrl; // For Web only.
}

class FawryResponse {
  /// Parameters for payment process.
  String transactionID;
  DateTime expiryDate;
  
  /// Parameters for card tokenizer process.
  String cardToken;
  DateTime creationDate;
  String lastFourDigits;
  
  /// Common parameters for all process.
  Map<String, dynamic> customParam;
  String errorMessage;
}

Enums

/// Enums for DisplayMode configuration.
///
/// [POPUP] show a popup dialog.
/// [SIDE_PAGE] show side screen dialog.
enum DisplayMode { POPUP, SIDE_PAGE }

/// Enums for Environment configuration.
///
/// [TEST] for test stage atfawry.fawrystaging endpoint.
/// [LIVE] for production stage atfawry endpoint.
enum Environment { TEST, LIVE }

/// Enums for Environment configuration.
///
/// [EN] for English language.
/// [AR] for Arabic language.
enum Language { EN, AR }

/// Enums for Environment configuration.
///
/// [STYLE1] for first styling.
/// [STYLE2] for second styling.
enum Style { STYLE1, STYLE2 }

Links

FawryPay Android SDK: https://developer.fawrystaging.com/docs/sdks/android-sdk

FawryPay iOS SDK: https://developer.fawrystaging.com/docs/sdks/ios-sdk

FawryPay Web: https://developer.fawrystaging.com/docs/express-checkout/checkout-integration-overview

Supported By ❤

Eng. Ahmed Mahmoud (Works on iOS development)

Eng. Ahmed Hamouda

Eng. Mohamed Ghoneim

Issues or Contributions

This is a beta version of plugin, so I am very appreciated for any issues or contribution you can help me with.

Find me on Stackoverflow

profile for Shady Boshra at Stack Overflow, Q&A for professional and enthusiast programmers

License

MIT: https://mit-license.org.

Copyright (c) 2021 Shady Boshra. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

所屬分類

依賴

依賴清單 2 項

  • flutter_fawry_pay_platform_interface^0.0.4
  • flutter_fawry_pay_web^0.0.2

原始碼儲存庫

使用此套件的專案

暫無相關資料。