Issue
I'm creating an online quiz for which the user can pay $5 to get the results. At the end of the assessment, if the user clicks the purchase button, it takes them to a stripe hosted checkout page, and then to a thank you page. The webhook is successfully set up. The problem is that when I try to access information from session (I'm using flask for the backend; session is essentially a cookie) it's a different instance of session than the user's instance. Since the user's answers are stored in the session, I need the webhook to tell the backend to analyze the answers of that specific session. Is that possible?
If anyone has a different solution I'd also love to hear it.
Solution
In your Stripe Checkout session you can add a value to client_reference_id
. This can be used to identify the customer or their quiz, etc.
See the Stripe documentation here: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-client_reference_id
This value forms part of the Stripe, Create a Session object.
When you get the Webhook payload back it'll tell you what the client_reference_id the webhook relates to so you can query your internal system
Answered By - ajtrichards
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.