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

如何为关联账户的新客户创建Payment Intent并同步平台客户?

可行解决方案

针对你遇到的Stripe关联账户Payment Intent与跨账户客户同步问题,以下是几个可落地的方案:

方案一:利用平台客户关联功能同步客户记录

  1. 客户完成平台注册后,先在平台账户创建客户对象:
    platform_customer = stripe.Customer.create(
      email="customer@example.com",
      # 可添加其他客户信息如姓名、地址等
    )
    
  2. 在关联账户侧创建与平台客户绑定的关联客户,通过platform_customer参数建立关联:
    connected_customer = stripe.Customer.create(
      platform_customer=platform_customer.id,
      stripe_account="acct_xxxxxx" # 替换为你的关联账户ID
    )
    
  3. 更新关联账户中已创建的Payment Intent,将customer字段设置为上述关联客户的ID:
    stripe.PaymentIntent.update(
      "pi_xxxxxx", # 替换为目标Payment Intent ID
      customer=connected_customer.id,
      stripe_account="acct_xxxxxx"
    )
    
    此操作后,平台账户和关联账户会各自维护同步的客户记录,后续支付完成后,双方都能查看该客户的支付相关数据。

方案二:绑定支付方式后克隆客户

  1. 客户注册平台并完成支付方式收集后,将支付方式绑定到平台客户:
    # 假设已通过前端获取到payment_method_id
    stripe.PaymentMethod.attach(
      "pm_xxxxxx",
      customer=platform_customer.id
    )
    
  2. 此时平台客户已绑定支付方式,可直接克隆到关联账户:
    cloned_customer = stripe.Customer.create(
      email=platform_customer.email,
      payment_method=platform_customer.default_payment_method.id,
      stripe_account="acct_xxxxxx"
    )
    
  3. 同样更新关联账户的Payment Intent,将customer字段替换为克隆后的客户ID,即可完成支付流程。

方案三:调整业务流程(可选)

如果业务逻辑允许,可以优化前置流程:当关联账户需要创建Payment Intent时,先检查客户是否已在平台注册。若未注册,暂不创建Payment Intent,仅记录订单信息;待客户完成平台注册并创建平台客户后,再由关联账户基于关联客户创建Payment Intent并发起支付请求。

注意事项

  • 更新Payment Intent的customer字段时,需确保Payment Intent处于requires_payment_method或requires_confirmation状态,若状态为requires_action,需先完成对应操作或取消后重新创建。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.31 13:51:15