Skip to Content Skip to Search
Methods
C
D
Included Modules

Instance Public methods

create()

# File app/controllers/v2/memberships_controller.rb, line 8
def create
  if successful_setup_intent?
    head :ok
  elsif complete_subscription_payment?
    complete_subscription_payment
  else
    attempt_membership_creation
  end
end

destroy()

# File app/controllers/v2/memberships_controller.rb, line 18
def destroy
  authorize! subscription, :destroy?

  if subscription_manager.cancel(canceled_reason)
    record_cancelation_event(reason: canceled_reason)

    render json: subscription,
      cancel_at_period_end:,
      serializer: Memberships::CancellationSerializer
  else
    render_manager_errors
  end
end