#skoshkarli
1 messages · Page 1 of 1 (latest)
Basically the case i have is, users subscribes to one subscription product, then cancels and subscribes to another
i was told to do an immediate cancellation with prorate:true
which seems to create a new invoice which is correct, but the original invoice never gets fully processed and stays as draft
Hi, taking a look here
It looks like an update was made within a minute of creating the initial subscription (while the invoice was still in draft status). Let me try to reproduce this on my end.
update was made by Avatax?
i mean even if i cancel the original subscription this invoice was for, the invoice should still get charged after an hour, right?
i use pay_immediately flag set to false
which should make it delay by an hour to allow for Avatax to add taxes
You went from a monthly price to a yearly plan while the first invoice was in a draft status
correct
so the credit got applied to the annual product on the invoice, but the monthly invoice never got charged
It did get credited on this invoice, https://dashboard.stripe.com/test/invoices/in_1MPBW1ErhtagFlzSYQt5hIPH
Ok, we are on the same page.
👋 taking over here
can i just continue with one person please
i dont' want to have to re-explain something
i think @hard lily is still trying to test it
You don't need to, just gimme some mins to catch up. We are also talking
I think the behavior is expected, when a Sub is cancelled the drafted Invoice will also be closed https://stripe.com/docs/billing/subscriptions/cancel#invoice-items-and-usage
it was advised to me by you guys to do it this way
if it was expected then why was i told to do this?
i spent number of days refactoring my code and only now noticed that these draft invoices are not being charged
what do you suggest to do to resolve this?
I am looking at the older thread to grasp the context
ok
Um I get the original discussion when we reached a conclusion that cancel a Sub with prorate=true, then create a new Sub will pick up the prorated amount immediately. But why do you still want the old Invoice to be charged? More specifically:
- The old Invoice has $9.99 for a month and $0.87 adjusted by Avatax
- The new Invoice has prorated of -$9.99 of the unused part in 1., $99.99 for an annual charge, then $7.88 adjusted by Avatax
So I think new Invoice get charged and old Invoice never get charged, should be the correct calculation in the end, no?
no because i am short 9.99 + tax now
because it never got charged
and the 2nd invoice is reduced by that amount
but i never received the money
because its still in draft
No you are not short. The new Invoice off by $9.99 because that's an unused time
unused time means you are giving customer a credit to use on their new subscription
but if you never charged the customer to begin with
how can you provide a credit
you need to charge first on the initial invoice
but the initial invoice stays in draft forever
Ah I see what you mean. One moment
How about just ... manuall call finalize then pay for that Invoice?
Canceling a subscription causes all open and draft invoices for that subscription to have their auto_advance property set to false. This occurs to prevent unexpected automatic payment attempts and reminder emails. This effectively pauses automatic collection for these invoices. You can still manually attempt to collect payment and manually send emails.
what about https://stripe.com/docs/api/subscriptions/cancel?lang=node#cancel_subscription-invoice_now
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
will that charge?
that seems to do the trick too
let me try this real quick one sec
uhmm no so invoice_now is creating another invoice which refunds the customer
i don't want to be providing refunds, just a credit on the next invoice
so the audo_advance property, are you saying if i set that to true on the invoice, it will advance when it was supposed to? (an hour after initally created)
@jovial sky
No it's a bit different. Don't set the auto_advance property back to true, simply call the Finalize Invoice API and then Pay Invoice API
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I want to give it the full hour if its in draft, in case taxes have not been calculated yet
to allow Avatax to do its thing
You mean Avatax could send additional invoice items in 1 hour?
- Set the auto_advance back to true and hope 1 hour later the Invoice will process as expected
- Simply wait 1 hour on your own then manually call the Finalize and Pay Invoice.
I prefer 2 but that could make implementation complicated. Agree that 1 would be easier
You can test it real quick I think, using a Test Clock on the Customer
waiting is not really an option, i dont have a service that would do this
is it possible to pull of a time off of the invoice (when it will be charged) and apply that ?
looks like there is a next_payment_attempt on it
https://dashboard.stripe.com/test/events/evt_1MPBVzErhtagFlzSDHwKf2yu
previous_attributes: {
auto_advance: true,
closed: false,
next_payment_attempt: 1673474791
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
maybe if i use auto_advance with next_payment_attempt ?
Yep looking at the next_payment_attempt. I am a bit concern about closed but let's try it
So to set the auto_advance back to true I think you can immediately set it back and it will calculate 1 hour after draft to finalize and charge. You don't need to wait exactly 1 hour then set it back
ok let me try
so i did auto_advance: true only and it created a new invoice and refunded the user
i have a feeling that auto_advance: true, on a cancelled subscription will always refund ?
instead of giving a prorated credit
Umm I just want to see it too. Could you provide the newly tested Id?
I would like to see the refund action
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Did you create a new Subscription?
Was sub_1MPGCAErhtagFlzSsjBSeWWY you new Subscription?
so
update doesnt take next_payment_attempt
Received unknown parameter: next_payment_attempt
i tried setting auto_advance to true and collection_method to "charge automatically"
but none of that worked
@jovial sky
i dont understand how your proration works at this point. it doens't make sense that i create a new subscription and i say to prorate and it gives me the credit but doesn't charge the initial invoice
this has to be a bug on your end
i dont care if its in a draft or not, that invoice has to be finalized if you are applying a prorated amount from it onto another invoice
By doesn't work, didn't it do anything when the time comes? Can you share a Subscription Id?
i mean that its the same result as before
nothing has changed
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
it stays in draft mode
and automatic collection is off
how can i set next_payment_attempt?
That's not a paramter to set. I am looking at auto_advance back to true, by this req so far https://dashboard.stripe.com/test/logs/req_T3HLKaVq5D8Dd7
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
so you think i should not do auto_advance: true ?
Hmm looks like it doesn't have effects. Can you try to manually finalize and pay the Invoice? I know in reality you need to wait for a bit more time, but just to test let's see if you can finalize and pay it
so to call finalizeInvoice ?
ok i am going to call finalize on this invoice now
via curl
done
its now just an open invoice
never got charged
Okie so to summarize what we have tried, seems that directly call Finalize and Pay is the only way. Once the Subscription is cancelled, all "automatic" mechanism like auto_advance or calculating next payment is off, and the draft Invoice are treated as individual Invoices
I think you would need a queue mechanism or anykind of scheduler, that after 1 hour (or any hours you want) to trigger the Finalize and the Pay API
Sorry it's how the Subscription is designed, per the Doc
Canceling a subscription causes all open and draft invoices for that subscription to have their auto_advance property set to false. This occurs to prevent unexpected automatic payment attempts and reminder emails. This effectively pauses automatic collection for these invoices. You can still manually attempt to collect payment and manually send emails.
how does the AvaTax webhook set the next_payment_attempt?
it doesn't seem like an option available via the api based on the docs
Which part specifically?
next_payment_attempt is set to an hour from when an invoice is created initially
and that gets reset when the subscription is cancelled
Do you mean this event? https://dashboard.stripe.com/test/events/evt_1MPGh6ErhtagFlzSREo1s7pL
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You can see their request https://dashboard.stripe.com/test/logs/req_eyfQmj7uOfdlLW
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
i guess maybe thats not done via api but is done during the intial create subscription call
using the pay_immediately flag
another question, do i have to finalize an invoice before paying it? I am tempted to go ahead and finalize the invoice before the new subscription is created and not allowing for the full hour
it seems like the prorated amount gets carried over at that time, so i am thinking if taxes were not calculated then they wouldn't show up anyway on the new invoice
Yes you need. It's the Invoice "state machine" when Draft --- (Call Finalize API) --> Open ---- (Call Pay API) ----> Paid
Hopefully! Sorry for the back and forth