#rdhelms_unexpected

1 messages ¡ Page 1 of 1 (latest)

proven mauveBOT
#

👋 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/1435983807844188263

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

slate oasis
#

Hi there, do you have an example checkout session ID? Something like cs_live_1234 or cs_test_1234

restive pendant
#

Sure, one second

#

Here's a checkout session that had a discount applied:

cs_live_a1N0vS9vPu2hg6Hol4oBL8XeiyYoCurtMuZZrBxaKXv8xCVmZUECqSbkMr

#

--
And here's the corresponding subscription that has an empty discounts array:

sub_1SQKMYAnKnsrCBD3GcScFnej

#

But the invoice for the subscription does have the discounts:

in_1SQKMWAnKnsrCBD3AacWoZtT

slate oasis
#

Where are you seeing the subscription object with the empty discounts array? As far as I can see, it's currently populated. Do you have a specific request ID where it's showing as empty?

restive pendant
#

Are you inspecting the checkout session or the actual subscription? I'm viewing subscription sub_1SQKMYAnKnsrCBD3GcScFnej in the workbench and it has an empty array

#

The checkout session and the invoice both have the discounts, but not the subscription

#

When I look at the events for that subscription, it looks like the customer.subscription.created event happened first (with no discounts applied) and then the discount was created and the checkout session completed

#

Here's the event ID for the customer.subscription.created event where the subscription was created with no discounts:
evt_1SQKMbAnKnsrCBD3eqZK3K9R

#

And here's the event ID for the checkout.session.completed event where the discounts exist in the checkout session:
evt_1SQKMbAnKnsrCBD3j7VALjHS

proven mauveBOT
oblique sigil
#

This is expected AFAIK because it's a one-time coupon that only applies to the initial invoice, so we don't persist it on the subscription

restive pendant
#

Hmm...interesting - is that behavior documented anywhere by chance? It definitely would have been helpful to know the connection between the type of coupon/discount and the places that we would be able to retrieve the discount from

oblique sigil
#

I don't believe it is explicitly documented, no