#skoshkarli

1 messages · Page 1 of 1 (latest)

zealous helmBOT
tawny pulsar
#

Hello

#

Hmmm I think this is expected behavior and you would need to create a new Sub here, but if you provide me an example Sub ID that experienced this I'll double check.

#

pay_immediately is only designed to work on Subscription creation

acoustic jewel
#

yeah one second

#

sub_1MNZbDErhtagFlzStyhCsOd3

#

i think this is one of those that this happened with looks like

#

so you are saying i should create a brand new subscription for the user, how would I apply the proration from the old sub to the new sub?

tawny pulsar
#

Thanks, let me take a look

#

Okay yeah so two options here I believe

#

Before update you would either need to flip the Sub to have a collection_method of send_invoice so that the new invoice does not finalize immediately on update and then flip it back to charge_automatically going forward, or you would need to use the Upcoming Invoice endpoint (https://stripe.com/docs/api/invoices/upcoming) to calculate proration and then create a new Sub and use that proration amount for the initial invoice of that new Sub.

acoustic jewel
#

is the upcoming invoice the one that will tell me the amount which will be credited back to the customer?

#

another question: would setting the collection_method to send_invoice send an email out to the customer right away with the invoice? How does that allow to delay the payment?

tawny pulsar
tawny pulsar
#

You should be able to test this out

acoustic jewel
#

interesting, the problem is that i don't know when avalara will calculate the tax and post it, because they use your webhook to do their processing and then update the invoice

#

so i think i am stuck with just creating a new subscription and using the amount from the next invoice from the old sub

tawny pulsar
acoustic jewel
#

i believe so

#

they listen to a few event

#

events*

#
charge.succeeded
customer.created
customer.updated
invoice.created
invoice.updated
#

and charge.refunded

tawny pulsar
#

Gotcha, I think you would need to listen for invoice.updated to know Avalara has performed the update and then you could call /pay

#

You'd need to be careful obviously to not call /pay on normal updates not involved with a Sub update

#

Honestly, a new Sub might just be cleaner here for this scenario

acoustic jewel
#

yeah i think so too. Would I also cancel the old sub right away as well in this scenario?

#

instead of doing cancel at period end i guess

tawny pulsar
#

That would create an invoice item for the proration, then you just re-create a new Sub and it will pick up that invoice item

acoustic jewel
#

oh so that would be like a "credit" on the customer's account?

tawny pulsar
#

Yep more or less. It wouldn't actually go to the Customer balance like a credit note but it will wait to be picked up by next invoice as a credit on that invoice

acoustic jewel
#

oh nice. ok let me try that and see how it goes

#

i appreicate your help!

tawny pulsar
#

Sure thing! Try it out and see how it does