#mangle_api

1 messages ¡ Page 1 of 1 (latest)

wide roostBOT
#

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

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

jaunty acornBOT
weak spruce
#

invoicePreviewParams {
customer: 'cus_Pq1Wd0DN6aRLr9',
subscription: 'sub_1P0nmRDmVlmqORBIbTw0RGWC',
subscription_items: [
{
id: 'si_PqUlRbXcW2QnPX',
quantity: 2,
price: 'price_1Oyc62DmVlmqORBIaeesFUkm'
}
]
}

these are the params for invoicePreview

undone sundial
#

If you cancel the subscription now then I don't think there'll be a new invoice yeah?

weak spruce
#

I have 2 types of subscriptions.

Standard Subscriptions that users can make prorated refunds and i use

subscription_proration_behavior = 'create_prorations';
subscription_cancel_now = true;

Which works fine.

and i have Company Subscriptions in which i don't want to prorate them, i want to show the full price on invoiceUpcoming

#

The user cancels the subscription, cancel_on_period_end is true and then he wants to refund, he sees how much he gets back and hits refund button.

undone sundial
#

That's not how it works though, If you disable prorations that means you want stripe to charge the customer "full" amount.

weak spruce
#

Yes so if company subscription is 6.99$, when i want to preview the invoice if i cancel it, no matter when, i want to show 6.99$

#

In case of standard ones with

subscription_proration_behavior = 'create_prorations';
subscription_cancel_now = true;

will calculate and show 3$ depending on how much time passed

#

How can i show then the amount he will get back but full amount in the case of company subscription?

undone sundial
#

In that case, do you even need to call the upcoming invoice API?
You can just look at the subscription item and use it's amount no?

weak spruce
#

Yeah, i didn't want to change my refund modal, i wanted just to add 2 params. I thought it will work for full price if it works for prorated case

undone sundial
#

What amount are you seeing if you set subscription_proration_behavior: 'invoice_now' ?

weak spruce
#

Invalid subscription_proration_behavior: must be one of create_prorations, none, or always_invoice

undone sundial
#

ah whoops, i meant always_invoice

weak spruce
#

total: -1258

i get prorated.

My subscription is 1398 with quantity 2

#

{
customer: 'cus_Pq1Wd0DN6aRLr9',
subscription: 'sub_1P0nmRDmVlmqORBIbTw0RGWC',
subscription_cancel_now: true,
subscription_proration_behavior: 'always_invoice'
}

#

Are you still here?

undone sundial
#

Yup still here, was thinking about alternatives.

#

Like I mentioned earlier, proration doesn't really make sense for your usecase given you just want to refund the full price you charged the customer previously

#

So you'd need to look at the previous invoice and show that amount as refund amount

weak spruce
#

Got it, i was checking if 14 days passed to send boolean of refund, and was using my API for it, that's why i thought it could be possible to show the invoice with no proration and see the full price. I will check the previous invoice and show it there

#

Thanks