#Village_Admin-checkout-metadata
1 messages · Page 1 of 1 (latest)
To give a bigger picture of my goals. I do not create an account on my end until after a successful payment. After getting the invoice.paid hook i want to create the account on my end. Before i send the customer to the payment pages i collect their username/password. Im trying to find a way to match that username/password i collected with the invoice.paid hook.
I want to send a "token" with the checkout session, so the invoice.paid can give me back that token which i use to lookup the username/password to create.
Best options?
There isn't really anything built-in you can leverage on our end to set a "one-time use variable". Your best option would be to store this information on your own databases, or to continue setting the metadata on the Checkout Session and re-retrieve the Checkout session when you get the invoice.paid webhook
What in the invoice.paid can be used to link to the checkout session to get the checkout metadata?
In invoice.paid i see data => object => custom_fields. What is that from? Something i can populate when creating a checkout session?
Using the subscription tied to the invoice, you can pass that in when you list Checkout Sessions (https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-subscription)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Custom fields are specifically so you can include more information in the invoice pdf (see https://stripe.com/docs/invoicing/customize#custom-fields), I don't think it's what you want given your use case
Can i get more info on request.id? Is that unique to a transaction? Or just to an API call? Can it be relied upon for linking different hooks as belonging to the same paid invoice?
The docs are unclear to me, it just says each "API request" has an ID. To me invoice.paid and checkout.session.completed are different API request yet they both have the same ID.
A request ID is unique to a specific API call - the invoice.paid and checkout.session.completed webhook events have the same request ID because they were created as part of the same API request that finished the checkout session.
Oh, not hook API, my API creating the checkout session.
So any chance two customers or two checkout sessions would share the same ID? Is it safe to expect them to be unique?
Two customers/checkout sessions wouldn't have the same request ID