#rose-sun_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/1308087474253336679
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there 👋 taking a look
The Stripe account related to the requests you shared doesn't appear to be a Connected Account as far as I can spot. Did you complete onboarding to our Treasury product?
Goot to know that. I have no clue how to complete onboarding to Stripe Trsasury product ?
Did you go through the steps in the document that is linked to from the error message you shared?
https://stripe.com/docs/treasury/access
Yes, I saw the document and follow the instruction on that document and we *UNH" account has test mode, live more, sandbox mode all that and the dashboard is fine to me but I still have no clue where the issue about.... we can create payment link, products, price and see transactions all fine but when I try to do postman API to retrieve transactions then end as the error saying "no access to trasury" ?
Wait, what transactions are you trying to retrieve? It sounds like you're not using our Treasury product and don't need to retrieve transactions related to it.
I am trying to retreieve all the "transactions" that people made by the payment links...
Ah, yeah, those aren't the same as Transaction objects in our API.
You're probably looking to list Payment Intents instead:
https://docs.stripe.com/api/payment_intents/list
Let me know if those don't hold what you're looking for though.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I am using API "{{base_url}}/payment_links/plink_1Q80qrFku8dbQAshCBeny0TC/line_items" to list all transactions for that specific payment link.
But I realized that the price is incorrect on the response JSON as the above becuase user change their price in the fly but the response JSON still show the "initial define" of the price
I don't understand what you mean. The URL you shared isn't for listing transactions in any way, it's for listing the Line Items included in the Payment Link you created.
Payment Links aren't for single payments. They are objects that are used to spawn Checkout Sessions everytime your customer clicks on the link you provide, you would need to retrieve the Checkout Sessions to see specific transactions. Or maybe their underlying Payment Intent, it's a little hard to know what to recommend without having a good understanding of what you're looking for.
https://docs.stripe.com/api/checkout/sessions/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
My final goal is finding the metadata that user defined for each transactions ...
For instance, user define the metadata on product level. then create payment link for that product then people use that payment linke to pay whatever.
So what is the BEST API that I can use to get the information in between product metadata and each of the transactions ?
So far I found out that "payment_links/plink_xxxxx/line_items seems has the prod_xxxx id for each of the line but that is not for each actually transactions ...
Who is the "user" in this scenario? I just want to make sure it isn't the customer, as they likely can't define metadata on the Product objects.
Listing Checkout Sessions is likely the best fit based on what I think you're describing. There you can confirm the Products used in those Line Items.
I can define metadata on payment link level or product level in the test mode or sandbox and when I list all product by API I do see those metadata I defined but when I list all payment link I don't see any of the metadata I defined.
If you define metadata on the Product object, it's not expected for that metadata to be shown on Payment Link objects as well.
metadata typically isn't copied from one object to another, with some exceptions, unless you copy it
https://docs.stripe.com/metadata#copy-metadata
That is what I think so I don't expected the product metadata been copied over to payment link metadata.
So I want to use API to get the transactions first, then in the transaction response JSON I can get the product ID then use that product ID to get the metadata data.
So you'll want to list Checkout Sessions then. You can include the Payment Link ID in the payment_link filter field to only retrieve Checkout Sessions associated with that particular Payment Link if that helps:
https://docs.stripe.com/api/checkout/sessions/list#list_checkout_sessions-payment_link
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
May you please tell me where in the "dashboard" I can get the checkout session id ? or which API I can use to get all those checkout session ID ?
You can use the endpoint I've been linking you to our API ref for. The link I shared above will take you to that endpoint in our API ref.
okay, I did find the checkout seesion by following the instruction and use API {{base_url}}/checkout/sessions/cs_test_a1hLZ5eDSDyYybG6AHMIGVkGnMgcdBZffdo2bN7FmrTF31uWYpUMRwc8QK to retrieve all the information for that specific checkout session...
and the JSON response show metadata is NULL
There is on our sandbox and there is only one transctions and 3 payment links and each of the payment links has linked to their assosciated products and each of products has metadata define. But the "checkout session API" show NULL metadata still so where and how I can see those metadata that I defined for each or the transactions ?
That is expected. You said you put the metadata on the Product object, so it won't be present on the Checkout Session object.
From the Checkout Session you will need to get to the Product that is included in the Checkout Session's line items.
You can use this endpoint to retrieve those Line Items, similarly to how you were already doing for the Payment Link:
https://docs.stripe.com/api/checkout/sessions/line_items
You can use epxand to expand data.price.product so you get the full Product object inline in that response, and check its metadata without having to make another request:
https://docs.stripe.com/api/expanding_objects
oh okay, I will try that of course....
However, .. if I defined the metadata on the payment link level now and make another transactions, will the checkout session API will show the metadata for me ?
Yes, that is one of the exceptions where metadata is copied.
From the guide on metadata that I sent before:
Payment Link to Checkout Session
When a Payment Link creates a Checkout Session, the metadata copies to the Checkout Session in a one-time snapshot. Updates to the Payment Link’s metadata won’t apply to the Checkout Session.
https://docs.stripe.com/metadata#exceptions
I see now...
The bottom line is that you have to use API /checkout/sessions/ to list all checkout session and get their plink ID then do another API call and given that plink ID to get the metadata.
The dashboard "export" button on payment link or on transaction did not show it directly but indirectly by checkout_session id only so we need to write python scripts to retreivee all the "detail" somewhere so users can run a report that meaningful to them.
Thank you very much for your help and it is very appreciated 👍
Happy to help, but the approach you described is going back to getting data off of the Payment Link, which I'm not sure is what you want. I suggest testing that to be sure though.