Skip to content
Advertisement

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 = StripePlan::create(array(
                "product" => [
                    "name" => "Test product"
                ],
                "nickname" => "Test Course",
                "interval" => "month",
                "interval_count" => 8,
                "currency" => "usd",
                "amount" => 120 * 100,
            ));


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


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

Advertisement

Answer

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:

  • Save stripe customer.id or subscription.id in your database
  • Or(recommended by me) use metadata stripe feature and send your side customer.id or subscription.id when creating customer/subscription in stripe – https://stripe.com/docs/api/metadata
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement