easy_stripe_payment 4.0.0 copy "easy_stripe_payment: ^4.0.0" to clipboard
easy_stripe_payment: ^4.0.0 copied to clipboard

A Flutter package that provides simple and ready stripe payment method.

πŸ’³ EasyStripePayment for Flutter #

A lightweight yet powerful Flutter package that makes Stripe payments integration a breeze.
It supports full payment flows including payment intent creation, payment sheet UI, charge verification, full & partial refunds, and charge detail retrieval β€” all with a clean API and modern Flutter standards. you just have to active payment method in your stripe dashboard from here

Demo Vid Demo Vid


β˜• Support My Work #

If you find Easy Stripe Payment useful and would like to support my work, consider buying me a coffee!

A small cup of coffee might not mean much to you, but for me, it means a lotβ€”it fuels my passion and helps me continue building and improving tools for the Flutter community. πŸš€

πŸ‘‰ Buy me a coffee

QR Code

Your support keeps me motivated to provide more content, updates, and helpful tools. Thank you for being awesome! ❀️ #


πŸš€ Features #

  • βœ… Easy Stripe initialization with publishable key
  • 🧾 Create Payment Intents from backend
  • 🧍 Collect user billing info (email, address, etc.)
  • πŸ’³ Show Stripe Payment Sheet with all payment method
  • βœ… Verify payment status via backend
  • πŸ’Έ Full or partial refunds
  • πŸ“„ Retrieve charge details (including receipt URL)
  • πŸ”’ Secure integration with your backend API
  • πŸ’‘ Uses dartz for functional error handling
  • πŸ› οΈ State managed with ChangeNotifier

πŸ§ͺ Quick Test Mode with EasyStripePaymentTest For testing purposes, you can use EasyStripePaymentTest which allows initializing directly with both your publishableKey and secretKey (for local test only ⚠️). This skips the need for a backend during development:

πŸ”§ Requirements #

Android #

This plugin requires several changes to work on Android devices. Please make sure you follow all these steps:

  • Use Android 5.0 (API level 21) and above.
  • Use Kotlin version 1.8.0 and above
  • Requires Android Gradle plugin 8 and higher: Link
  • Use a descendant of Theme.AppCompat for your activity: Link , Link
  • Use FlutterFragmentActivity instead of FlutterActivity in MainActivity.kt: Link
  • edit your gradle.properties file to be like this : link
  • Add the following rules to your proguard-rules.pro file:link
    -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g
    -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
    -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
    -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
    -dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider
    

iOS #

Compatible with apps targeting iOS 13 or above.

To upgrade your iOS deployment target to 13.0, you can either do so in Xcode under your Build Settings, or by modifying IPHONEOS_DEPLOYMENT_TARGET in your project.pbxproj directly.

You will also need to update your Podfile:

platform :ios, '13.0'

For card scanning, add the following to your Info.plist:

<key>NSCameraUsageDescription</key>
<string>Scan your card to add it automatically</string>
<key>NSCameraUsageDescription</key>
<string>To scan cards</string>

πŸ“Œ Installation #

Add the package to pubspec.yaml: run:

flutter pub add easy_stripe_payment

or :

dependencies:
  easy_stripe_payment: ^4.0.8

Test Mode : #

await EasyStripePaymentTest.instance.init(
  secretKey: "sk_test_...",
  publishKey: "pk_test_...",
);

⚠️ Use this only in development β€” Never expose your secretKey in production apps.


πŸ§ͺ Quick Start #

1. Initialize Stripe #

await EasyStripePayment.instance.initStripe(
  publishKey: "pk_test_...Just4prog.nl...",
  baseUrl: "https://Just4prog.nl/",
  merchantName: "Just4prog.nl",
);

2. Start Payment Flow #

final result = await EasyStripePayment.instance.makePayment(
  paymentIntentEndpoint: "create-payment-intent/",
  amount: 99.99,
  currency: "eur",
  name: "Ahmed",
  email: "Ahmed@Just4prog.nl",
  city: "Amsterdam",
  country: "NL",
  postalCode: "1234AB",
);

3. Verify Payment #

final verification = await EasyStripePayment.instance.verifyPayment(
  statusEndpoint: "verify-payment/",
  paymentIntentId: result.getOrElse(() => ""),
);

4. Get Charge Details #

final chargeDetails = await EasyStripePayment.instance.getChargeDetails(
  chargeDetailsEndpoint: "charge-details/",
  chargeId: "ch_1XYZ...",
);

5. Refunds (Full / Partial) #

// Full refund
await EasyStripePayment.instance.refundPayment(
  refundEndpoint: "process-refund/",
  chargeId: "ch_1XYZ...",
);

// Partial refund
await EasyStripePayment.instance.partialRefund(
  partialRefundEndpoint: "partial-refund/",
  amount: 50.00,
  chargeId: "ch_1XYZ...",
);

🧠 Architecture Overview #

  • EasyStripePayment is a singleton for global access.
  • Integrates with your backend to handle all sensitive operations.
  • Uses Dio for HTTP requests.
  • Uses Either<Error, Result> from Dartz to make error handling easy and expressive.

πŸ“¦ Backend Required Endpoints #

Endpoint Description
/create-payment-intent Create a payment intent
/verify-payment/:id Verify payment status via intent ID
/charge-details/:id Retrieve charge details
/process-refund/ Refund full payment
/partial-refund/ Refund partial amount

πŸ“Έ UI Example (in Flutter) #

ElevatedButton(
  onPressed: () async {
    final result = await EasyStripePayment.instance.makePayment(
      paymentIntentEndpoint: "create-payment-intent",
      amount: 49.99,
      currency: "eur",
      name: "Ahmed",
      email: "Ahmed@just4prog.nl",
    );
    result.fold(
      (error) => print("❌ Payment failed: $error"),
      (intentId) => print("βœ… Success! Intent ID: $intentId"),
    );
  },
  child: const Text("Pay €49.99"),
);

✨ Author #

Developed with ❀️ by Ahmed @ Just4Prog
Need a custom payment integration? Hit me up!

Contact #

Email: ahmadnahal7@gmail.com

Payment Methods Available #

Cards #

  • Cards - Popular globally.
  • Cartes Bancaires - Popular in France.

Wallets #

  • Alipay - Popular in China.
  • Apple Pay - Popular globally.
  • Google Pay - Popular globally.
  • Link - Customized, popular globally.
  • MobilePay - Popular in Denmark and Finland.
  • PayPal - Popular globally.
  • Revolut Pay - Popular in Europe and the United Kingdom.
  • WeChat Pay - Popular in China.

Vouchers #

  • Multibanco - Popular in Portugal.

Bank Redirects #

  • Bancontact - Popular in Belgium.
  • BLIK - Popular in Poland.
  • EPS - Popular in Austria.
  • giropay - Popular in Germany.
  • iDEAL - Popular in the Netherlands.
  • Przelewy24 - Popular in Poland.
  • Sofort - Popular in Germany, Austria, and Switzerland.
  • TWINT - Popular in Switzerland.

Buy Now, Pay Later #

  • Klarna - Popular in Europe and the United States.

Bank Debits #

  • SEPA Direct Debit - Popular in Europe.
  • ACH Direct Debit - Popular in the United States.

Bank Transfers #

  • Bank transfer - Popular globally, used for large payments.
  • Webhooks - Recommended for improving transaction security.

Payment Methods by Country #

  • South Korea - Includes South Korean cards, Naver Pay, Kakao Pay, Samsung Pay, and Payco.
1
likes
145
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides simple and ready stripe payment method.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

dartz, dio, flutter, flutter_stripe

More

Packages that depend on easy_stripe_payment