Headless Storefront Subscriptions API - How do I correlate a cart checkout with a subscription?

Hi Folks,

May someone please let me know how to correlate a cart checkout session with a subscription contract? More specifically, when I redirect clients to the checkout URL from the cart create mutation and they complete the purchase, how do I correlate the webhook event subscription contracts create webhook event with that checkout session? I am looking to pass some context around and have not found a way to link the two steps. Please let me know.

Thanks,

Hey @jmr1 , the subscription_contracts/create webhook does not have any information directly related to a checkout session, but from the contract, you could inspect the order that has been generated. Does that help you retrieve the information you are seeking ?

Hey Poulping, I am not sure, is there a way for me to correlate an order with a cart? Thanks.

your best bet might be to add some attribute to the cart. That will make it on to the order as well as to the sub’s custom attributes

I think I found a solution that meets my needs. The cart create mutation checkout url path ends with the cart token. I am using that cart token as a filter when querying for an order.