Subscribing an account to a free plan
Reference points:
- https://jumpstartrails.com/discussions/322
- https://jumpstartrails.com/discussions/444
1. Add a "free plan" in the jumpstart admin
2. Enable the person to use the id in the new account subscription UI flow (remove scope to `without_free` in subscriptions_controller.rb#L91, and also show the free acount on the pricing page)
def set_plan @plan = Plan.find_by(id: params[:plan]) redirect_to pricing_path if @plan.nil? end
3. Build a subscription as normal (subscriptions_controller.rb#L18-L30)
def create current_account.assign_attributes(subscription_params) @plan = Plan.find(current_account.plan) # Get the Stripe or Braintree specific ID processor_id = @plan.processor_id(current_account.processor) coupon = current_account.coupon current_account.subscribe(plan: processor_id, trial_period_days: @plan.trial_period_days, coupon: coupon) redirect_to subscription_success_path, notice: t(".created") rescue Pay::ActionRequired => e redirect_to pay.payment_path(e.payment.id) rescue Pay::Error => e flash[:alert] = e.message render :new end
However, when the user clicks the button to subscribe, I end up with:
I am assuming this error now comes from the Pay gem. In Jumpstart admin area (payments), I have only enabled the 'stripe' payment processor, and there is no option for "jumpstart" as a processor for the free plan.
How can I ensure that I can 'subscribe' free users to the free plan?
Notifications
You’re not receiving notifications from this thread.