Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wavvve's avatar

Cashier Subscription Selection

I'm trying to figure out the best way to implement Stripe subscriptions using Cashier. After a user signs up, they're currently kept at a /plan URL until they pick a plan (Yearly or Monthly). My only issue is handling the POST.

For example:

$user->newSubscription('main', 'monthly')->create($creditCardToken);

Currently I just have two Stripe checkout buttons, each with the corresponding information (Monthly for 15/month and Yearly for 150/yr billed annually, respectively.) See below... But for the handling of the post data in the web routes, you need to specify the plan name for Cashier implying that this kind of implementation is meant when you know what exactly was selected rather than having various plan levels. Should I be passing that as a query string or something with the submit of the /plan page (eg: plan?subscription=yearly)? Should I be passing something through the checkout script so that Cashier picks it up on the POST method?

http://image.prntscr.com/image/f03ec7f7368743eeb84bc784ddeec66e.png

0 likes
1 reply
jekinney's avatar

??? Your posting data via a form, so why would you also use URL variables instead of passing all the data in a form?

You post the request, pass the data into the cashier methods and done.

I think your over thinking this. Look at the default scaffolding. A blank install sets this up for you. Just add to the subscriptions array and call it a day.

Please or to participate in this conversation.