#mankeyx_best-practices

1 messages ¡ Page 1 of 1 (latest)

zinc zealotBOT
#

👋 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.

primal glen
#

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

feral sand
#

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

primal glen
#

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

feral sand
#

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)

primal glen
#

Yep, tried that, sorry should have mentioned. But it doesn't work because the products being purchased are recurring products, i.e. subscriptions

feral sand
#

got it. I'm still looking / asking colleagues but I suspect that customers need to be created when in subscription mode

primal glen
#

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!

feral sand
#

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

primal glen
#

Oh good point, let me have a quick look

primal glen
#

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

feral sand
primal glen
#

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?

feral sand
#

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