#mark-subscription

1 messages · Page 1 of 1 (latest)

spark seal
#

Hi! Starting this thread.

#

Can you share the customer id? Or a subscription id where you reproduced this?

fluid sigil
#

Hi
Customer ID: cus_M0BMmBho33uilt
Subscription ID: sub_1LIFQJDvkBSqGgYfW1dEuXlu

spark seal
#

What do you mean by 'invoice' looks the same? Do you have more context so I can investigate properly?

fluid sigil
#

Basically it seems that if you call invoices.retrieveUpcoming to preview a subscription change and there actually is no change, you seem to get an invoice for the full amount of all the items in the subscription, rather than an invoice for zero, as I would have expected.

#
const invoice = await stripe.invoices.retrieveUpcoming({
  customer: customerId,
  subscription: subscriptionId,
  subscription_items: Object.values(updatedItems),
  subscription_proration_behavior: 'always_invoice',
  subscription_proration_date: currentPeriodStart + (daysSincePeriodStart * 86400),
});
#

If updatedItems is the same as the items currently in the subscription then the invoice total is for all the items in the subscription. If updatedItems is different to the items currently in the subscription, then the invoice total is equal to the changes.

spark seal
#

Ah, I see what the ask here is. Looking

#

Could you not look at the invoice items to differentiate them?

fluid sigil
#

Possibly, just wondered if there was an easier way? Is there a reason for not getting a zero total invoice when nothing changes?

spark seal
#

There is not

fluid sigil
#

So I should be getting a zero total invoice?

spark seal
fluid sigil
#

So is this a bug or something I'm doing wrong?

honest silo
#

If you are on Price A and try to move to Price A, it's a no-op. Nothing happens

fluid sigil
#

But there is an invoice returned, as above. Is there a way to determine this no-op has occurred without comparing the items currently in the subscription with the new ones to check equality?

honest silo
#

Isn't that invoice the next cycle's invoice as expected? Like it's the same as if you didn't pass any of the parameters and there's just no proration right?

#

Saying "Please give me the next invoice" is the same as "PLease give me the next invoice as if I switched to Price A but I'm already on Price A"

fluid sigil
#

Yes, I guess so. I was just wanting a general way to determine that had happened to then inform the user that they had nothing to pay. I thought that the retrieveUpcoming was essentially a preview of what the user would be charged at that point in time, if there were any subscription changes (or not).

honest silo
#

that is not what that API is about at least so you are misunderstanding its goal right now. It's here to show you the next invoice, whenever that next invoice would happen

#

what you could do is look at the invoice's date to understand when it would be created and decide based on that instead

fluid sigil
#

Yes, I think I was misunderstanding it. I came from the docs 'Preview a proration' and was assuming it would work even if there was no proration. As you suggest, I'll try using the date or something to determine this case. Thanks for the help.

honest silo
#

I thiiiiink we're building a beta to do exactly what you're after with a new parameter called preview_mode. Not ready yet but that will likely help in the future