#fractalskwish

1 messages · Page 1 of 1 (latest)

dry heraldBOT
twilit patio
#

it turns out, I can't really do anything with that final draft auto-generated invoice (seems like I can't delete or void it directly)
Copying the last portion of your question here :

#

Yes, cancelling the subscription should stop any kind of payment attempt there.

#

If you are using our normal trial period functionality, that first paid invoice should be in a draft state for an hour which should give you a window to cancel it through the API it you would like

modest grail
#

ok, just to clarify, by canceling the subscription, that final draft invoice will get "voided" before it's actually charged?

#

If so, perfect!

twilit patio
#

I forget if it happens automatically. If you try it out in test mode it will show you the expected behavior here though. If it doesn't cancel automatically, there is an API call that you can use.

modest grail
#

"Note, however, that any pending invoice items that you’ve created will still be charged for at the end of the period, unless manually deleted. "

#

I am currently trying to implement and test this, but surprised that I couldn't directly affect that final draft invoice at trial end

twilit patio
#

You should be able to. Is there an error you were seeing when you tried?

modest grail
#

yeah, I just tried voiding, and then tried deleting the final invoice, both had errors:

#

stripe.Invoice.void_invoice(subscription.latest_invoice)

*** stripe.error.InvalidRequestError: Request req_FHrrXjdgr26wdn: You can only pass in open invoices. This invoice isn't open.

#

stripe.Invoice.delete(subscription.latest_invoice)

#

stripe.error.InvalidRequestError: Request req_gNjC8zlcSqrcHO: You can't delete invoices created by subscriptions.

#

FWIW, this is testing with a test clock, at the subscription trial end time, right after I see the "invoice.created" event

#

stripe.Invoice.mark_uncollectible(subscription.latest_invoice)

#

*** stripe.error.InvalidRequestError: Request req_fjtRR5VdZbRrLJ: You can only pass in open invoices. This invoice isn't open.

twilit patio
#

Ah thank you. I forgot about the restriction from that second message. For draft invoices, delete is the function to call here

#

But as that message calls out, that would only be usable for invoices not made by a subscription

#

So cancelling the subscription should cancel that invoice and not attempt to charge the customer

modest grail
#

I haven't tried advancing the clock yet to verify that the invoice gets auto-deleted/canceled/voided, which i'll test soon

#

thank you again for your help, much appreciated!

#

if you take feature requests, it would be nice if I could set a subscription attribute, something like "trial_subscriptions_ends_peacefully" that just ends a trial subscription at the end, if the customer hasn't bothered to setup their billing information by then

twilit patio
#

Thanks for the feedback, I will file something for that so that we can test in future