#PSN-dupe-subs
1 messages · Page 1 of 1 (latest)
Hey, can you share an example object ID? Make the cus_xx you're seeing duplicates for
Checking!
ok
Ok so I can see 2 canceled subscriptions and 1 active subscriptions which were all created around the same time. Nothing really seems out of the ordinary here:
- Active: https://dashboard.stripe.com/subscriptions/sub_1LTAlGL69mue3ryLTEwlrHcy. Created here: https://dashboard.stripe.com/logs/req_xQ6SK7aVPSuZjd
- Canceled: https://dashboard.stripe.com/subscriptions/sub_1LTAl8L69mue3ryL0FGGf5Um & https://dashboard.stripe.com/subscriptions/sub_1LTAlCL69mue3ryLOj3ar1UQ. Created here: https://dashboard.stripe.com/logs/req_BYznnAihMr5jEp & https://dashboard.stripe.com/logs/req_Bu4igq9DzZsOyZ
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Looks like your integration is firing those unique requests. You should work to figure out why!
We manually refunded the other 2
I'm actually checking if active subs exists using this
subscription = payments.get_stripe_subscription(request.user)
before creating the new one
Yeah, but you asked why there's 'duplicate' subscriptions being created. The reality is they aren't duplicate, they're unique
I suspect this isn't working as you expect then
oh
subscription = payments.get_stripe_subscription(request.user) if subscription["data"] != []: if subscription["data"][0]["status"] == "active": return Response({'status': False, 'message':"A Subscription already active"})
This is the complete checking part
@wet wraith
subscription["data"][0]["status"] == "active" is a bit naive, and potentially a race condition
How does your UI facilitate creating the subscriptions? Do you disable the button once pressed? Seems its being triggered multiple times in quick succession
Yes, I'm disabling the button
That is the best way, really. You need to figure out why your integration is firing multiple consecutive API requests to do the same single action