列出 Connected Stripe 帐户的所有费用

List all charges of a Connected Stripe Account

我有带连接带帐户的带带平台。

我想获得对特定关联帐户的所有收费。

用户关联帐户 ID:

acct_xxx

我能找到的唯一文档是基于秘密 api 密钥检索到的客户。 https://stripe.com/docs/api/charges/list

const stripe = require('stripe')('sk_test_xxx');

const charges = await stripe.charges.list({
  limit: 3,
});

我需要获取关联账户的所有费用。平台客户不收费。

我为 ruby 找到了类似的堆栈溢出问题。

我不知道如何使用 node.js

实现此目的

您需要传递 Stripe-Account header 才能在“Connect 帐户”上进行 API 调用:https://stripe.com/docs/connect/authentication#stripe-account-header

大多数 Stripe 的客户端库(如 stripe-node)允许在选项哈希中为每个 API 调用函数传递一个参数,如:

const charges = await stripe.charges.list(
  {
    limit: 3,
  },
  {
    stripeAccount: 'acct_12345'
  }
);