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

如何解决Stripe订阅中展开items.data.price.product的层级限制错误?

你遇到的错误是因为Stripe的展开功能限制最多4级嵌套,而你使用的路径data.items.data.price.product是5级层级(data→items→data→price→product),超出了限制阈值。

解决方法1:针对单个订阅展开

如果你只需要查看某一个特定订阅的关联Product,改用subscriptions retrieve命令(而非list),此时路径层级刚好符合4级限制:

stripe subscriptions retrieve 你的订阅ID --expand items.data.price.product

这里的展开路径为items.data.price.product,层级是:items(1)→data(2)→price(3)→product(4),完全符合Stripe的限制要求。

解决方法2:批量获取客户所有订阅的Product

如果需要获取该客户名下所有订阅的关联Product,分两步操作:

  1. 先获取订阅列表并展开到Price层级:
stripe subscriptions list --customer cus_QgBmuycCay7CGu --expand data.items.data.price
  1. 从返回结果中提取每个Price对应的product字段(即Product ID),再单独查询每个Product的详情:
# 示例:查询单个Product信息
stripe products retrieve prod_xxx
# 若有多个Product ID,可通过脚本循环批量处理(比如Bash循环)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.19 10:05:14