#manuel_api

1 messages · Page 1 of 1 (latest)

vast wraithBOT
#

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

📝 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.

glacial heron
#

hey there, taking a look

teal karma
#

ok ty

glacial heron
#

but its a zero amount invoice becuase of the changes you made, the prorations net out to zero

#

so really the coupon provides no discount in terms of payments, but it is consumed and removed

#

Whats the outcome you were expecting, instead of this?

teal karma
#

ohh ok

#

what I hope is that the coupon will remain in the subscription

#

but the problem is that the next invoices to be charged will be with a value of 0.00, any idea how to prevent this?

glacial heron
#

what I hope is that the coupon will remain in the subscription
can you say more?

#

In that case, say, what would you expect to see on the invoice you produced, and what would you expect on the next invoice?

teal karma
teal karma
glacial heron
#

Are you saying you expect this large coupon to lead to a customer balance to be applied to future invoices as they happen?

#

The "overflow" of an amount off coupon is just discarded now

teal karma
glacial heron
#

In this case, it applied to the 0euro invoice, was completely used, and removed

#

In your case, you could set that amount as a customer credit balance, then it would work as you describe, paying down future invoices until depleted

#

If the customer changes their subscription and you want to remove that credit, you'd need to adjust that again

#

Alternatively you could use a recurring amount off coupon matching the expected amount of the subscribed price for N months

#

That might be more along the lines of your goal

teal karma
#

ok i understand

#

ok if i use the recurring amount discount coupon will it not cause the following invoices to be made at 0.00?

glacial heron
#

It would reduce the future invoices by the discount/coupon amount specified. Isn't that what you want, though?

teal karma
#

the problem would be the prorate, right?

glacial heron
#

You should test the behaviour in test mode / sandbox to ensure it works the way you'd like, but if not then you may want to evaluate setting credit balance like i suggested as an alternative

teal karma
#

yes, I will also keep it in mind, could you give me some information or example about that credit balance

glacial heron
#

It's used automatically for cases where an invoice has a negative balance, too, to have that amount credited to a future invoice to reduce payment.

teal karma
#

ok I understand, sometimes I see invoices with negative balance. Can it also be due to that?

vast wraithBOT
glacial heron
#

existing credit won't push an invoice to a negative balance, the negative balance would be for other reasons like a large proration credit that outweighs a smaller proration charge

#

that negative balance is that added to the customer credit to reduce a future invoice

teal karma
#

ok ok

#

thank you

glacial heron
#

np!

teal karma
#

so if I do it with the credit balance of each csutomer it will avoid generating invoices in 0.00 and in negative balance when I modify your subscription

short vortex
#

👋 stepping in as synthrider needs to step away

#

The Credit Balance (assuming it is positive) reduces the amount of the next finalized Invoice.

#

However it won't make that Invoice negative.... the most it would reduce it is to $0.00

#

If it would reduce more than that, it would just remain in the Customer Credit Balance for the following Invoice.

#

Overall the best thing to do here is to test this stuff out!

#

That will give you the best understanding of how it all works.

teal karma
#

so all future invoices will be 0.00 with coupons

#

when the customers make an upgrade

short vortex
#

Depends on the Coupon

#

But sure if it is a 100% off forever

#

Then yes

teal karma
#

but all those coupons are not 100%, they are created with amounts not percents

#

and do not cover 100% of the subscription price, only a part of it

short vortex
#

Okay... is there a specific Invoice where you are seeing unexpected behavior?

#

If the coupon isn't 100% off then you wouldn't see a $0 Invoice just due to the Coupon

#

There would be something else causing that as well

teal karma
#

what happens is that when a coupon is applied to the subscription then some time later if the customer wants to modify his subscription by adding more items to it generates invoices of 0.00 regardless of the % or the amount, it will always be 0.00.

short vortex
#

Do you have a specific example for that?

#

Like I'd need an Invoice ID to look at

teal karma
#

yes

#

in_1RZ5CLDtLlgoCDIr1zlVEtEg

short vortex
#

Great, looking

teal karma
#

tyy

#

!!!

#

🙏🏻

#

if you need more context for that invoice, the customer modified his subscription and a discount was applied to his subscription after which he wanted to make a modification by purchasing an additional item. Which on the invoice for that item was a negative balance but there are other cases so instead of being a negative balance it is a total of 0.00.

short vortex
#

Okay so what happened is that you applied a one-time Coupon for €411 off: https://dashboard.stripe.com/logs/req_DZul7FfZxqvlRc. You applied that Coupon to the Subscription without any Invoice generation involved in that Coupon which means it covers the next charge: https://docs.stripe.com/api/coupons/create?api-version=2025-05-28.preview#create_coupon-duration

Then you updated the Subscription to delete one of the Subscription Items, which creates a proration item for the unused time of the Subscription Item you deleted. That is the 14x-€4.23+tax which leads to the -€71.57. For the other new Subscription Item that was added, the 15x€17.00 for price_1RTSXqDtLlgoCDIrdxEhScyh, the previously mentioned Coupon still covers this Subscription Item as it is what is responsible for the next Charge here. That means that Invoice Item is 15x€17.00-411 = -€xxxx but with a Coupon you can't create a negative line item so it just equals €0.00 for that Invoice item.

So in short the Coupon still applies to the new item here because it is the next Charge for the Subscription after the Coupon was applied which then combined with the proration item leads to the negative Invoice.

teal karma
#

ok, would there be a way that when modifying the subscription (which would be at the time of applying the coupon) the proration would not be applied?
or how would I do so that the following invoices are not 0.00 or negative balance?

#

or avoid these cases

short vortex
#

If you don't want proration then when you update the Subscription to the new Price (and remove the old one) you set proration_behavior: 'none': https://docs.stripe.com/api/subscriptions/update?api-version=2025-05-28.preview#update_subscription-proration_behavior, the downside here is that an Invoice is not cut in this case.

Also, as another point, why are you not just updating the Subscription Item here when increasing the quantity by 1? You are currently deleting the Subscription Item and creating a new one.

#

But it would be much cleaner, and avoid some of the proration stuff, to just update the Subscription Item quantity

#

Overall the absolute cleanest thing to do here is to just use the default proration behavior which would mean that proration items would be generated but handled at the next billing period.

#

That means the Coupon would apply to the actual next full Invoice generated

#

So it wouldn't be $0 assuming the full amount of that Invoice (the total of all the Subscription Items - proration item) is greater than that amount, which it would be based on the Subsription example you provided.

teal karma
#

how can i modify the number of items in a subscription without deleting them? because if i put 1 the item in the subscription remains as 1 and not 14+1

short vortex
#

You change the quantity to 15

#

If you need to you can retrieve the Subscription prior to the update to check the current quantity.

#

But this is much cleaner than deleting items and creating new ones when really you are just updating the quantity of a pre-existing item.

teal karma
#

ok ill take note with that behaviour

#

I'm going to do some tests and I'll be back then if something else happens 🥲

#

Thank you so much for your time

short vortex
#

Sounds good!

teal karma
#

And thank you for explaining things to me in detail.

#

👍🏼