#emd
1 messages · Page 1 of 1 (latest)
Hello! So your goal is to have different metadata for each line item in a Checkout Session?
yes
I know I can pass meta via the subscription_data field
but I want diff meta for EACH subscription in the checkoutsession
Checkout line items do not have their own metadata, so that's not possible. Can you tell me why you want metadata on the line items?
Maybe I can recommend another approach.
sure, we have built a system that allows folks to sponsor orphans. And it allows them to choose some preferences (like country etc).
we want to add the ability to sponsor multiple orphans in one checkout session now, but allow them to have different preferences
How many different preferences are there?
we made it work before by attaching their preferences to the meta data of the subscription, so when the sub created event comes in, I can read that and assign the appropriate orphan
right now there are two preferences
Two preferences per line item, or two for the whole Checkout Session?
2 per line item. note though at the moment we only have one line item
Are you using a single Price for this, or multiple Prices?
ideally we'd actually like 2 subscriptions, each with one price (though that price would be the same)
one price
well we have two, one monthly and one annually, but that's no relevant here
Okay, what I recommend you do is add metadata to the Checkout Session itself which contains these details: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
It won't be directly associated with each line item, but it will be associated with the Checkout Session as a whole, and you can add a key/value pair for each line item.
I guess, I was trying not to respond to the checkoutsession created, I prefer to do the orphan stuff in sub created cuz then I have all the info I need
but I'll take a look at that, thanks
since I have you here, can I create TWO subs in a checkout session?
No, a Checkout Session can only create a single Subscription.