Stripe payment with laravel

392 Views Asked by At

I am creating a system with laravel 7 and I need both subscription service and one time payment. I am new to stripe. For one time payment I am using stripe charge method and it is working fine. For subscription I am using again charge method. But I have created a cron job which runs every day and check if one month or the selected day is passed cut fee from the customer account. The thing is I am confuse here what if due to any reason the payment is failed I need here to send the email to stripe admin whose account is working and the customer that the payment is failed. But in response of payment charged I cant get status of payment. How can I check it in cron job? On stripe documentation it is giving js code. I cant use javascript in cron i need this in php i.e (laravel).

I get this link but it is in javascript.

Stripe Link

1

There are 1 best solutions below

0
On

Rather than running automated jobs to create recurring payments, you should use Subscriptions, which are supported by Laravel and you can read about creating subscriptions here.

When future subscription invoice payments fail, you have several options for handling the recovery flow. Laravel has some additional documentation here.