javascript - integrating Stripe.com and Parse.com with iOS - can't add a subscription to a customer -
thanks in advance!
i've been smashing head against desk day trying figure out why can't add stripe subscription customer via parse.
here dictionary looks in objective-c:
nsdictionary *productinfo = @{ @"tokenid": token.tokenid, @"plan": @"test plan", @"email": currentuser.email };
i'm calling pfcloud function in background:
parse.cloud.define("createsubscription", function(request, response) { var stripe = require('stripe'); // test stripe.initialize('abcdefghijklmnopqrstuvwxyz'); stripe.customers.create({ card: request.params.tokenid, email: request.params.email, plan: request.params.plan }, { success: function(httpresponse) { response.success("success - subscription created"); }, error: function(httpresponse) { response.error("error - subscription canceled"); } }) });
i've interchanged "card" "source" mentioned in stripe's documentation: https://stripe.com/docs/tutorials/subscriptions.
i've tried using plan id rather name. know i'm doing wrong?
edit: forgot mention getting error message, half of wrote - [error]: error - subscription canceled (code: 141, version: 1.6.3).
for interested in integrating parse , stripe, here solution. talked people @ stripe customer support , told me 2 important things.
first, if using newest stripe api version (2015-02-18) you're going want use key "source" if using older version you're going want use key "card".
second, make sure use id of plan rather it's name key "plan".
Comments
Post a Comment