#hpanseriya_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1290257979848917015
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, let me help you with this.
we do not want to create a stripe customer if payment failures from subscription. How can we achieve that?
A Customer is needed to create a Subscription, but you can't know if the payment succeeds before then. Why you don't want to create a Customer?
Here is the flow which we are following:
- Create a Customer in Stripe
- Create a Stripe Subscription
- Payment will be deducted once subscription create but that time payment failures, In that case we do not want to show customer in stripe. what to do in this case?
You can delete the Customer if the payment fails: https://docs.stripe.com/api/customers/delete
Is it a best practice?
Normally you don't need to delete Customers, but just leave them. Perhaps the customer will want to use a different Payment Method in the future and you will reuse the Customer object for them.
We want to implement it via webhook then how can we know that payment failed for the customer
You can listen to invoice.payment_failed webhook event: https://docs.stripe.com/api/events/types#event_types-invoice.payment_failed
But if they choose to try a different Payment Method, will you re-create the Customer object?
Yes, we will recreate customer
For this webhook: invoice.payment_failed
How can we know that we have to delete the customer if subscription payment fails
we have to delete the customer
You don't have to delete the Customer