Reputation: 401
I'm building a platform on Stripe Connect and I'm entirely confused about how to cancel accounts created through it. The Connect docs really only obliquely mention canceling subscriptions and I've followed the description in the core documentation but I'm getting a Customer X does not have a subscription with ID Y
error despite copying both of those values from dashboard (and, obviously, using them to create the subscription in the first place. I've seen a bunch of questions about the RoR side of this but all of the fixes I've found seem to be specific to that API. I know I could just delete the customer and it would end up in the same place but there's got to be a better way.
Upvotes: 3
Views: 1022
Reputation: 401
Okay that was quick. This is just on me not taking a logical leap in the docs and some incomplete information on the node side :(
While you create subscriptions with ids from your side you actually cancel them with the subscription id that's found in the callback ([charge].subscriptions.data[0].id
) when a user signs up for the plan. Once you've got that stored you can just use the suggested general code without any Connect-specific changes
stripe.customers.cancelSubscription(
customer_id,
subscription_id,
function(err, confirmation) {
// asynchronously called
}
);
customer_id will look something like this cus_xxxxxxxxxxxxxx
while the subscription_id will look something like this sub_xxxxxxxxxxxxxx
Will leave this here because I couldn't find anything on it and hopefully it helps someone else out.
Upvotes: 5