#Village_Admin-checkout-metadata

1 messages · Page 1 of 1 (latest)

olive wind
hallow crystal
#

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?

olive wind
#

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

hallow crystal
#

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?

olive wind
hallow crystal
#

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.

olive wind
#

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.

hallow crystal
#

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?

olive wind
#

Two customers/checkout sessions wouldn't have the same request ID

hallow crystal
#

Didn't think so, but just clarifying because it doesn't explicitly say "unique" in the docs. It just says all API request have an ID.

#

Thanks for the info.