#neha_upcoming-prorationdate
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/1216803415171268670
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- neha_best-practices, 2 days ago, 15 messages
- neha_docs, 3 days ago, 25 messages
- neha_best-practices, 3 days ago, 110 messages
- neha_docs, 3 days ago, 26 messages
- neha_webhooks, 3 days ago, 66 messages
- neha_unexpected, 3 days ago, 73 messages
and 1 more
hi
if a user cancels, i want to show them a dialog explaining how much they'll be credited (i can't use the customer portal)
i am trying to use the upcoming invoice API: https://docs.stripe.com/api/invoices/upcoming
i call it like this:
subscription: subscriptionId,
subscription_cancel_now: true,
// subscription_billing_cycle_anchor: "now",
// subscription_proration_behavior: "create_prorations",
// subscription_proration_date: timestamp,
});
return invoice;```
https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-subscription_proration_date it's right there in the docs
its not being returned.
The value passed in should be the same as the subscription_proration_date returned on the upcoming invoice resource.
but it is not in the response
i can send you the full response if youd like
It's not expected to be returned, it's purely a write parameter.
neha_upcoming-prorationdate
ok one second
nope
i tried this
const invoice = await this.stripe.invoices.retrieveUpcoming({
subscription: subscriptionId,
subscription_cancel_now: true,
// subscription_billing_cycle_anchor: "now",
subscription_proration_behavior: "create_prorations",
subscription_proration_date: Math.round(new Date().getTime() / 1000),
});
and it's still not being returned
It will never be returned, it's not supposed to ever be returned. It's a parameter. You pass a value to influence how we calculate proration, but it's not returned back.
should be the same as the subscription_proration_date returned on the upcoming invoice resource
ok the docs are confusing then
ah yeah I don't know what that sentence could mean. I'll flag it internally
sure thing, sorry for the confusion
for calculating the pro-rated refund based on the time right now
subscription: subscriptionId,
subscription_cancel_now: true,
// subscription_billing_cycle_anchor: "now",
subscription_proration_behavior: "create_prorations",
subscription_proration_date: Math.round(new Date().getTime() / 1000),
});```
that seems correct, you can test this end to end in Test mode to confirm
it's confusing that i can't get out of a test clock
once the customer is in test clock... there's no "stop"
correct, that's expected, it wouldn't make sense to reset the time back to today when you're simulating time that could already be in the future
yeah
ok one last thing
for some reason i can't set prices to be the "Default"
i see the default price, but i can't set another one to be the default instead
is that a recent change?
I don't know then, sorry. I focus on helping developers with code here. I'd recommend asking our support team directly about whether this changed: https://support.stripe.com/contact
"subtotal_excluding_tax": -3498,
"tax": 0,
"test_clock": null,
"total": -3498,
"total_discount_amounts": [],
"total_excluding_tax": -3498,```
"object": "list",
"data": [
{
"id": "il_tmp_193eb0BZ8IchjqOe4045623f",
"object": "line_item",
"amount": -3498,
"amount_excluding_tax": -3498,```
which is the right value to use off the invoice object
to show the customer the credit that will be returned
i think total? or lineItem.amount?
Try it yourself, do the math, look at the result, and understand wht's happening. Each property on the Invoice means something different and it depends what you want to surface to your end customer
ok thanks