I am using Stripe (test mode) to develop the payment module in my application. I have done the following,
Subscribing a customer to an existing plan created in stripe using Customer.create(customerParams). Which I understand that it will create a customer, subscribe to the plan, creates the invoice, charges the invoice.
I have added a webhook for invoice.payment_succeeded (paymentSuccess) and invoice.payment_failure (paymentFailure) only. Created a webhook in my application.
I get the following,
My paymentSuccess webhook is called successfully after the Customer.create(customerParams) is called, using which I can retrieve event, invoice, charge and customer details to process it in my application. The paid flag is set to true.
This webhook is called more than once (even more than 3 times) in a specific interval (around 30 mins or so), with different invoice id, customer id, charge id.
My questions:
Any help would be greatly appreciated. Thanks in advance.
If the customer ID, invoice ID and charge ID are different, then it's not the same event.
You probably have multiple customers with subscriptions set up on your account.
Stripe will send an invoice.payment_succeeded event each time payment succeeds for any invoice.
If you have multiple customers with subscriptions, Stripe will automatically create an invoice for each of them at the start of each billing periods, and attempt payment for these invoices approximately one hour after creation.
You can look up the attempt_count attribute on any invoice object to know whether this is the first payment attempt or not for a given invoice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With