Stripe API获取Price时如何展开currency_options中的tiers?
解决Stripe API获取Price时展开所有currency_options内tiers的问题
- 问题根源:
currency_options是键值对对象(键为货币代码),而非数组,原命令里的currency_options.data.tiers是错误写法,Stripe无法识别该路径。 - 最优方案:使用**通配符
***匹配currency_options下的所有货币键,一次请求即可展开所有对应tiers,同时保留根层级tiers的展开。
修改后的CLI命令:
stripe prices retrieve X \ -d "expand[0]"=tiers \ -d "expand[1]"=currency_options.*.tiers
- 效果说明:该命令会同时返回:
- 根层级的
tiers字段 currency_options下所有货币对应的tiers字段,无需预先知晓货币代码,一次请求完成数据获取
- 根层级的
内容的提问来源于stack exchange,提问作者Victor T.
相关产品推荐
相关产品推荐

