I'm really struggling getting Parse + Stripe to work in my project. At this point, I want the simplest working version that allows me to charge the user.

The closest thing I've found to an answer is the following: Simplest Example I've Found

When I use the corrected code from the link above, with my secret I get the following Error:

  Input: {"token":"tok_16kNOcIPNR1PIJsTyhvwTFJ9"}
  Result: TypeError: Object [object Object] has no method 'isString'
at request (stripe.js:49:25)
at post (stripe.js:117:12)
at Object.module.exports.Charges.create (stripe.js:157:16)
at main.js:19:31

Please help =**( this is so frustrating.

------------- UPDATE ----------------

A few other posts had similar errors and it looks like the most recent version of Parse Cloud code is to blame: 1.6.0. Revert to version 1.5.0 by using the following command line prompt in the console view:

parse jssdk 1.5.0

Now, unfortunately I still get the following error (but I think this is due to my cloud code main.js file now. I'll keep this thread updated when I finally figure out how to complete the cloud code file.

Error Domain=Parse Code=141 "success/error was not called" UserInfo=0x1740e5700 {code=141, temporary=0, error=success/error was not called, NSLocalizedDescription=success/error was not called}

2 Answers 11

Finally. OK so here is the most basic code that WORKS for using Parse + Stripe.

iOS Code

- (IBAction)save:(id)sender {
STPCard *card = [[STPCard alloc] init];
card.number = self.paymentTextField.cardNumber;
card.expMonth = self.paymentTextField.expirationMonth;
card.expYear = self.paymentTextField.expirationYear;
card.cvc = self.paymentTextField.cvc;

NSLog(@"%@, %@", self.paymentTextField.cvc, self.paymentTextField.cardNumber);
[[STPAPIClient sharedClient] createTokenWithCard:card
                                      completion:^(STPToken *token, NSError *error) {
                                          if (error) {
                                              NSLog(@"up here");
                                              NSLog(@"error - %@", error);
                                          } else {
                                           //[self createBackendChargeWithToken:token];
                                              NSLog(@"down here");
                                                NSString *myVal = token.tokenId;

                                              [PFCloud callFunctionInBackground:@"hello" withParameters:@{@"token":myVal}
                                                                          block:^(NSString *result, NSError *error) {
                                                                              if (!error) {
                                                                                  NSLog(@"from Cloud Code Res: %@",result);
                                                                                  NSLog(@"from Cloud Code: %@",error);


And then the main.js code:

var Stripe = require('stripe');
Stripe.initialize('sk_test_********'); //replace *** with your key values

Parse.Cloud.define(“hello”, function(request, response) {

var stripeToken = request.params.token;

 var charge = Stripe.Charges.create({
 amount: 1000, // express dollars in cents 
 currency: 'usd',
 card: stripeToken
 }).then(null, function(error) {
 console.log('Charging with stripe failed. Error: ' + error);
 }).then(function() {
   // And we're done!


Now again, this ONLY WORKS if you REVERT YOUR CLOUD CODE to Version 1.5.0 (as other have helped me with). Hope this helps someone else also.

1 upvote
Thanks, i ran into the same issue. What did they do with those modules n 1.6.X ? Documentation is partially broken when referring to any of the modules. Is there a different way of requiring modules perhaps? – jeveloper
Having same issue guys ! anything that can help ? – Ronak K
2 upvote
ONLY WORKS if you REVERT YOUR CLOUD CODE to Version 1.5.0 this helped – Ronak K
Awesome. Glad it helped. Unfortunately I have no clue why it doesn't work with 1.6.0. We will need to contact Parse =\ – Ibdakine
1 upvote
how do i revert to 1.5.0??? – MD Singh
parse jssdk 1.5.0 – Ibdakine
cd into your cloud code directory and run parse jssdk 1.5.0 and parse deploy. – Luis B

Just to be a little bit more explicit from above:

cd into your cloud code directory and run parse jssdk 1.5.0 and parse deploy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.