stripe.customers.cancelSubscription unable to take at_period_end parameter
API Signature only accepts {CUSTOMER_ID}, {SUBSCRIPTION_ID},
Unable to pass at_period_end
@damien-m - You should be able to pass at_period_end inside the optional arguments object as a third parameter, e.g.
stripe.customers.cancelSubscription('customerId', 'subscriptionId', {at_period_end: true});
Passing optional arguments is documented here: https://github.com/stripe/stripe-node/wiki/Passing-Options
(also see: https://github.com/stripe/stripe-node/blob/master/test/resources/Customers.spec.js#L698-L710)
The third parameter for this method is a callback function. Passing an options argument as the third argument prevents this from being called. It would be good to get a response and handle that appropriately.
Hmm, to clarify, you can pass in the callback as a fourth parameter when using the optional arguments object (as the third parameter). Would look something like this:
stripe.customers.cancelSubscription('customerId', 'subscriptionId', { at_period_end: true }, function(err, data) {
console.log(err, data);
});
(fwiw, I just tested this gist - script and output: https://gist.github.com/stephen/e49da7bd005b41fc5c13)
Ok thanks. I'll RTFM next time :wink: