#andygee

1 messages · Page 1 of 1 (latest)

molten apexBOT
winged dragon
#

Hi there, I don't think your customer can set a metadat and client_reference_id through customer billing portal.

olive jungle
#

Hi Jack, the metadata is attached to the product and the client_reference_id is set in the url of the payment link, and i need this information back whenever a customers subscription is updated. Is this possible?

#

In the webhook

winged dragon
#

You need to listen to checkout.session.completed event. in the event hanlding, you can get the client_reference_id directly from the session object (https://stripe.com/docs/api/checkout/sessions/object?lang=node#checkout_session_object-client_reference_id). But you need to expand the line_items (https://stripe.com/docs/api/checkout/sessions/object?lang=node#checkout_session_object-line_items) to retrieve the prices, and the associated products

olive jungle
#

Thanks, this information does not seem to be available in the "customer.subscription.updated" though when a user has updated their subscription.

winged dragon
#

What information? do you have the event ID?

olive jungle
#

The details i need back are the metadata i added to the product and the client_reference_id that i added to the url of the payment link

winged dragon
olive jungle
#

cool, i can see that the metadata would be returned but how about retrieving the client_reference_id?

#

Thanks for your help btw

winged dragon
olive jungle
#

that works in the "checkout.session.completed" webhook event but not the "customer.subscription.updated" when the user has updated their subscription.

#

The "client_reference_id" is not returned in the "customer.subscription.updated" webhook

winged dragon
#

the client_reference_id is set on the checkout session object, and you can't retrieve it from a different subscriptoin object.

olive jungle
#

Right ok, so the client_reference_id is not the way to store a user ID when using a payment link to purchase a subscription? Is there a payment link param i can use to send the user ID from my site over to stripe and then retrieve it in any webhook?

grand burrow
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

olive jungle
#

Hi vanya, right ok, thanks, I had a feeling I might be stretching the limits of what a payment link has been built for. Thanks

grand burrow
#

Yes, as soon as it gets to automatically generating the link, it's better to switch to Checkout.
Happy to help!