<% if @selected_plan.nil? %> <% cents_due_now = 0 %>
Saving a payment method allows you to freely switch between Notebook.ai subscription plans with ease. Your information is stored securely in our payment processing provider, Stripe, and will not be shared with any other parties.
<% else %> <% case @selected_plan.stripe_plan_id when 'premium' cents_due_now = 900 service_length = 'one month' bill_frequency = 'month' when 'premium-trio' cents_due_now = 2400 service_length = 'three months' bill_frequency = '3 months' when 'premium-annual' cents_due_now = 8400 service_length = 'twelve months' bill_frequency = 'year' end %>

You are signing up for Notebook.ai's <%= @selected_plan.name %> plan. You will be charged <%= number_to_currency(cents_due_now / 100.0) %> now for <%= service_length %> of membership, renewing every <%= bill_frequency %>.

In order to get started, we need to collect your payment information below.

<% end %>
<%= hidden_field_tag 'authenticity_token', form_authenticity_token %>
<% if @selected_plan.nil? %> <% else %> <% active_plan_on_stripe = @stripe_customer.subscriptions.data.select { |sub| sub.plan.id == @selected_plan.stripe_plan_id }.first %> <% if active_plan_on_stripe %>

Since you've already paid for a <%= @selected_plan.name %> plan until <%= Time.at(active_plan_on_stripe.current_period_end).strftime('%B %d') %>, you will not be charged again for this plan until it renews on that date.

<% elsif @selected_plan.stripe_plan_id == 'premium' %>

You will be charged <%= number_to_currency(@selected_plan.monthly_cents / 100) %> immediately, renewing monthly.

Of course, you can cancel at any time.

<% elsif @selected_plan.stripe_plan_id == 'premium-trio' %>

You will be charged $25.00 immediately, renewing every three months.

Of course, you can cancel at any time.

<% elsif @selected_plan.stripe_plan_id == 'premium-annual' %>

You will be charged <%= number_to_currency(@selected_plan.monthly_cents * 12 / 100) %> immediately, renewing annually.

Of course, you can cancel at any time.

<% end %> <% end %>