You need to enable JavaScript to run this app. Stripe CLI创建Payment Intent时application fee配置报错及语法咨询
优惠活动
大模型
产品
解决方案
定价
更多

Stripe CLI创建Payment Intent时application fee配置报错及语法咨询

Stripe CLI 创建Payment Intent时application fee配置指南

触发的官方报错:"Can only apply an application fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter)"

报错核心逻辑

application-fee-amount是平台从关联账户交易中抽取的佣金参数,必须和代关联账户发起请求的身份标识搭配使用,单独传入该参数不满足分账校验规则,必然返回报错。

你当前命令的格式问题

你尝试运行的命令:

stripe payment_intents create --amount 2000 --application-fee-amount 500 --customer cus_testuser --currency=eur --payment-method pm_card_visa --confirm=true -d transfer_data[]=acct_test user

存在3处不满足Stripe校验规则的写法:

  • 嵌套参数transfer_data的写法错误,Stripe CLI解析嵌套参数需要明确指定内层字段名,不能用空数组transfer_data[]的形式传值
  • 测试账户IDacct_test user带了多余空格,会被识别为无效的账户标识
  • 未通过参数明确指定交易资金的接收方,仅声明抽佣金额,和Stripe要求的“代关联账户交易”的校验逻辑不匹配

两种正确可运行的配置方式

方式1:通过transfer_data指定资金划转路径(推荐)

创建Payment Intent时直接声明:交易收单资金扣除平台抽取的application fee后,剩余部分自动划转至指定关联账户。
参考命令:

stripe payment_intents create --amount 2000 --application-fee-amount 500 --customer cus_testuser --currency eur --payment-method pm_card_visa --confirm true --transfer_data[destination]=acct_你的测试关联账户ID

方式2:通过Stripe-Account头以关联账户身份发起请求

直接使用平台密钥代指定关联账户发起交易,此时无需额外传transfer_data参数,只要身份匹配即可正常配置application fee。
参考命令:

stripe payment_intents create --amount 2000 --application-fee-amount 500 --customer cus_testuser --currency eur --payment-method pm_card_visa --confirm true --stripe-account=acct_你的测试关联账户ID

注意事项

  • 旧版独立destination参数已在Payment Intent接口中废弃,当前所有资金划转逻辑统一由transfer_data对象承接
  • 作为资金接收方的ID必须是Stripe后台创建的支持分账的标准/Express类型关联账户,普通客户ID、付款方式ID不能作为接收方
  • Stripe CLI的参数解析对格式校验严格,参数值间不要加多余空格、特殊符号,避免出现解析失败的问题

内容的提问来源于stack exchange,提问作者Jonny M

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.27 04:27:01