前提
stripe
の gem
を使う。
gem 'stripe'
方法
Stripe::Plan.all
でPlanの一覧を取得できる。
Stripe::Plan.all
=> #<Stripe::ListObject:0x3fefc6771f14> JSON: {
"object": "list",
"data": [
{"id":"plan_Epxxxxxxxxxxxx","object":"plan","active":true,"aggregate_usage":null,"amount":480,"billing_scheme":"per_unit","created":1554439001,"currency":"jpy","interval":"month","interval_count":1,"livemode":false,"metadata":{},"nickname":"product_name","product":"prod_Epxxxxxxxxxxxx","tiers":null,"tiers_mode":null,"transform_usage":null,"trial_period_days":60,"usage_type":"licensed"}
],
"has_more": false,
"url": "/v1/plans"
}
classはArrayとなっている。
Stripe::Plan.all.data.class
=> Array