LoginSignup
0
0

More than 5 years have passed since last update.

Ruby on RailsでStripeのPlanの情報を取得する

Last updated at Posted at 2019-04-05

前提

stripegem を使う。

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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0