条纹累了的毕业生定价 API 不返回金额

ram*_*lli 1 stripe-payments

stripe pricing api不提供tired -graduate定价金额的详细信息。

::Stripe::Price.retrieve('price_1HMjKfHHVdXnGelT')
Run Code Online (Sandbox Code Playgroud)

这是回应:

<Stripe::Price:0x3fed95f00ab0 id=price_1HMjKfHHVdXnss3> JSON: {
  "id": "price_1HMjKfHHVdXnGelT7fB47cEk",
  "object": "price",
  "active": true,
  "billing_scheme": "tiered",
  "created": 1599004569,
  "currency": "aud",
  "livemode": false,
  "lookup_key": null,
  "metadata": {},
  "nickname": null,
  "product": "prod_HwcZXLTSewzcj1",
  "recurring": {"aggregate_usage":null,"interval":"month","interval_count":1,"trial_period_days":null,"usage_type":"licensed"},
  "tiers_mode": "graduated",
  "transform_quantity": null,
  "type": "recurring",
  "unit_amount": null,
  "unit_amount_decimal": null
}
Run Code Online (Sandbox Code Playgroud)

此图像是条纹仪表板(开发人员控制台 -> 网络选项卡)。 tiers上面的api中缺少键

在此处输入图片说明

ram*_*lli 5

expanding responsesin stripe doc 解决了这个问题。

Stripe::Price.retrieve({id:'price_1HMjKfHHVdXnGelT', expand: ['tiers']})         
Run Code Online (Sandbox Code Playgroud)