搜索插件、代码仓与 APP 分类

flutter_stripe_payment 封面
插件详情v0.0.18

flutter_stripe_payment

将 Stripe 添加到您的 Flutter 应用程序中,使用带有强 SCA 3DS 合规性的 Payment Intents 接受信用卡支付。

AndroidiOS
近 30 天下载
85
喜欢数
57
Pub 分数
125

安装插件

flutter pub add flutter_stripe_payment

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

flutter_stripe_payment 是一个 Flutter 包,可实现将 Stripe 支付处理无缝集成到移动应用程序中。它支持通过 Payment Intents 进行信用卡支付,确保符合强客户认证(SCA)和 3D 安全(3DS)要求。该包专为 Android 和 iOS 设计,通过内置的令牌化支持和实时支付确认,简化了安全交易处理。开发者可以实现稳健且符合 PCI 标准的支付流程,而无需直接管理敏感的卡数据。SDK 处理复杂的认证流程,提高结账成功率,同时保持高标准的安全性。

适合场景

  • 应用内购买
  • 电子商务结账
  • 订阅计费
  • 数字服务付款
  • 在线捐赠

主要特点

  • 符合SCA和3DS要求
  • 支付意图支持
  • 安全的卡片令牌化
  • 实时支付确认
  • 跨平台(Android & iOS)

适合对象

  • 移动电子商务应用
  • 基于订阅的服务
  • 需要安全支付的应用
  • 使用 Stripe 的开发者
  • 需要 SCA 合规的项目

使用建议

  • 需要设置 Stripe 账户
  • 需要后端来创建支付意图
  • 仅限 Stripe 的支付方式
  • 依赖网络连接
  • 可能需要为测试环境进行额外配置

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_stripe_payment

Add Stripe to your Flutter Application to Accept Card Payments using Payment Intents and the Latest SCA Compliance 3DS Requirements

Getting Started

Strong Customer Authentication (SCA), a new rule coming into effect on September 14, 2019, as part of PSD2 regulation in Europe, will require changes to how your European customers authenticate online payments. Card payments will require a different user experience, namely 3D Secure, in order to meet SCA requirements. Transactions that don’t follow the new authentication guidelines may be declined by your customers’ banks.

The Payment Intents API is a new way to build dynamic payment flows. It tracks the lifecycle of a customer checkout flow and triggers additional authentication steps when required by regulatory mandates, custom Radar fraud rules, or redirect-based payment methods.

Initialize

final _stripePayment = FlutterStripePayment();
_stripePayment.onCancel = (){
  print("User Cancelled the Payment Method Form");
};

Setup Stripe Environment


_stripePayment.setStripeSettings(
        appConfig.values.stripePublishableKey,
        appConfig.values.applePayMerchantId);

Show Payment Form

var paymentResponse = await _stripePayment.addPaymentMethod();
if(paymentResponse.status == PaymentResponseStatus.succeeded)
  {
    print(paymentResponse.paymentMethodId);
  }

Create Payment Intent On Server

var intent = PaymentIntent();
    intent.amount = widget.order.cart.total;
    intent.isManual = true;
    intent.isConfirmed = false;
    intent.paymentMethodId = paymentResponse.paymentMethodId;
    intent.currency = "usd";
    intent.isOnSession = true;
    intent.isSuccessful = false;
    intent.statementDescriptor = "Dorm Mom, Inc";
    var response = await widget.clientDataStore.createPaymentIntent(intent);

Confirm Payment Intent to Kick Off 3D Authentication

var intentResponse = await _stripePayment.confirmPaymentIntent(
          response.clientSecret, paymentResponse.paymentMethodId, widget.order.cart.total);

      if (intentResponse.status == PaymentResponseStatus.succeeded) {
        widget.order.paymentIntentId = intentResponse.paymentIntentId;
        widget.order.paymentMethodId = paymentResponse.paymentMethodId;
        _submitOrder();
      } else if (intentResponse.status == PaymentResponseStatus.failed) {
        setState(() {
          hideBusy();
        });
        globals.Utility.showAlertPopup(
            context, "Error Occurred", intentResponse.errorMessage);
      } else {
        setState(() {
          hideBusy();
        });
      }

Setup Payment Intent For Future Payments

var intentResponse = await _stripePayment.setupPaymentIntent(
        response.clientSecret, paymentResponse.paymentMethodId);

    if (intentResponse.status == PaymentResponseStatus.succeeded) {
      await _addCardToAccount(paymentResponse.paymentMethodId);
    } else if (intentResponse.status == PaymentResponseStatus.failed) {
      setState(() {
        hideBusy();
      });
      globals.Utility.showAlertPopup(
          context, "Error Occurred", intentResponse.errorMessage);
    } else {
      setState(() {
        hideBusy();
      });
    }

Screenshots

iOS View Android View
iOS View Android View

To Do

  • [DONE]Android Implementation
  • STPaymentCardTextField Inline Embedding

所属分类

源码仓库

使用此插件的项目

暂无相关数据。