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

Chris1904's avatar

How to create "custom subscriptions" using Stripe?

Hi everyone,

I have a scenario where I would like customers to choose whether they want a product each Monday (until their chosen expiration date), Tuesday, or Friday, and then charge them on those days that they want to have the product on.

These dates are totally custom and don't have to be of some sort of a convention. It could be that they want a product this Monday only, and then every 2nd Friday - or whatever else they choose.

Am I possible to create a Single Charge at the time of the creation of their all their "subscription dates" and have it charged on that day?

Thanks for any advice, Chris

0 likes
1 reply
Chris1904's avatar

Would it work to theoretically create a table that stores all the future charges and then schedule a task that runs every minute to see if it is time to charge a user's model?

User::charge('500')

Does the following logic make any sense?

I think I am not fully grasping some of the concepts, because it appears to me that if I use the below and the Stripe customer exists, the card would never get updated even if they chose to pay with a different card?

private function singleCharge($when)
{
    try {
        $customer = $this->user->asStripeCustomer();

        if (! $customer) {
            $customer = $this->user->createAsStripeCustomer(request('stripeToken')['token']['id'], [
                'email' => request('stripeData')['email']
            ]);
        }
    } catch (\Exception $e) {
        return response()->json(['status' => $e->getMessage()], 422);
    }

    // create the charge in Stripe
    try {
        $this->user->charge($this->price['orderTotal'] * 100, [
            'description' => 'Single Charge - Order ID: '.$order->id.', Restaurant: '.$this->restaurant['name'],
            'metadata' => $metaData,
        ]);
    } catch (\Exception $e) {
        return response()->json(['status' => $e->getMessage()], 422);
    }
}

Any advice would be greatly appreciated!

Thanks!!

Please or to participate in this conversation.