#kshitij khanal

1 messages · Page 1 of 1 (latest)

unkempt depotBOT
exotic oxide
#

What error are you getting after adding items?

shut drum
#

message
:
"Failed to unsubscribe the subscription."
statusCode
:
400

#

I want to unsubscribe one of the line item from the subscription

exotic oxide
#

Can you share the request ID with me so I can take a closer look?

shut drum
#

subscriptionId and planId?

exotic oxide
#

Subscription ID works fine

shut drum
#

sub_1NT7DmFMyqmnT60ruJ41fbxU

exotic oxide
#

You're getting an error because you're passing in a Product ID (prod_xxx) as a plan - you need to be passing in a price and the Price ID that you want in items

shut drum
#

can i use product id?

exotic oxide
#

No, you can't use product ID for this

#

Also, why are you trying to remove the only items this subscription has? As far as I know, a Subscriptoin has to have at least one item on it

shut drum
#

It is dynamic, it can have multiple items as well as single item for a subscription. I am trying to use the same api for all cases.

exotic oxide
#

If you have a single item for the subscription I'm pretty sure it won't work and we wouldn't let you delete it - you'd have to cancel the subscription instead

shut drum
#

I have a list of subscription items page, where i can unsubscribe one of the item. The item can be subscribed individually as well as i can purchase a basket of items in a single subscription. I won't know how i subscribed to that item. However i have subscribed, either individually or in a bundle, i should be able to unsubscribe it.
So, i used priceId as a parameter for unsubscription even if the subscription might have a single item.

exotic oxide
#

I understand that, but what I'm saying is that I'm fairly sure that request won't succeed in stripe - if you're subscribed to a single item the only way to immediately unsubscribe is by cancelling the subscription

shut drum
#

So, it means i need to have an extra check whether the subscription has multiple items or a single item and call the update api likewise with priceId and without it accordingly?

exotic oxide
#

Let me ask a quick clarifying question - are you always cancelling/unsubscribing at the END of the current period (by setting cancel_at_period_end: true), or are you also cancelling immediately?

shut drum
#

We are unsubscribing at the end of the current period. But we may also unsubscribe immediately in some cases in future.

exotic oxide
#

Why are you passing in items again, if all you're doing is unsubscribing at the end of the current period? Why aren't you just passing in cancel_at_period_end?

shut drum
#

because the subscription might have more than one lineitems. And we always need to unsubscribe for only a single line item.

exotic oxide
#

That's not how cancel_at_period_end works though - when you set that it applies to the WHOLE subscription

#

By passing in items all you're doing is changing the items the subscription is currently subscribed to

shut drum
#

Is there any way I can handle this. Its that we have 3 items that can be purchased individually and the same 3 items can be purchased as a bundle also.

exotic oxide
shut drum
#

I will try it and get back if it doesn't fit my requirements.

#

Thank you

exotic oxide
#

👍