{"id":49657693,"url":"https://github.com/aliumairdev/flutter_pay_kit","last_synced_at":"2026-05-06T10:47:01.423Z","repository":{"id":324103336,"uuid":"1095947479","full_name":"aliumairdev/flutter_pay_kit","owner":"aliumairdev","description":"A unified API for integrating multiple payment processors in Flutter apps.","archived":false,"fork":false,"pushed_at":"2025-11-13T21:13:41.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-13T21:21:26.781Z","etag":null,"topics":["braintree","flutter","paddle","paymetgateway","stripe-payments"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aliumairdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-13T18:21:12.000Z","updated_at":"2025-11-13T21:13:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aliumairdev/flutter_pay_kit","commit_stats":null,"previous_names":["aliumairdev/flutter_pay_kit"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aliumairdev/flutter_pay_kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliumairdev%2Fflutter_pay_kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliumairdev%2Fflutter_pay_kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliumairdev%2Fflutter_pay_kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliumairdev%2Fflutter_pay_kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliumairdev","download_url":"https://codeload.github.com/aliumairdev/flutter_pay_kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliumairdev%2Fflutter_pay_kit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32690378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["braintree","flutter","paddle","paymetgateway","stripe-payments"],"created_at":"2026-05-06T10:47:00.609Z","updated_at":"2026-05-06T10:47:01.418Z","avatar_url":"https://github.com/aliumairdev.png","language":"Dart","funding_links":["https://developer.paypal.com/braintree/docs"],"categories":[],"sub_categories":[],"readme":"# Flutter Universal Payments\n\n[![pub package](https://img.shields.io/pub/v/flutter_universal_payments.svg)](https://pub.dev/packages/flutter_universal_payments)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA unified, production-ready payment API for Flutter that supports multiple payment processors with a single, consistent interface. Switch between payment providers without rewriting your code.\n\n## ✨ Features\n\n- 🔌 **Unified API** - One consistent interface for all payment processors\n- 💳 **6 Payment Processors** - Stripe, Paddle, Braintree, Lemon Squeezy, Totalpay, and Fake (for testing)\n- 🔄 **Hot-Swappable** - Switch processors at runtime without code changes\n- 📱 **Ready-to-Use Widgets** - Pre-built payment UI components\n- 🎨 **Highly Customizable** - Customize every aspect to match your brand\n- 🔒 **Secure by Design** - PCI-compliant patterns, no card data storage\n- 🧪 **Testing Support** - Built-in fake processor for development\n- 📊 **Analytics Ready** - Firebase, Sentry, and custom analytics integrations\n- 🔐 **Smart Caching** - Automatic data caching with secure storage\n- 🚀 **Production Ready** - Comprehensive error handling and retry logic\n- 🎯 **Type Safe** - Full Dart type safety with Freezed models\n- ⚡ **State Management** - Built-in Riverpod integration\n\n## 📦 Supported Payment Processors\n\n| Processor | Subscriptions | One-time Payments | Plan Swapping | Webhooks | Testing |\n|-----------|:-------------:|:-----------------:|:-------------:|:--------:|:-------:|\n| **Stripe** | ✅ | ✅ | ✅ | ✅ | Sandbox |\n| **Paddle** | ✅ | ✅ | ✅ | ✅ | Sandbox |\n| **Braintree** | ✅ | ✅ | ✅ | ✅ | Sandbox |\n| **Lemon Squeezy** | ✅ | ✅ | ✅ | ✅ | Test Mode |\n| **Totalpay** | ✅ | ✅ | ✅ | ✅ | Sandbox |\n| **Fake** | ✅ | ✅ | ✅ | ❌ | Built-in |\n\n## 🚀 Quick Start\n- Unified API across all payment processors\n- **Native Google Pay integration for Android**\n- **Native Apple Pay integration for iOS** (iOS 13.0+)\n- Type-safe payment models using Freezed\n- State management with Riverpod\n- Comprehensive error handling\n- Easy switching between processors\n- Built-in retry logic\n- Local payment method storage\n- Support for one-time and recurring payments\n- Production-ready architecture\n\n### Installation\n\nAdd to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  flutter_universal_payments: ^0.1.0\n```\n\nThen run:\n\n```bash\nflutter pub get\n```\n\n### Basic Usage\n\n### Apple Pay Integration (iOS)\n\n```dart\nimport 'package:flutter_universal_payments/flutter_universal_payments.dart';\n\n// 1. Configure your payment processor\nfinal config = PaymentConfigurationBuilder()\n  .useStripe(\n    publishableKey: 'pk_test_...',\n    secretKey: 'sk_test_...',\n    webhookSecret: 'whsec_...',\n  )\n  .enableLogging()\n  .build();\n\n// 2. Initialize the payment service\nawait FlutterUniversalPayments.initialize(\n  config: config,\n  storage: storage, // Your Storage implementation\n);\n\n// 3. Get the service instance\nfinal paymentService = FlutterUniversalPayments.instance;\n\n// 4. Initialize customer\nawait paymentService.initialize(\n  email: 'customer@example.com',\n  name: 'John Doe',\n);\n\n// 5. Create a subscription\nfinal subscription = await paymentService.subscribe(\n  priceId: 'price_monthly_999',\n  trialDays: 14,\n);\n\nprint('Subscription created: ${subscription.id}');\n```\n\n### UI Widgets\n\nThe package includes ready-to-use payment widgets:\n\n```dart\n// Display pricing plans\nPricingTable(\n  plans: [\n    SubscriptionPlanData(\n      id: 'basic',\n      name: 'Basic',\n      price: Price(\n        id: 'price_basic',\n        amount: 999,\n        currency: 'USD',\n        interval: BillingInterval.month,\n      ),\n      features: ['Feature 1', 'Feature 2'],\n    ),\n  ],\n  onPlanSelected: (plan) async {\n    await paymentService.subscribe(priceId: plan.price.id);\n  },\n)\n\n// Payment card input\nPaymentCardInput(\n  onCardChanged: (cardData) {\n    // Handle card data\n  },\n)\n\n// Subscription status display\nSubscriptionStatusWidget(\n  subscription: subscription,\n)\n```\n\n## 📖 Documentation\n\n- **[Getting Started Guide](doc/getting_started.md)** - Detailed setup for each processor\n- **[Widgets Documentation](doc/widgets.md)** - UI components and customization\n- **[Advanced Usage](doc/advanced.md)** - Webhooks, custom processors, best practices\n- **[API Reference](https://pub.dev/documentation/flutter_universal_payments/latest/)** - Complete API docs\n\n### Processor-Specific Guides\n\n- [Stripe Integration](doc/processors/stripe.md)\n- [Paddle Integration](doc/processors/paddle.md)\n- [Braintree Integration](doc/processors/braintree.md)\n- [Lemon Squeezy Integration](doc/processors/lemon_squeezy.md)\n- [Totalpay Integration](doc/processors/totalpay.md)\n\n## 🎯 Core Concepts\n\n### Customer Management\n\n```dart\n// Initialize a customer\nawait paymentService.initialize(\n  email: 'customer@example.com',\n  name: 'John Doe',\n  phone: '+1234567890',\n);\n\n// Get current customer\nfinal customer = await paymentService.getCurrentCustomer();\n\n// Refresh customer data\nawait paymentService.refreshCustomer();\n```\n\n### Subscriptions\n\n```dart\n// Create subscription with trial\nfinal subscription = await paymentService.subscribe(\n  priceId: 'price_monthly',\n  trialDays: 14,\n);\n\n// Check subscription status\nfinal hasActive = await paymentService.hasActiveSubscription('product_id');\nfinal isOnTrial = await paymentService.isOnTrial('product_id');\n\n// Change subscription plan\nawait paymentService.changePlan(\n  subscriptionId: subscription.id,\n  newPriceId: 'price_annual',\n);\n\n// Cancel subscription\nawait paymentService.cancelSubscription(\n  id: subscription.id,\n  immediate: false, // Grace period until end of billing cycle\n);\n\n// Resume canceled subscription\nawait paymentService.resumeSubscription(id: subscription.id);\n```\n\n### Payment Methods\n\n```dart\n// Add payment method\nawait paymentService.setDefaultPaymentMethod(paymentMethodToken);\n\n// Get all payment methods\nfinal methods = await paymentService.getPaymentMethods();\n\n// Remove payment method\nawait paymentService.removePaymentMethod(methodId);\n```\n\n### One-Time Payments\n\n```dart\n// Create a one-time charge\nfinal charge = await paymentService.makePayment(\n  amount: 2999, // $29.99\n  currency: 'USD',\n  description: 'Premium upgrade',\n  paymentMethodToken: token,\n// Configure Google Pay\nfinal googlePayConfig = GooglePayConfig(\n  merchantId: 'your-merchant-id',\n  merchantName: 'Your Store',\n  environment: GooglePayEnvironment.production,\n);\n```\n\n## 🔄 Switching Processors\n\nOne of the most powerful features is the ability to switch payment processors without changing your code:\n\n```dart\n// Start with Stripe\nfinal stripeConfig = PaymentConfigurationBuilder()\n  .useStripe(publishableKey: '...', secretKey: '...')\n  .build();\n\nawait FlutterUniversalPayments.initialize(config: stripeConfig);\n\n// Later, switch to Paddle\nfinal paddleConfig = PaymentConfigurationBuilder()\n  .usePaddle(\n    vendorId: '...',\n    authCode: '...',\n    publicKey: '...',\n  )\n  .build();\n\nawait FlutterUniversalPayments.reinitialize(config: paddleConfig);\n\n// Your app code remains the same!\n```\n\n## 🎨 Customization\n\nAll widgets are highly customizable:\n\n```dart\nPricingTable(\n  plans: plans,\n  layout: PricingLayout.grid(crossAxisCount: 3),\n  cardDecoration: BoxDecoration(\n    gradient: LinearGradient(\n      colors: [Colors.blue, Colors.purple],\n    ),\n    borderRadius: BorderRadius.circular(20),\n  ),\n  selectedPlanColor: Colors.green,\n  onPlanSelected: (plan) =\u003e handlePlanSelection(plan),\n  headerBuilder: (context) =\u003e CustomHeader(),\n)\n```\n\n## 📊 Analytics \u0026 Logging\n\nBuilt-in support for analytics and logging:\n\n```dart\n// Enable logging\nPaymentLogger.enable();\nPaymentLogger.setLogLevel(LogLevel.debug);\n\n// Add analytics providers\nPaymentLogger.registerAnalyticsProvider(\n  FirebaseAnalyticsProvider(analytics),\n);\n\n// Automatic event logging\n// - Payment success/failure\n// - Subscription created/canceled\n// - Plan changes\n// - Checkout events\n```\n\n## 🧪 Testing\n\nUse the built-in fake processor for testing:\n\n```dart\nfinal testConfig = PaymentConfigurationBuilder()\n  .useFake(\n    simulateDelays: true,\n    delayDuration: Duration(seconds: 1),\n    failureRate: 0.1, // 10% failure rate\n  )\n  .build();\n\nawait FlutterUniversalPayments.initialize(config: testConfig);\n```\n\n## 🏗️ Architecture\n\nThe package follows clean architecture principles:\n\n```\nlib/\n├── src/\n│   ├── models/          # Data models (Customer, Subscription, Charge, etc.)\n│   ├── processors/      # Payment processor implementations\n│   ├── services/        # Business logic (PaymentService)\n│   ├── widgets/         # UI components\n│   ├── utils/           # Logging, analytics\n│   └── exceptions/      # Custom exceptions\n└── flutter_universal_payments.dart  # Public API\n```\n\n## 🔒 Security Best Practices\n\n- Never store sensitive card data locally\n- Use tokenization for payment methods\n- Implement webhook signature verification\n- Enable logging with sensitive data masking\n- Use secure storage for customer IDs and tokens\n- Always use HTTPS endpoints\n- Validate all user inputs\n\nSee [Advanced Usage](doc/advanced.md#security-best-practices) for detailed security guidelines.\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/aliumairdev/flutter_pay_kit.git\ncd flutter_pay_kit\n\n# Install dependencies\nflutter pub get\n\n# Run code generation\nflutter pub run build_runner build\n\n# Run tests\nflutter test\n\n# Run example app\ncd example\nflutter run\n```\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🆘 Support\n// Check availability\nfinal isAvailable = await googlePayConfig.isAvailable();\n\nif (isAvailable) {\n  // Request payment\n  final token = await googlePayConfig.requestPayment(amount: 2500);\n\n  if (token != null) {\n    // Process the token with your payment processor\n    print('Payment token: $token');\n  }\n}\n```\n\nFor detailed Google Pay integration instructions, see [GOOGLE_PAY_INTEGRATION.md](GOOGLE_PAY_INTEGRATION.md).\n// Check if Apple Pay is available\nfinal isAvailable = await ApplePayHandler.isAvailable();\nif (isAvailable) {\n  // Request payment\n  final result = await ApplePayHandler.requestPayment(\n    amount: 1999, // $19.99 in cents\n    currency: 'USD',\n    merchantId: 'merchant.com.yourcompany.yourapp',\n    countryCode: 'US',\n    label: 'Premium Subscription',\n  );\n\n  // Process the payment token with your backend\n  final paymentData = result['paymentData'];\n  // Send to your payment processor\n}\n```\n\nFor complete Apple Pay setup instructions, see [APPLE_PAY_SETUP.md](APPLE_PAY_SETUP.md).\n\n## Architecture\n\n- **Documentation**: [doc/getting_started.md](doc/getting_started.md)\n- **Issues**: [GitHub Issues](https://github.com/aliumairdev/flutter_pay_kit/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/aliumairdev/flutter_pay_kit/discussions)\n\n## 🗺️ Roadmap\n\n- [ ] Apple Pay support\n- [ ] Google Pay support\n- [ ] PayPal direct integration\n- [ ] Cryptocurrency payments\n- [ ] Invoice generation\n- [ ] Receipt management\n- [ ] Multi-currency support\n- [ ] Tax calculation integration\n- [ ] Fraud detection hooks\n\n## 📦 Requirements\n\n- **Dart SDK**: `\u003e=3.0.0 \u003c4.0.0`\n- **Flutter SDK**: `\u003e=3.10.0`\n\n## 🌟 Examples\n\nCheck out the [example](example/) directory for a complete Flutter app demonstrating all features:\n\n- Customer initialization\n- Subscription management\n- Payment method handling\n- One-time payments\n- UI widgets showcase\n- Analytics integration\n\n## 📚 Additional Resources\n\n- [Flutter Documentation](https://flutter.dev/docs)\n- [Dart Documentation](https://dart.dev/guides)\n- [Riverpod Documentation](https://riverpod.dev)\n- [Stripe API Documentation](https://stripe.com/docs/api)\n- [Paddle API Documentation](https://developer.paddle.com/)\n- [Braintree API Documentation](https://developer.paypal.com/braintree/docs)\n\n---\n\nMade with ❤️ by the Flutter community\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliumairdev%2Fflutter_pay_kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliumairdev%2Fflutter_pay_kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliumairdev%2Fflutter_pay_kit/lists"}