#kael_api

1 messages ¡ Page 1 of 1 (latest)

trail epochBOT
#

👋 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/1220536591592849458

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

hidden frigateBOT
rare frigate
#

I can simply not returning them back to stripe checkout when it's unpaid. But I am not sure how they can come to success_reutrn_url ?

Could there be a deplay?

FYI, process is

[my site: create account] > create account and order details and save checkout session id > stripe checkout > success retrun to [my site], here we check if it's paid and grant digital products > [my site: order confirmation page]

I can simply not check the paid status if stripe can confirm that only successfully paid users will return will return to this page, but I set up this in case someone (or bots) hitting this page randomly.

wise radish
#

Which URL when it comes to your success page?

#

As you said there could be bot or someone just accidentally (or purposely) accessing your success page, and checking the status is correct AFAICS

rare frigate
#

I don't want to share that url publicly ?

wise radish
#

Or you can move the order fulfillment completely over when you receive checkout.session.completed, so you can avoid even other cases when your customer actually paid but lost internet access and never went to your success url

#

Sure up to you to not share

rare frigate
#

This is what I do on the scucess url

# validate the payment
    stripe_checkout_session_id = order.transaction_logs.filter(payment_method=order.payment_method).last().transaction_id
    stripe_response, paid = validate_checkout_session_payment(stripe_checkout_session_id)
    source_transaction_id = stripe_response.payment_intent if stripe_response.payment_intent else stripe_response.subscription

    if not paid:
        # this is sending people back to checkout and probably people repaying from there hence double charge is happening
        if stripe_response.url:
            return_url = stripe_response.url
        else:
            return_url = stripe_response.cancel_url
        order.update_source_transaction_id(source_transaction_id=source_transaction_id)
#

time to time payment status is unpaid

#

And I set up a notification to receive when unpaid hits the page

cs_live_b1ejCwhgHcMGM58omRtkr0IFe36ZgpHzD81B6XigHA75sMukiEgBpc4zdA this checkout session visited the success page and response data shows it's unpaid at the time

#

Checking this user indeed paid and actually paid twice. (subscribed twice)

wise radish
#

pi_3OwtnxJr3N20QNXk1WBOSEni this is unpaid

#

How do you know the user paid twice?

rare frigate
#

hmm

#

give me a sec

#

I save checkout session details under order as TransactionLog so I can reuse the session if it's not expired instead of creating a new one ...

Maybe there is a glitch...

#

Do you think this is unneccesary (keeping the existing checkout session and re-use instead of creating a new one on every attempt)

#

I can spot where the issue came from thanks for your help. Didn't realised pi_ was not for the double charged subscription.

wise radish
#

Np!

rare frigate
#

This user tried many time purchasing our product and from my end, the Order was connected to different checkout session that the user previously tried and not finished when she actually purchased and returned to the success url.

Thanks for your help I will have a look deeper my end.

Just last question though.
I am logging all checkout session with my orders, and when someone tries to re-purchase and if the CheckoutSession is not expiried, I re-used the same session.

Thought its a nice move not to send too many requests to Stripe, but might not neccessary?

wise radish
#

Might not necessary but yes do feel nicer to have. But you would want to pay attention into the expiration time