mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-27 22:29:27 +00:00
29 lines
583 B
Ruby
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
|