#apolloengineer_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/1329216984512200735
π Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, taking a look here
Hi, can you explain more here? Are you saying that when passing "payment_behavior: 'default_incomplete'" it shows '$120.00 off' and otherwise you see '$240 off'?
I think it's related to passing a proration_date on the first request. Can you look there?
If I create a new subscription, update to a $120 coupon, then update it to a $240, then do a preview at $360, I get the right proration behavior.
If I create a new subscription, etc... but I set payment_behavior: 'default_incomplete', and then pay off that invoice, then the coupon says $120 instead of $240.
let me look, it will take me a few minutes to set this up.
Sure, take your time
should i not send a proration date?
You can but that changes the amount that is prorated.
I was passing in the proration date prior when it was working
something i did change is i set the default behavior on the subscription to proration_behavior: 'none'
but that would be weird for that to effect the proration on which coupon
Can you share an example where you passed the proration date and it was working as you described?
yeah just a moment
I'm trying to find a request to /upcoming on this customer and I'm having trouble finding it, but it worked. cus_RarQgq6mqAkB37
I also noticed that the coupon code on the above requests were different. taking a look at that customer id now
Ah, they offer the same amount for the discount
I have a test run that recreates all the objects
Can you see the upcoming requests?
It would be helpful if you could share the same request that worked as you expected so I can compare the two. Can you make new requests and pass the exact same params?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
is there a way to get it from the response
hi! taking over as pgskc has to run
catching up on the issue now, i may have a couple of clarifying questions
ok
My problem currently is that I want to show you the invoice upcoming request, but I can't find it on the customers logs.
I do have 2 previous requests I was able to find though
any chance you can make another request now? i can just see if i can find it in your account's API logs
ok no problem it will be test mode
ok I'm running the test suite where it works first
it just completed
yep, seeing the logs showing up now
I'm still not seeing logged calls to preview
yeah i'm not seeing any calls to the preview endpoint on my side either
are you sure you're calling it?
I have the responses
π€
ok this was working just last week 1 second
bad request: req_ISR1VhO1bHE315
good request: req_ImDyUpKSaQNDep
I also have the request url in the response
/v1/invoices/upcoming/lines?subscription_billing_cycle_anchor=unchanged&subscription=sub_0Qhg4p5QM0nABsUHAzZAIY9e&subscription_proration_date=1736984011&subscription_items%5B0%5D%5Bquantity%5D=3&subscription_items%5B0%5D%5Bplan%5D=professional_ec_y_yearly_1&subscription_items%5B0%5D%5Bmetadata%5D%5Bcategory%5D=seat&subscription_items%5B1%5D%5Bid%5D=si_RaroDAT0qIoVvB&subscription_items%5B1%5D%5Bdeleted%5D=true&coupon=2vHwIXb6&subscription_proration_behavior=create_prorations
responds with Unused time on 2 Γ Professional Seat (with $240.00 off) after 15 Jan 2025
and heres the one where its wrong
/v1/invoices/upcoming/lines?subscription_billing_cycle_anchor=unchanged&subscription=sub_0QhgBd5QM0nABsUHgeFZwHjL&subscription_proration_date=1736984404&subscription_items%5B0%5D%5Bquantity%5D=2&subscription_items%5B0%5D%5Bplan%5D=professional_ec_y_yearly_1&subscription_items%5B0%5D%5Bmetadata%5D%5Bcategory%5D=seat&subscription_items%5B1%5D%5Bid%5D=si_RarvC8OTvU8liT&subscription_items%5B1%5D%5Bdeleted%5D=true&coupon=hMPjnRbn&subscription_proration_behavior=create_prorations
"Unused time on 2 Γ Professional Seat (with $120.00 off) after 15 Jan 2025"
ok, let me see if i can find the request IDs in question...
it looks like you're using the /v1/invoices/upcoming API which is different than the /v1/invoices/create_preview API, which could be why i wasn't finding them earlier
We have an older stripe gem
ok i think i maybe found the request:
https://dashboard.stripe.com/test/logs/req_NrAdOyOx5TkDcl
can you just confirm that for me real quick?
and then if you can generate another one that isn't working we can have a recent example on the same API to compare it with
looking now, 1 sec
there are a lot of duplicate requests so it's taking me a bit
ok i think i found one
https://dashboard.stripe.com/test/logs/req_ETH1tbkqf6Dq5F
correct
ok this is for a request that is working I'll now help you find a failing request and we can compare
π
if you're still having trouble finding them on your side then giving me a timestamp of when you see the weird behavior will help me find the failing request much faster
cus_RasECUN23Q9Mne sub_0QhgUL5QM0nABsUHRcbSkajY 2025-01-15 15:59:24.78483 -0800
ok, does this look right?
https://dashboard.stripe.com/test/logs/req_oGEkDHRW9dpwxT
needs to be for quantity 3
it should match these parameters /v1/invoices/upcoming/lines?subscription_billing_cycle_anchor=unchanged&subscription=sub_0QhgUL5QM0nABsUHRcbSkajY&subscription_proration_date=1736985583&subscription_items%5B0%5D%5Bquantity%5D=3&subscription_items%5B0%5D%5Bplan%5D=professional_ec_y_yearly_1&subscription_items%5B0%5D%5Bmetadata%5D%5Bcategory%5D=seat&subscription_items%5B1%5D%5Bid%5D=si_RasF7pq7LqoRAQ&subscription_items%5B1%5D%5Bdeleted%5D=true&coupon=yfIIS6uC&subscription_proration_behavior=create_prorations
hmm yeah i'm having trouble finding it... still looking
that one has quantity 3
does that look right?
you got it
ok cool, let's compare
thats the one that returns incorrectly that it currently has a $120 coupon instead of a $240 coupon.
thanks so much for your help!
on the links you sent, can we also see the response?
it's been a bit since i've looked at this from the dashboard, but i can't see the response on my end so i wouldn't be surprised if you can't see it either unfortunately
saving all GET responses would get expensive quickly
I can give you responses from my side if that helps
ok, so for https://dashboard.stripe.com/test/logs/req_ETH1tbkqf6Dq5F (working as expected)
coupon: "zGloG8aW"
subscription_proration_date: "1736984005"
and for https://dashboard.stripe.com/test/logs/req_gBZFZZh6c22e9c (not working as expected)
coupon: "yfIIS6uC"
subscription_proration_date: "1736985583"
those appear to be the only differences. so different code, different quantity, and then date (which it looks like you're just setting to the current timestamp)
you grabbed the wrong one for the working one
oops good catch
req_ETH1tbkqf6Dq5F
updated
so it does look like they're using different coupon codes and subscription_proration_date timestamps but otherwise identical
ok the problem is that the proration is picking up the wrong coupon currently on the subscription.
can you help me with that?
looking up details of the coupons now, which is a little difficult from my end since this is just an upcoming invoice...
any chance you have the request IDs where you created those?
the coupons?
yep!
req_tDS3fsZhZxov7k
req_LJ0k62BRLbWsBZ
these coupons are the ones used to preview with.
hmm, yep, everything looks pretty much identical.
is there any chance you still have the response bodies and can share those too? i know you offered earlier
i think you should have permissions to send it as a file to keep the chat cleaner
ok i'll send a file for the one that doesn't work
the one that does work I have to regenerate
ok good one will have different subscription, coupons, etc..
the difference between that first line on proration is what matters its $120 different.
ok yep, i see that
thanks for providing so much info so far and for your patience π
looking into the discrepancy now
Hi @wary lantern This is Jack and I'm also an engineer from Stripe. I'll take over your thread.
The $120.00 off that you see from the proration line item "Unused time on 2 Γ Professional Seat (with $120.00 off) after 04 Jan 2025" is coming from the discount that was already applied to the previous invoice (i.e., in_0QdL9N5QM0nABsUHW8ycuP93) that the subscription created before.
but shouldn't it pull from the current subscription https://dashboard.stripe.com/test/subscriptions/sub_0QhgUL5QM0nABsUHRcbSkajY
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
No, discoounts won't be applied to credit proration line items.
if you check the line item's discountable , it's false
ok can you tell me why it works on the file marked good-one.json?
can you confirm you are looking into the good one?
Yes I'm checking on it. Please give me some time.
thank you
So this is the previous invoice in_0QdObF5QM0nABsUHm5whDXEU and it has a discount of $120. I don't think it's correct to show $240 discount on the proration line item.
Can I suggest you to reach out to Stripe support and share them the reqeust ID? we'll escalate it to the relevant team and investigate further.
Hello @wary lantern, we have sent you a direct message, please check it at https://discord.com/channels/@me/1329261710036697119
- πThe message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
stripe support just leaves me hanging for weeks and nothing happens π¦
Is there anyway you think I can work around this?
Can you perform a subscriptoin update with the same params that you set on the preview, and share with me the ID of the resulting invoice?
The good one (i.e., the one that shows $240 discount on the proration line item)
in_0QhhAf5QM0nABsUHHhcKDvWP
amount_off: 36000,
currency: 'usd',
duration: 'forever',
name: 'test coupon',
metadata: { category: 'seat_discount' }
})
Stripe::Subscription.update(
'sub_0QhhAe5QM0nABsUHRnWFSk6i',
{
coupon: coupon.id,
items: [
{
quantity: 3,
plan: 'professional_ec_y_yearly_1',
metadata: { category: 'seat' }
},
{
id: 'si_RasxXolo8s2RVd',
deleted: true
}
],
prorate: true,
proration_date: 1736988207
}
)
See sub_0QhhAe5QM0nABsUHRnWFSk6i
looks like it produced what I would expect
its rebating the $240
This is desired behavior, if I can mimick it I would like to
Can you advance the test clock (if there's one) and share with me the ID of the finalized upcoming invoice?
there is not a test clock on this one
but the upcoming invoice should be that one right?
Can you try again with a test clock?
yes
working on attaching
ok i have the clock setup
changing the subscription
@fiery cypress finally: in_0Qhj6o5QM0nABsUHC4SBptss
I haven't setup a clock in a while
Thanks, let me take a look
https://dashboard.stripe.com/test/logs/req_pyHBWhZzSmTYFO
https://dashboard.stripe.com/test/logs/req_BIyFfiMLAQe1Wg
Looks like you update the subscription twice, is this your expected flow?
Interesting, then that may explain the ($240 off) description in the proration line item.
$240 is correct, but I'm making an upgrade to our system where i do almost the same thing and its $120 instead.
OK, looking at sub_0QdL9N5QM0nABsUHqLtZEIml, you only update it once (https://dashboard.stripe.com/test/logs/req_5udmWFdhObRA4R),
And that's why the proration line item shows ($120 off).
thats because my test fails cause the preview is wrong before the 2nd update
so its starts at $120, I upgrade to $240, and preview. on that preview the good subscription is correct ($240) and proceeds with the $360. The bad subscription gets back ($120) and I don't complete the upgrade
Can you should me the ID of preview request that you made after applying $240 discount?
that was done around here #1329216984512200735 message
To confirm. Is it req_ETH1tbkqf6Dq5F?
yes
It's a GET request so I can't view the response. Can you share with me the content of the response?
yes when we first connected today it was the file called bad-one.json
notice the coupon proration says its for 2 x seats (correct) but then has the wrong amount on it ($120).
Ok, what's the ID of request that resulted in the "good-one" ? Sorry it's a long thread, so need your help to extract the info.
req_gBZFZZh6c22e9c
You called the preview API (req_ETH1tbkqf6Dq5F at 11:33:26 PMJan 15, 2025) before updating the subscription (req_KFMt7vEsA9dmdq at 11:33:40 PM Jan 15, 2025
Can you try again by calling the preview after the update?
I'll have to pick this up tomorrow. Can I continue on this thread?
The thread will be closed after some time. Feel free to use the button in #help channel to create a new one
Just one more thing. My workflow calls preview, update, preview. So just make sure thats the right one. Thank you.