【发布时间】:2021-04-11 19:35:31
【问题描述】:
这是我在 Stripe API 中检索交易数量的代码
import stripe
customers = stripe.Customer.list()
print(len(customers))
上面的代码总是在输出中打印10。我正在使用 Stripe 网站给我的测试公钥和私钥。我的代码的哪一部分不正确?
【问题讨论】:
标签: python api transactions payment
这是我在 Stripe API 中检索交易数量的代码
import stripe
customers = stripe.Customer.list()
print(len(customers))
上面的代码总是在输出中打印10。我正在使用 Stripe 网站给我的测试公钥和私钥。我的代码的哪一部分不正确?
【问题讨论】:
标签: python api transactions payment
根据 Stripe API 文档,请求客户列表的默认限制是 10 个。这可能是您最终只获得 10 个客户而不是整个列表的原因。
与许多此类 API 一样,文档包含一个启用分页的参数 starting_after 或 ending_before。您可以阅读有关 Stripe 的 API here 的更多信息 - 我建议您增强您的 API 文档阅读能力,因为我个人发现它们在处理此类项目时非常有用。
【讨论】: