#mankeyx_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/1399760592281010199
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mankeyx_best-practices, 4 hours ago, 7 messages
Hi there
I wanted to check the best practice for this use case. I have these 2 customers in test mode:
https://dashboard.stripe.com/test/customers/cus_Slm13iEuY4kr19
https://dashboard.stripe.com/test/customers/cus_Slm28ImREkWscv
Which are both the same user essentially (same email). I was test paying a subscription via a payment link and entered BACS account numbers to trigger a fail. So I noticed that when a payment fails, it still creates a customer record and I would ideally like to avoid this if possible and wondered what the best way to handle this was
I would ideally like to always create customers but only if the transaction was successful
hi there, I don't believe there is any built-in function for de-duplicating customers on payment link usage but I am double checking that
Thanks. Even if there isn't a facility or functionality to prevent this, it would be great if there was a way to get around this issue via best practices, whether you have the knowledge or anyone in your team, that'd be great info
you could try using this field when creating your payment link (set to if_required) https://docs.stripe.com/api/payment-link/object#payment_link_object-customer_creation
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
otherwise you may need to do some kind of back end job using the API to remove duplicate customers (though for obvious reasons I would test this thoroughly in test mode / sandbox first)
more info on that setting: https://support.stripe.com/questions/can-i-merge-multiple-customers-into-one
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Yep, tried that, sorry should have mentioned. But it doesn't work because the products being purchased are recurring products, i.e. subscriptions
got it. I'm still looking / asking colleagues but I suspect that customers need to be created when in subscription mode
Great thank you
I was hoping there was some way but it may be looking like the best way to handle this is some backend jobs to clear those customers out
But yes, do let me know if you find out anything else!
one other thing you could try would be to listen for customer.subscription.deleted events on your backend. the ones that were deleted due to never becoming active would have a status of incomplete_expired. you could then delete the customer associated with that subscription
Oh good point, let me have a quick look
Sorry, I can't seem to trigger a customer.subscription.deleted with the status of incomplete_expired. I'm assuming this is because of the settings? The status that keeps appearing is canceled. I do have the setting set to if all retries for a payment fail, it cancels the subscription
it's probably not triggering because subscriptions have a 23 hour expiration window https://docs.stripe.com/billing/subscriptions/overview#payment-window. which you might want to wait for in case the customer wants to try payment again. you could use test clocks with a created subscription to try out the flow without waiting that long
Ah great, thanks. That makes sense! So if I paid for a test subscription now via a payment link that is due to fail (by entering a test card number triggered to fail) then use the test clocks to advanced by 24 hours, it should trigger that event, is that right?
I'm not positive that test clocks work directly with payment links, but you should be able to test it with a test subscription with payment_behavior set to default_incomplete and then using the clock to move that subscription forward 24 hours