#Hank I. Panky - Checkout
1 messages · Page 1 of 1 (latest)
Hi there!
You could add metadata that contains your customer ID in your subscription when creating the Checkout Session with https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata
Hence my question about the order of event processing...
Stripe does not guarantee delivery of events in the order in which they are generated. You can learn more about this here: https://stripe.com/docs/webhooks/best-practices#event-ordering
Adding metadata when creating the Checkout Session returns that metadata only in event checkout.session.completed. This behaves the same way as the client_reference_id. That does not help me connecting other events, like customer.subscription.created from the same Checkout session to my customer ID.
Hey, taking over here. What underlying problem are you actually trying to solve?
2sec, I think I was too quick dismissing @light shard 's suggestion...
Underlying problem: when a new customer purchases a subscription in the checkout portal, I need to connect the subscription to my customer ID. The customer.subscription.* events don't contain the client_reference_id set when creating the Checkout session.
I can see now how the suggestion from @light shard works. My mistake of not setting the metadata at the correct field. (I had set it on the SessionCreateParams, not the SessionCreateParams.SubscriptionData.)
Cool! All solved then?
And yes, client_reference_id is not carried to any other objects other than the Checkout Session
Yes, thank you for the quick and helpful response. Following this approach, I no longer need to process checkout.session.completed at all. The customer.subscription.* events are self-sufficient. 👍
Perfect!