#alexv_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1304072358226563184
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
hi soma!
that's normal. if you set metadata, then the metadata is set on the Checkout Session object itself. not the payment or the subscription.
so your goal is to add the metadata on the subscription object?
ooh! ok! sorry for my lack of knowledge
or on the individual payments of the subscription?
I don't know where to set it, basically I want customers from our app to go and pay on stripe. I want to be able to track them and see if they made this purchase. So I'm not 100% sure on which action should I attach the metadata on.
I am not 100% sure if the client will use subscriptions or one time payments, I'm trying to learn and be ready for both cases.
where in the dashboard are you looking for the metadata? on the Subscription, Invoice, Payment, Customer, etc.?
I am not 100% sure if the client will use subscriptions or one time payments, I'm trying to learn and be ready for both cases.
then you probabbly want the metadata on the PaymentIntent object itself
I'm currently checking under Transactions
You are correct! under subscriptions I do see the metadata used in "payment_intent_data.metadata" ๐ !
once you have the metadata on the Subscription object, it will be automatically added to the Invoice. but not on the payment itself. so you will need to write some code to copy the metadata from the invoice to the payment. or direcyt check the invoice to see the metadata.
thank you so much soma!
happy to help ๐
and if you want to learn more about metadata: https://docs.stripe.com/metadata
thank you! can I run one more idea by you? if you have time?
absolutely!
so in my case, where I want to track customers that buy subscriptions, would it be better if I set the metadata directly on the customer in order to be able to map them to my backend? and then for the payment status, I would get those updates through webhooks (where I update my local data if their subscriptions are active, canceled or not paid)?
I think in general you'd set metadata at the Subscription level; it will get saved to subscription_details in each invoice object https://docs.stripe.com/api/invoices/object?lang=php#invoice_object-subscription_details-metadata , and you can reference that when handling webhooks related to recurring payment success/failure.
https://docs.stripe.com/billing/subscriptions/event-destinations#active-subscriptions
alright, that sounds great, I'll research and test on my end, thank you very much!
One last question: we use Auth0 to authenticate our users, I saw Auth0 has an integration with Stripe but what I'd need ideally is: when a user is redirected to Stripe from our app (where he is logged in), would we be able to get his Auth0 id (any id from their token) so we can map the users that way?
I'm not really familiar with any integration Auth0 might have but in general yes you will have "something" somewhere that maps a user in your system to their Stripe Customer ID cus_xxx