#lea173589_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/1397960261440245850
š Have more to share? Add more details, code, screenshots, videos, etc. below.
Here is the screenshot of the preview on the dahsboard
hi thanks for the two examples, taking a look
One request is using proration_behavior: create_prorations https://dashboard.stripe.com/test/logs/req_TvcfeI63eWuOmm
While the other is using proration_behavior: always_invoice
https://dashboard.stripe.com/test/logs/req_eY0dHAO9FQD3YP
So yea these can lead to different results
Both of the requests you shared appear to be from the Dashboard, though
So not sure if you mean to share a different request from your API call
I used the shell for the 2 requests, and I'm getting the same result from the api. The preview of the dashboard is a different attempt, and I'm getting a different result that the other 2 requests
i would like to know how to achieve the result from the dashbord preview, with an api request
Well these examples are using different parameters so different results seems reasonable
You should test with the same parameters for the same subscription context and see if that resolves the difference
the problem is that I don't know the parameters that the dashboard uses
From the shell :
req_eY0dHAO9FQD3YP -> amount 226
req_TvcfeI63eWuOmm -> amount 9814
From the dashboard :
Amount 9211
I cannot manage to get the amount 9211 from the shell, do you know which parameters should i use ?
You can looks at the requests in your API request logs in the dashboard/workbench to see what was used
At the links I gave you
thoses links are for the requests I made from the shell, I already know what parameters I used and this is not what I want
is there any way i can see the log of the request made on the dashboard ?
Yep if you go through the Dashboard flow again, you should find the same results in the logs afterward: https://dashboard.stripe.com/test/logs/
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I went through the process on the dashboard but no request were visible on the logs
š stepping in as synthrider needed to step away
hi!
If you use the API endpoint filter in Workbench and filter for /v1/invoices/create_preview do you see the logs?
I see them from my end
yes but those are the requests I made using the shell :
Oh I see what you are saying -- yeah if you go to make an update in the Dashboard then the preview shown in the modal does not generate an API request. That is all Dashboard calculation done via the Dashboard logic.
You can't use that to mirror an API request.
Ok thanks for your reply, then how can I achieve the preview in the modal with an api request ? the result from the dashboard is the result I want, and the results from the 2 shell request are not what I want
You would need to continue changing the parameters for the API request to achieve what you want.
Perhaps if you can give me the specific scenario then I can help. Overall though you should think of setting the params to how you want things handled, not focus on trying to achieve a specific amount.
ok i'll explain my scenario better :
I want my customer (cus_SjsVALCWpNxSez) to update subscription prices (sub_1RoOkQCrKhyR1Db2h5x3PvNd) from price_1Lri2ZCrKhyR1Db2DYpping9 to price_1RRV9RCrKhyR1Db2im6jS9oR
I want my user to start a new billing cycle at the moment of the upgrade, and I want a discount of the time not used of the first billing cycle on the invoice.
I can manage to have this exact result when doing the preview on the dashboard with the final amount of 92,11ā¬
Okay so you basically just want to create a Preview that uses proration_behavior: always_invoice and update the Subscription Item.
From looking at your Workbench preview it seems you are using a Test Clock and thus setting proration_date: "1782913912"
But that could potentially be throwing things off
Overall if you see a different than expected amount then providing the exact request ID would help. Or you could even perform the update in test mode to a test Subscription and then we can look at the generated Invoice to see what happened.
Then I tried on the api shell to replicate this result
The first request req_eY0dHAO9FQD3YP with proration_behavior as create_proration gave me an invoice of 2,26⬠which is only the amount of the proration, and not the start of a new billing cycle.
The second request req_TvcfeI63eWuOmm with proration_behavior as always_invoice, gave me an invoice of 98,14ā¬, which is more than the amount of the price_1RRV9RCrKhyR1Db2im6jS9oR (95,88ā¬) and with no discount
Those requests are not what I want