#skoshkarli
1 messages · Page 1 of 1 (latest)
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
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?
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.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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?
Yes you can indicate the Sub update when calling that endpoint to see the proration amount
send_invoice Subs have the 1 hour waiting period in draft. The invoice will not be sent until that is over and you can prevent this by flipping auto_advance to false, you can then pay the invoice using https://stripe.com/docs/api/invoices/pay which will finalize it and pay it and then it shouldn't be sent if I remember correctly.
You should be able to test this out
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
They update based on invoice.created right?
i believe so
they listen to a few event
events*
charge.succeeded
customer.created
customer.updated
invoice.created
invoice.updated
and charge.refunded
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
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
Yep and actually now that I think about it I think you could just call prorate: true when you cancel and not have to preview at all: https://stripe.com/docs/api/subscriptions/cancel#cancel_subscription-prorate
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
oh so that would be like a "credit" on the customer's account?
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
Sure thing! Try it out and see how it does