#masseelch_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/1296018958251458672
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Makes sense. Not sure why I did not think about this myself ๐คฆโโ๏ธ Thanks!
Is this thread still active?
Yes
I am not able to retrieve from the API if a subscription / checkout session was created withj a coupon or not.
Tried to exapnd both checkout-sessions and subscriptions endpoints with discount
req_jj62rxoiEwA5Bk
req_ZLAXpWoS65YChb
req_zc7xlqR5xYCEKF
Those are a few requests I tried
I can see in the dashboard the coupon was applied, but I am not able to retrieve for a checout session or subscription the applied coupons
What results are you getting here? Sorry, we don't store successful responses of GET requests internally.
You can actually see the discount amount on the Checkout Session itself: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-total_details-amount_discount
There's 2 properties on the Subscription object. It seems like you're expanding discounts but checking discount
This is the object inside the SDK, there is not discounts, also I did expand discount as well.
Sadly this does not help since I want to know the exact code used.
What library version are you using?
I tried with github.com/stripe/stripe-go/v76 and update to the latest (github.com/stripe/stripe-go/v80) but no success with both.
Which are "2023-10-16" and "2024-09-30.acacia" respectively
Could you please share the full response in JSON?
I stripped some sensitive info from it
req_F1ZnF4D8ocqmpa
Related request id to the above response
Have you tried fetching the Subscription itself and expanding discounts?
๐ taking over for my colleague. Let me catch up.
req_JgeyRHaML9Q9xW
This request for example
you're expanding the deprecated property discount
you need to expand discounts instead
req_vUJVfrUxGg0oaU
Tried that as well as you can see in this request
go sdk v76: req_xVeh5CyP7bpP5w
go sdk v80: req_0kJPgdohRlypkt
Both expand discounts
Both fields are empty in the response
since the coupon applied is applicable once, you won't find the discount applied on the subscription but rather on its first invoice
so if you expand on https://docs.stripe.com/api/invoices/object#invoice_object-discounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
of the subscription.latest_invoice
it should work
so you could expand on subscription.latest_invoice.discounts when retrieving the Checkout Session
Let me check
Nice, works. Will the first invoice always have the coupon? Even it is a coupon than is applied 2 months or forever?
yes
Thank you very much!