1
votes

I am building site that allows users to signup for multiple subscriptions. The Parse.com / Stripe API we use allows me to create multiple subscriptions for each user. However, if a user has more than one subscription, and I attempt to cancel any of them, I get an error that the user has more than one subscription and that I must identify which subscription I am referring to. The problem is, that I do attempt to pass the subscription ID to into the API (see below) but it just seems to get ignored. Stripe clearly supports this second parameter in their API, but the Parse documentation does not show a second "subscriptionId" parameter.

The following Parse Cloud Code (which works perfectly as long as the user has only one subscription)

Parse.Cloud.define("cancelStripeSubscription", function(request, response) {
Stripe.Customers.cancelSubscription(request.params.customerId, request.params.subscriptionId, true, {
    success: function(httpResponse) {
        response.success("Cancellation Complete");
        },
           error: function(httpResponse) {
           response.error("Error: " + httpResponse.message);
       }
   });  
});

Here is the relevant Parse/Stripe Cloud Code API - https://parse.com/docs/js/api/symbols/Stripe.Customers.html#.cancelSubscription

Here is the equivalent Stripe API clearly showing a second "subscriptionId" parameter. https://stripe.com/docs/api/node#cancel_subscription

I'm hoping that the Parse/Stripe module does support multiple subscriptions.

Thanks for any help!

1

1 Answers

0
votes

Unfortunately, Parse's Stripe API library is pretty old and was built against an old version of the API when only 1 subscription was possible. You'd either just have to do 1 subscription per customer or generate the web request to Stripe's API yourself not using the library.