We've moved discussions to Discord

How would I handle lifetime payments from customers?

Dan Weaver
When I launch my SaaS I'll be doing a lifetime deal for a short time. Pay once and get access to the app forever.

Can the Stripe and PayPal integrations handle that as-is or will I need to code this functionality myself?
Chris Oliver
You'd need to build something custom for this, since SaaS is built with a subscription in mind.

This is very similar to how I'm selling Jumpstart Pro licenses, so I can walk you through it fairly well:

I'd add a `lifetime` boolean to the Team model that keeps track.

For selling the lifetime deal, you would just use Pay to do a one-time charge: https://github.com/excid3/pay

current_team.charge(lifetime_deal_price_in_cents)

What you'd probably need to do is just modify the `subscribed?` method on Team so that you first check if they're a lifetime customer or not.

And in the team model, you'd override it like so:

model Team
  def subscribed?
    lifetime? || super
  end
end

Then everything would work basically the same for checking if the customer was subscribed or not.

As for the forms, you have two options:

1. Render the card form (same as the update card form) to record the card, then once a card exists, you can render the purchase form that points to the new controller action. This is what I'm doing on Jumpstart Pro.
2. Render the card form but modify them so the URL they point to the new controller action. This would keep everything in one form/step nicely but a bit more work as you need to clone the forms.

Your controller action would simply collect the payment processor chosen (stripe or briantree) from the params and the card token and assign it to the user, then make the charge, and if successful, update the team's lifetime attribute. You can see an example of how that's done in the subscriptions controller. Basically will be the same for yours except that it needs to make a charge instead of a subscribe call.
Ohad Dahan
I have a 'subscription_end' column for each user and I update it after each payment, etc.
If the plan is monthly, yearly, "lifely" I update accordingly , so a lifetime will be subscription_end = DateTime.now + 200.years .
Notifications
You’re not receiving notifications from this thread.