discourse-subscriptions/app/controllers/subscriptions_controller.rb

21 lines
412 B
Ruby
Raw Normal View History

2019-10-13 18:52:43 -04:00
# frozen_string_literal: true
module DiscoursePatrons
class SubscriptionsController < ::ApplicationController
include DiscoursePatrons::Stripe
before_action :set_api_key
def create
subscription = ::Stripe::Subscription.create(
customer: params[:customer],
items: [
2019-10-13 20:47:49 -04:00
{ plan: params[:plan] },
2019-10-13 18:52:43 -04:00
]
)
render_json_dump subscription
end
end
end