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

手动处理支付宝重定向时触发StripeInvalidRequestError:无对应payment_intent

问题分析与解决

错误原因

创建PaymentIntent时指定了stripeAccount: connectedStripeAccountId(关联子账号),但确认PaymentIntent的请求没有携带该关联账号参数,导致Stripe默认用平台主账号查找这个PaymentIntent,而该Intent实际存在于关联子账号中,因此抛出「找不到PaymentIntent」的错误。

修复代码

在paymentIntents.confirm调用中同样传入stripeAccount参数,确保操作的是同一个账号下的PaymentIntent:

const paymentIntent = await stripe.paymentIntents.create(
  {
    payment_method_types: ['alipay'],
    amount: 1000,
    currency: 'hkd',
    application_fee_amount: 0,
  },
  {
    stripeAccount: connectedStripeAccountId,
  },
);

// 确认时添加stripeAccount参数
const comfirmpaymentIntent = await stripe.paymentIntents.confirm(
  paymentIntent.id,
  {
    return_url: 'https://....',
  },
  {
    stripeAccount: connectedStripeAccountId,
  },
);

额外注意事项

  • 确保connectedStripeAccountId是有效的关联账号ID,且该账号已开通Alipay支付功能
  • 检查返回的return_url是否符合Stripe要求(需为HTTPS协议、域名已在Stripe后台配置)
  • 若问题仍存在,可通过Stripe Dashboard的关联账号后台,查看该PaymentIntent的状态及操作日志

内容的提问来源于stack exchange,提问作者Eason Liu

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.23 06:54:23