phpstripe-paymentsrecurring-billing

stripe recurring payment using cron job or from stripe subscription recurring web hook?


I have a single course website where I want to provide installment facility for candidates, But Stripe provides subscription instead of installment, Now I am quite confused here,

1. How I'll get which N number of installment candidates paid or not?

2. Is It possible that I can recurring installment using CRON job(From my side)? If yes Then which details and reference I need? (Like stripe tokens, Customer Token, Card Tokens, etc)

3. If Stripe will handle this subscription then How I can get the candidate details?

Right Now I am following the bellow coding approach, I hope it can help you.

            $plan = \Stripe\Plan::create(array(
                "product" => [
                    "name" => "Test product"
                ],
                "nickname" => "Test Course",
                "interval" => "month",
                "interval_count" => 8,
                "currency" => "usd",
                "amount" => 120 * 100,
            ));


            $customer = \Stripe\Customer::create([
                'email' => auth()->user()->email,
                'source' => $request->reservation['stripe_token'],
            ]);


            $subscription = \Stripe\Subscription::create([
                'customer' => "cus_s1dfd2fd3f2",
                'items' => [['plan' => "plan_assd54s5d4s"]],
            ]);

Solution

  • I think everything You need(how to model installments with recurring subscription) is described here https://stripe.com/docs/recipes/installment-plan. And for the handling of incoming installments, you should base on stripe webhook events https://stripe.com/docs/billing/webhooks

    EDIT

    You can/should identify customer both on your system side nad stripe side by email, if this is not enough(and for example for storing subscription.id) you can: