Rimian Perkins 1b232a1bd4 list plans
2019-09-25 11:18:11 +10:00

29 lines
583 B
Ruby

# frozen_string_literal: true
module DiscoursePatrons
class PlansController < ::Admin::AdminController
include DiscoursePatrons::Stripe
before_action :set_api_key
def index
plans = ::Stripe::Plan.list
render json: plans.data
end
def create
plan = ::Stripe::Plan.create(
amount: params[:amount],
interval: params[:interval],
product: {
name: 'Gold special',
},
currency: SiteSetting.discourse_patrons_currency,
id: 'gold-special',
)
render json: plan
end
end
end