You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Flutter的Stripe Payment Sheet中隐藏账单地址字段?

Flutter Stripe PaymentSheet 移除账单地址方案

完全可以移除账单地址字段,不需要更换支付系统,通过后端+前端的配置即可实现:

1. 后端创建PaymentIntent时配置

在生成PaymentIntent的请求中,指定billing_address_collection为'none',告知Stripe无需收集账单地址。以Node.js后端为例:

const paymentIntent = await stripe.paymentIntents.create({
  amount: 1000, // 金额单位为分
  currency: 'usd',
  payment_method_types: ['card'],
  billing_address_collection: 'none', // 核心配置:禁用账单地址收集
  metadata: {
    // 可添加自定义元数据,比如关联用户ID等
  }
});

2. Flutter前端PaymentSheet配置

初始化PaymentSheet时,通过billingDetailsCollectionConfiguration设置不展示地址及其他非必需字段:

final paymentSheet = PaymentSheet(
  paymentIntentClientSecret: clientSecret, // 从后端获取的clientSecret
  configuration: PaymentSheetConfiguration(
    merchantDisplayName: '你的商家名称',
    billingDetailsCollectionConfiguration: const BillingDetailsCollectionConfiguration(
      address: BillingDetailsCollectionConfiguration.addressNever, // 隐藏地址字段
      // 若不需要姓名、邮箱等,可同理设置为xxxNever
      name: BillingDetailsCollectionConfiguration.nameNever,
      email: BillingDetailsCollectionConfiguration.emailNever,
    ),
  ),
);

配置完成后,PaymentSheet将只显示卡号、过期时间、CVV等核心支付字段,不会出现账单地址输入项,完全适配你的应用内货币支付场景。

内容的提问来源于stack exchange,提问作者Levan Apakidze

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 00:18:12