"Pay what you want" price

Hello everyone :slight_smile:

My client use ghost and a “pay what you want” pricing is what they want.

here is the payment flow:

page 1: choose your plan and the price you want
page 2: stripe checkout portal

I’m going to try something with a custom backend containing only one route that will take care of creating the stripe session. This route will take a price argument as well as information about wether it’s a recurring or one time, return the session id, and hopefully I’ll get something.

However, I know I’ll bump into a lot of little rocks on this path. If someone already implemented something like this, or if someone from the ghost team has any feedback about this idea of implementation, I’d be happy to hear :slight_smile:

Looking forward to hearing more, enjoy your week end everyone,

Kevin

4 Likes

Commenting because I’m interested in this idea as well and will be following any updates.

1 Like

Oh and I didn’t mention, but this is on recurring billing (dunno if ghost handles one time payment though but still worth mentioning)

So, there were no rocks on the path, this is beautiful and I’m in love with how smooth it works.

Only slightly tricky things were on the stripe side.

What I learnt about stripe subscriptions:

  • you need a planId to create a subscription
  • once a plan is created, you cannot easily change its price (you can do discounts though but didn’t work for my usecase)
  • the way people do when they want to do this is creating one plan per subscription.

How I did the thing :

Front end :

  1. send a request to my custom server, something like “/get-stripe-checkout-link”, body : {email: “hi@mail.co”, amount: 22 }, wait for the response with checkout link. Follow the link. over.

Back end

  1. receive the request, make all the checks.
  2. create a plan based on the price requested
  3. create a subscription with this plan

With this method we get

  • custom price payment
  • automatic sync with ghost (we owe this to the beautiful architecture of Ghost :heart:)
  • confirmation email is sent like usual

Almost seems too beautiful, maybe I’ll discover something ? I can’t think of anything so… it’s wrapped :slight_smile:
(but I’d still take some feedback from the ghost team to be 100% sure because we rely a lot on the way ghost is built and it may be broken in future versions if they decide to change something)

4 Likes

Oh this would be incredible for me with the Obsidian Roundup; currently I’m redirecting people towawrd Github for this kind of thing and it’s a bit troublesome. I would love for this functionality to make its way into core!

2 Likes

Oh, this is so cool! Are you planning to put the source code or details of implementation up somewhere?

1 Like

I will share this week ! (once I’m done with my custom setup of ghost on a vps)

2 Likes

There it is , I published the sample code on github so that you can have a more precise vision of how it works.

I made some cleaning but didn’t test the front end to be honest so it might not work, but the backend is working and is where most of the deal happens.

If you guys don’t really code it may be very difficult to use it though.

it makes me think that it might be an opportinuty to create a paying plugin for ghost that would handle it with no coding if there is demand for that, and get that SASS money I’ve always dream of hahaha.

anyway here is the sample code:

bye !

4 Likes

Any chance that you have made this into a plugin? :smile:

2 Likes