パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.8

flutter_paymob

Paymobを使って、Flutterアプリでオンラインカードやモバイルウォレットによる支払いを簡単に受け入れましょう。

AndroidiOSWebmacOSWindows
30日間ダウンロード
87
いいね数
35
Pub ポイント
140

パッケージをインストール

flutter pub add flutter_paymob

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

flutter_paymob は、Flutter アプリケーションに Paymob の決済ソリューションをスムーズに統合できる Flutter パッケージです。Android、iOS、Web、macOS、Windows プラットフォームでオンラインカード決済およびモバイルウォレット取引をサポートしています。`flutter pub add flutter_paymob` による簡単なセットアップにより、開発者はアプリ内で安全な決済処理を迅速に実装できます。このパッケージは、決済フロー、トークン化、取引状態の確認を扱うための明確な API を提供し、ユーザーのチェックアウト体験を簡素化します。ECサイトアプリ、サブスクリプションサービス、および信頼性のあるマルチプラットフォーム決済機能が必要なすべてのアプリに最適です。

用途

  • ECアプリ
  • サブスクリプション課金
  • アプリ内購入
  • デジタルサービスの支払い
  • オンラインチケット販売

主な機能

  • カードおよびモバイルウォレットをサポート
  • マルチプラットフォーム互換性
  • pub との簡単な統合
  • セキュアなトークン処理
  • リアルタイム取引状態
  • クロスプラットフォーム対応

適している対象

  • モバイルおよびウェブ電子商取引アプリ
  • Paymob を使用する開発者
  • グローバルな決済オプションを必要とするアプリ
  • デジタルマーケットプレイスを構築するスタートアップ
  • 迅速な支払い設定が必要なプロジェクト

注意事項

  • PaymobアカウントおよびAPIキーが必要です
  • 本番環境では適切なエラー処理が必要です
  • Paymobのバックエンドの安定性に依存します
  • 追加のUIカスタマイズが必要になる場合があります
  • Paymobがサポートする地域に限定

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。


🚀 Flutter Paymob — Accept Payments with Zero Hassle

Integrate Paymob card & wallet payments inside your Flutter app with ease. Secure, fast, and ready for production.


📥 Installation

Just add to your pubspec.yaml:

flutter_paymob: ^latest_version

🔧 Setup & Initialization

Before your app runs, initialize:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await FlutterPaymob.instance.initialize(
    apiKey: "YOUR_PAYMOB_API_KEY",
    integrationID: 123456,         // Card integration ID
    walletIntegrationId: 654321,   // Wallet integration ID
    iFrameID: 789012,              // Paymob iframe ID
  );

  runApp(const MyApp());
}

⚡ Quick Usage Guide

Pay with Card 💳
await FlutterPaymob.instance.payWithCard(
  title: Text("Card Payment"), // Optional - Custom title AppBar
  appBarColor: Colors.blueAccent, // Optional - Custom AppBar color
  context: context,
  currency: "EGP", 
  amount: 150, 
  onPayment: (response) {
    if (response.success) {
      print("🎉 Payment Success! TxID: ${response.transactionID}");
    } else {
      print("❌ Payment Failed: ${response.message}");
    }
  },
);
Pay with Wallet 📱
await FlutterPaymob.instance.payWithWallet(
title: Text("Card Payment"), // Optional - Custom title AppBar
appBarColor: Colors.blueAccent, // Optional - Custom AppBar color
  context: context,
  currency: "EGP",
  amount: 150,
  number: "01010101010",
  onPayment: (response) {
    if (response.success) {
      print("🎉 Wallet Payment Successful");
    } else {
      print("❌ Wallet Payment Failed");
    }
  },
);

💡 Response Object Breakdown

Field Type Meaning
success bool Was the payment successful?
transactionID String? Unique ID for the transaction
responseCode String? Numeric response from Paymob API
message String? Description / message from Paymob

🧪 Test Credentials

Type Number / PIN Expiry CVV OTP
Card 5123 4567 8901 2346 12/25 123 -
Wallet 01010101010 - - 123456

🚨 Important Notes

  • Webhook integration is a must! Always verify transactions on your backend with Paymob webhooks to prevent fraud.
  • Customize UI elements (title, appBarColor) to match your brand.
  • Use sandbox keys during development to avoid live charges.
  • Error Handling: Always wrap payment calls with try-catch to gracefully handle network or API failures.
  • Logging: Log transaction attempts and responses for debugging and auditing.
  • Localization: You can customize strings/messages in your app UI to support multiple languages.
  • Security: Never expose your API keys or sensitive info in the client code; keep them safe on the server when possible.

🔄 Handling Payment States

The onPayment callback triggers on success, failure, or cancellation. Use the response.success boolean and response.message to determine the payment state and update your UI accordingly.


🛠️ Troubleshooting

  • Blank iframe or webview?

    • Check your internet connection.
    • Make sure your iFrame ID and payment tokens are valid and not expired.
    • Verify your Paymob account and integration settings.
  • PlatformException about view creation?

    • Make sure you are using the latest webview_flutter package compatible with your Flutter version.
    • Avoid creating multiple instances of the webview controller simultaneously.
  • Payment not completing or stuck?

    • Confirm your API credentials and integration IDs.
    • Enable verbose logging if available to inspect requests and responses.

🔗 Useful Links


📞 Contact

Need help or want to customize? Reach out to me: Ahmed Hosni - LinkedIn


Happy coding & smooth payments! 🎉


カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。