简体   繁体   English

使用Stripe和Parse存储信用卡。 没有方法每个错误

[英]Store credit card with Stripe and Parse. has no method each error

Hello stackoverflow community 你好stackoverflow社区

Im desperately trying to create a new customer and credit card in Stripe out of an iOS app. 我拼命试图通过iOS应用程序在Stripe中创建新的客户和信用卡。 Im luckily getting the token. 我很幸运得到令牌。

However, when running the following code for creating a credit card with its customer, I get the error "has no method '_each'" in Parse Cloud Code: 但是,当运行以下代码与客户创建信用卡时,我在解析云代码中收到错误“没有方法'_each'”:

E2015-09-24T21:19:45.502Z]v10 Ran cloud function saveCardInformation with: 
Input: {"cardToken":"tok_16oh81JJfrimOSDHs6YSw4v5","objectId":"asdfdf"}
Result: TypeError: Object [object Object] has no method '_each'
   at request (stripe.js:58:11)
   at post (stripe.js:117:12)
   at Object.module.exports.Customers.create (stripe.js:239:16)
   at main.js:62:22

I execute the following Parse cloud code: 我执行以下Parse云代码:

//Parse Cloud code for creating new Stripe Customer and new Credit Card
var Stripe = require('stripe');
Stripe.initialize('mykey');

Parse.Cloud.define("saveCardInformation", function(request, response) {

Stripe.Customers.create({
     source: request.params.cardToken,
   },{
     success: function(httpResponse) {
     response.success("Customer successfully created!");
    },
     error: function(httpResponse) {
     response.error(httpResponse.message);
  }
});

In the corresponding iOS app, I have the following code: 在相应的iOS应用中,我有以下代码:

STPCard *stpcard = [[STPCard alloc] init];
stpcard.number = @"4568785465487897";
stpcard.expMonth = 5;
stpcard.expYear = 2017;
stpcard.cvc = @"255";

NSLog(@"card created");

[[STPAPIClient sharedClient] createTokenWithCard:stpcard
                   completion:^(STPToken *token, NSError  *error) {
                         if (error) {
                                 NSLog(@"error, no token created");
                            } else {
                                 NSLog(@"Token from callback recieved");
                                 [self createBackendChargeWithToken:token];
                                   }
}];

Up to here it works. 到这里为止。

The following method is causing troubles 以下方法引起麻烦

- (void)createBackendChargeWithToken:(STPToken *)token
{
NSDictionary *productInfo = @{@"cardToken": token.tokenId,
                              @"objectId": @"asdfdf"};

[PFCloud callFunctionInBackground:@"saveCardInformation"
                   withParameters:productInfo
                            block:^(id object, NSError *error) {
                                if (error) {
                                   NSLog(@"error,");
                                    return ;
                                }

                              [[[UIAlertView alloc] 
                              initWithTitle:NSLocalizedString(@"Success", 
                                                              @"Success")
                                                              message:nil
                                                              delegate:nil
                              cancelButtonTitle:NSLocalizedString(@"OK","OK"
                              otherButtonTitles:nil] show];
                              }];
}

Thank you very much for an answer and guidance! 非常感谢您的回答和指导!

Revert your cloud code version to 1.5.0 or earlier. 将您的云代码版本恢复为1.5.0或更早版本。

Explained here : Parse + Stripe iOS main.js 在这里解释: Parse + Stripe iOS main.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Stripe + Parse和云代码存储信用卡 - Store credit card using Stripe + Parse with cloud code 使用Parse或Stripe保护信用卡信息的安全 - Keeping credit card information safe with Parse or Stripe 条纹如何使用iOS / Parse为客户存储的信用卡创建令牌 - Stripe how to create a token for a Credit Card stored with customer using iOS / Parse 在视图中将Stripe PaymentKit信用卡文本字段居中 - Centering the Stripe PaymentKit credit card textfield in the view iOS IAP问题-用户必须确认信用卡时,iOS仍保留在App Store中 - iOS IAP issue - when user has to confirm credit card, iOS remains on App Store 如何在iPhone上存储信用卡信息? - How to store credit card info on iphone? PFQueryTableViewController解析。 未载入图片 - PFQueryTableViewController Parse. Not loading image 具有关键数据(信用卡,名称...)的本地存储与ddbb存储 - Local store vs ddbb store with critical data (credit card, name…) 将自定义对象作为指针插入Parse中。 [错误]:objectId是无效的字段名称 - Inserting Custom object as pointer in Parse. [Error]: objectId is an invalid field name iOS企业应用商店,包括接受信用卡付款的方式 - iOS enterprise app store, include a way to accept credit card payments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM