#esset

1 messages ยท Page 1 of 1 (latest)

pale carbonBOT
pulsar gazelle
#

client_reference_id won't automatically be added to the subscription's metadata but you can add it yourself. You can listen for checkout.session.completed events, the Checkout Session in those events will have a client_reference_id property that you can reference and should have the ID of the subscription that was created. You can then update the subscription and add the client reference ID to its metadata.

Then when invoices get paid, the invoice will have line items. The line items for the subscription will have the subscription's metadata which will include that reference ID if you set it on the subscription itself.
https://stripe.com/docs/api/invoices/object#invoice_object-lines-object
https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-metadata

pale carbonBOT
grizzled lintel
#

Hm, OK, thanks. Sounds like a handful ๐Ÿ™‚ There's no other recommended/easier way to link subscriptions to specific users?

pulsar gazelle
#

Not that I am aware of for payment links unfortunately. If you are open to our low-code Checkout Sessions, you can pass the metadata in to the session's subscription_data.metadata when creating the session which simplifies the first part quite a bit

grizzled lintel
#

Yes, that's def an option. Could you point me to an example? And, is that similar to Payment Links in terms of ability to configure free trials, promo codes etc?

tribal skiff
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

It's almost identical to Payment Links in terms of what the customer sees. The configuration happens via the API, which means there are more customization options (e.g. setting metadata on the subscription when the Checkout Session is created) so that's the biggest difference. Here are the docs on Checkout to get started: https://stripe.com/docs/payments/checkout

Use a low-code integration to build a customized payment page, hosted on Stripe.

grizzled lintel
#

ok, cool. and, just to confirm: setting client_reference_id as subscription metadata will have it propagated to all subscription events?

tribal skiff
#

No, setting subscription_data.metadata will make sure that it gets populated to the Subscription. You wouldn't need to use client_reference_id in this case, unless you wanted to for some other reason

grizzled lintel
#

ok, got it! thanks

#

take care