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

Node.js调用Stripe发起Payout时外部账户不存在错误的解决方法

解决Stripe提现时"No such external account"错误

核心问题

你传入destination字段的是用户的原始银行账号(如83135997),但Stripe的payouts.create接口要求该参数必须是Stripe系统生成的外部账户ID(格式为ba_xxx),直接用银行账号无法被Stripe识别,因此报错。

具体修正步骤

  • 第一步:先将用户银行账户创建为Stripe外部账户
    你需要先把用户的银行信息添加到对应Stripe客户(Customer)下,获取Stripe返回的外部账户ID。示例代码如下:

    // 先获取目标用户对应的Stripe客户ID(需提前关联存储)
    const customer = await stripe.customers.retrieve('cus_XXXXXX');
    // 将用户银行账号创建为Stripe外部账户
    const externalAccount = await stripe.customers.createSource(customer.id, {
      source: {
        object: 'bank_account',
        country: 'US',
        currency: 'usd',
        routing_number: '用户的银行路由号', // 需从你的银行详情中获取
        account_number: bankDetails.Account_No,
      },
    });
    // 将返回的externalAccount.id(如ba_123456)存储到你的数据库,后续提现使用
    
  • 第二步:修改提现代码,使用正确的外部账户ID
    把destination的值替换为你存储的Stripe外部账户ID,而不是原始银行账号:

    const payout = await stripe.payouts.create({
      amount: amount,
      currency: "usd",
      method: "instant",
      destination: bankDetails.stripe_external_account_id, // 替换为存储的Stripe外部账户ID
    });
    

额外验证项

  • 确认Stripe API密钥的环境(测试/生产)与外部账户所在环境一致,测试环境的账户ID无法用于生产环境提现,反之亦然。
  • 确保该银行账户已通过Stripe的验证流程(如微存款验证),未验证的账户无法接收提现。
  • 检查getBankDetails返回的数据,确认你已正确存储Stripe生成的外部账户ID,而非仅存储用户原始银行账号。

内容的提问来源于stack exchange,提问作者Hemantha Wanniarachchi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.15 23:27:20