#akash_subscription-cancellation

1 messages ¡ Page 1 of 1 (latest)

rugged jasperBOT
#

👋 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.

unique frigateBOT
#

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.

tawny folio
#

akash_subscription-cancellation

hushed olive
#

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

tawny folio
#

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

hushed olive
#

This is my code. Here is the subscription Id : sub_1P28qrIoZDVxPDheGzmnRrAb

tawny folio
#

(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

hushed olive
#

I've done all you said still no credit balance, subscription ID : sub_1P295VIoZDVxPDheccfGEk5G

tawny folio
#

you didn't pass invoice_now: true like I asked

hushed olive
#

Oui, sorry

tawny folio
#

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);```
hushed olive
#

Done hurray

#

Although I want to menthin one thing

#

stripe.subscriptions.cancel don't work for me, always gives an error subscription.cancel is not a function but subscription.del is the same right?

tawny folio
#

you seem to be using an older version of our stripe-node SDK 9.10 from June 2022 and we renamed the function since then

#

but yes they are the same otherwise!