I am trying to cancel a stripe subscription on a connected account (in test mode), but I am getting the following error:
StripeInvalidRequestError: No such subscription: SUBSCRIPTION_ID
I can see the subscription with SUBSCRIPTION_ID
in my Stripe dashboard, and cancel it from there. I've tried the following, with and without the stripe_account
argument:
stripe.subscriptions.del(
SUBSCRIPTION_ID, { at_period_end: true }
), {
stripe_account: stripeAccountId
};
I am able to cancel subscriptions on the platform account with no trouble. Do I need to first authenticate with the connected account's API key? Or is there another method I should be using here?
Edit: the subscription is on the account whose id matches stripeAccountId
In the end, it was a typo.. I had misplaced a closing bracket. Here is the corrected API call
stripe.subscriptions.del(SUBSCRIPTION_ID, {
at_period_end: true
}, {
stripe_account: stripeAccountId
});