#Jesserson
1 messages · Page 1 of 1 (latest)
Can you share the request ID (req_xxx) where you set the metadata on the Checkout Session? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
the request id is req_I1c0ibifQp0XHt
i see the metadata is being nested within the subscription_data field, though i am setting the field as follows:
customerRef,
"checkout_sessions"
);
const docRef = await addDoc(customerCheckoutSessionsRef, {
mode: mode,
line_items: lineItems,
success_url: successUrl,
cancel_url: cancelUrl,
metadata: {
fulfilled: false,
},
});```
Thanks for sharing. From req_I1c0ibifQp0XHt, the metadata is set on subscription_data.metadata. This means that metadata will only be available on Subscription object, not Checkout Session object.
To set the metadata on Checkout Session, you may also set metadata on metadata field directly: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
so this would require a post to the checkout session after the document is created? is there no way to set the metadata when creating the document?
also, is there another standard way to track fulfillment status, or delivery status of orders, that i natively supported by stripe, instead of setting a custom metadata field?
thanks again for your help!
metadata field on Checkout Session can only be set during Checkout Session creation request. It can't be updated afterwards.
I'm not too sure what "document" are you referring to here?
If you're referring "document" as Checkout Session, then metadata should be set when you make the request to create it
i'm referring to the firestore document that is created in the checkout_sessions collection, i am using the firebase stripe integration
also, is there another standard way to track fulfillment status, or delivery status of orders, that i natively supported by stripe, instead of setting a custom metadata field?
This should be kept track within your system, not Stripe
I'm not too sure how firebase integration works, but it should be possible to set metadata in the Checkout Session that I mentioned
im confused why the field is being nested under the subscription_data field, when i am not specifying that in the request
As per my checking on firebase extension, this seems to be intended: https://github.com/stripe/stripe-firebase-extensions/blob/master/firestore-stripe-payments/functions/src/index.ts#L204-L208
If you're using firebase extension, I'm afraid it's not possible to set metadata on the Checkout Session directly.
One way I can think of is to use Checkout Session Retrieval API and expand subscription field, so that you will be able to get the metadata on the subscription object: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
Expanding a field: https://stripe.com/docs/api/subscriptions/object
ok great, thanks for the recommendation!