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

如何通过Stripe API查看银行转账及构成该转账的客户支付明细

查看Stripe转账对应的客户支付明细方法
  • 通过Payout API展开关联明细
    调用Stripe的Payout查询接口时,利用expand参数嵌套展开balance_transactions及其关联的source(即客户支付记录)。以Python代码为例:

    import stripe
    stripe.api_key = "你的API密钥"
    
    # 替换为目标转账的ID
    payout = stripe.Payout.retrieve(
      "po_xxxxxx",
      expand=["balance_transactions", "balance_transactions.source"]
    )
    
    # 遍历输出客户支付明细
    for transaction in payout.balance_transactions:
        payment = transaction.source
        print(f"支付ID: {payment.id} | 金额: {payment.amount/100} USD | 客户邮箱: {payment.customer.email if payment.customer else '匿名'}")
    
  • 通过余额交易列表筛选关联转账
    已知转账ID的情况下,直接查询关联该转账的所有余额交易,再展开支付来源:

    import stripe
    stripe.api_key = "你的API密钥"
    
    # 替换为目标转账的ID
    transactions = stripe.BalanceTransaction.list(
      payout="po_xxxxxx",
      expand=["data.source"]
    )
    
    # 筛选出客户支付类型的记录(排除手续费、退款等)
    for tx in transactions.data:
        if tx.type == "charge":
            payment = tx.source
            print(f"客户支付ID: {payment.id} | 金额: {payment.amount/100} USD | 客户ID: {payment.customer}")
    
  • 关键提示

    • 确保API密钥拥有read_payouts和read_charges权限
    • 余额交易包含多种类型(手续费、退款等),可通过tx.type筛选出仅charge类型的客户支付记录

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.21 17:17:18