app/controllers/stripe_controller.rb
# TODO: This has mostly been taken from stripe documentation and it's not very robust right now.
# Rewrite this with strong params etc
# And move it to Background jobs
This has mostly been taken from stripe documentation and it's not very robust right now.
Rewrite this with strong params etc
And move it to Background jobs
This has mostly been taken from stripe documentation and it ' s not very robust right now . Rewrite this with strong params etc And move it to Background jobs
def customer_portal
    app_host = ENV['APP_HOST']
    return_url = "https://#{app_host}"
    session = Stripe::BillingPortal::Session.create({
      customer: @current_user.subscription.stripe_id,
      return_url: return_url
    })
    render json: { url: session.url }
  end
def customer_portal app_host = ENV [ 'APP_HOST' ] return_url = "https://#{app_host}" session = Stripe :: BillingPortal :: Session . create ( { customer : @current_user . subscription . stripe_id , return_url : return_url } ) render json : { url : session . url } end
TODO: This has mostly been taken from stripe documentation and it's not very robust right now.
TODO : This has mostly been taken from stripe documentation and it ' s not very robust right now .
# This is the URL to which users will be redirected after they are done # managing their billing.