Stripe Payment Element自定义商家信息可行性咨询
修改Stripe Payment Element中Bacs Direct Debit授权弹窗商家信息的方法
可行,但你尝试的business参数对Payment Element无效,正确的实现方式有两种:
一、通过Stripe账户后台配置(推荐)
Bacs授权弹窗的商家信息默认从你的Stripe账户资料同步,步骤如下:
- 登录Stripe后台,进入「设置」→「商家资料」
- 更新商家名称、地址、联系邮箱等信息
- 保存后,Payment Element会自动将这些信息加载到Bacs授权弹窗,无需改动前端代码
二、动态配置(后端+前端配合)
如果需要针对不同订单使用不同商家信息,得在后端创建Payment Intent/Setup Intent时指定商家详情:
示例Node.js后端代码:
const stripe = require('stripe')('你的Stripe秘钥'); const paymentIntent = await stripe.paymentIntents.create({ amount: 1000, // 单位:便士 currency: 'gbp', payment_method_types: ['bacs_debit'], payment_method_options: { bacs_debit: { mandate_data: { customer_acceptance: { type: 'online', online: { ip_address: '客户的IP地址', user_agent: '客户的浏览器UA', business_name: '自定义商家名称', business_address: { line1: '商家地址', city: '城市', postal_code: '邮编', country: 'GB' }, business_email: '商家联系邮箱' } } } } }, });
前端只需正常初始化Payment Element并关联该Intent即可,不需要设置business参数——这个参数是旧版单个支付方式Element(比如Card Element)的配置,Payment Element不支持。
内容的提问来源于stack exchange,提问作者J Foley
相关产品推荐
相关产品推荐

