#akash_subscription-cancellation
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1225735784079036489
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- akash_invoice-upcoming, 31 minutes ago, 11 messages
- akashpatil7596_api, 20 hours ago, 35 messages
- akashpatil7596_api, 21 hours ago, 37 messages
- akashpatil7596_api, 23 hours ago, 37 messages
- akashpatil7596_api, 1 day ago, 49 messages
- akashpatil7596_api, 1 day ago, 10 messages
and 6 more
akash_subscription-cancellation
@hushed olive you can test this end to end yourself in a few seconds in the Dashboard or with code to confirm exactly what happens.
You likely want to carefully read https://stripe.com/docs/billing/subscriptions/prorations too
Umm can you simply tell me what I've done wrong with this API?
stripe.subscriptions.del('seb_xxx')
Cause in the doc you provided there is only upgrade and downgrade , no cancellation
Sorry you are asking a ton of short questions without much details. All of this can be tested end to end really quickly easily! Can you please share exact code, exact Subscription id, what you see on the Invoice and Customer, to show what you have already tried to do
This is my code. Here is the subscription Id : sub_1P28qrIoZDVxPDheGzmnRrAb
I think what you are missing is the prorate: true parameter: https://docs.stripe.com/api/subscriptions/cancel#cancel_subscription-prorate
(working on reproducing myself too!)
Okay so yeah you have to pass prorate: true and invoice_now: true to cause an Invoice for the credit to happen.
Then you also have to finalize that Invoice afterwards to see the credit balance applied (or wait a couple hours for automatic finalization)
So you want to add const invoice = await this.stripe.invoices.finalizeInvoice(cancelStripeSubscription.latest_invoice); and that response will have ending_balance set to the new credit balance on the Customer
I've done all you said still no credit balance, subscription ID : sub_1P295VIoZDVxPDheccfGEk5G
you didn't pass invoice_now: true like I asked
Oui, sorry
I did try this myself locally (but in PHP) and it does work fine
'customer' => $customer->id,
'items' => [
[
'price' => 'price_ABC',
'quantity' => 1,
],
],
'expand' => ['latest_invoice.payment_intent'],
]);
$subscriptionCanceled = $stripe->subscriptions->cancel(
$subscription->id,
[
'prorate' => true,
'invoice_now' => true,
'expand' => ['latest_invoice'],
]
);
$invoice = $stripe->invoices->finalizeInvoice($subscriptionCanceled->latest_invoice->id);```