Stripe + Parse Live / Production错误IOS

时间:2015-11-15 12:47:02

标签: objective-c parse-platform stripe-payments cloud-code

我的应用使用Stripe和Parse接受捐款以及为订阅注册客户。 使用Test Secret代码和Test Publishing Code在测试模式下一切运行良好,但现在我将其切换到Live Keys,我得到了Card_errors和Invalid_Request_Errors。

购买=捐赠代码;

订阅=订阅代码;

解析云代码:

    var Stripe = require('stripe');
Stripe.initialize('sk_live_********....');

Parse.Cloud.define("purchase", function(request, response) {
                   var AD = request.params.amountDue;
                   var fullName = request.params.fullname;

                   Stripe.Charges.create({

                                                            description: fullName,
                                                            amount: AD * 100,
                                                            currency: "usd",
                                                            card: request.params.token
                                                            },{
                                                            success: function(httpResponse)
                                                            {
                                                            response.success("Purchase made!");
                                                            },

                                                            error: function(httpResponse)
                                                            {
                                                            response.error(httpResponse);
                                                            }
                                                            });
                                      });

    Parse.Cloud.define("subscribe", function(request, response) {
                       var fullName = request.params.fullname;

                       Stripe.Customers.create({
                                             description: fullName,
                                             email: request.params.email,
                                             plan: request.params.plan,
                                             card: re

    quest.params.token
                                             },{
                                             success: function(httpResponse)
                                             {
                                             response.success("Subscription made!");
                                             },

                                             error: function(httpResponse)
                                             {
                                             response.error(httpResponse);
                                             }
                                             });
                       });

捐款代码:

- (void)createBackendChargeWithToken:(STPToken *)token completion:(STPTokenSubmissionHandler)completion {



        NSNumber *amountDue = [NSNumber numberWithDouble:priced.doubleValue];

        NSDictionary *productInfo = @{
                                      @"fullname": fullname,
                                      @"amountDue": amountDue,
                                      @"token": token.tokenId,
                                      };
        [PFCloud callFunctionInBackground:@"purchase"
                           withParameters:productInfo
                                    block:^(id object, NSError *error) {
                                        if (error) {
                                            [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", @"Error")
                                                                        message:[[error userInfo] objectForKey:@"error"]
                                                                       delegate:nil
                                                              cancelButtonTitle:NSLocalizedString(@"OK", @"OK")
                                                              otherButtonTitles:nil] show];

                                        } else {

                                        }
                                    }];






        completion(STPBackendChargeResultSuccess, nil);
        return;


}

订阅代码:

- (void)createBackendChargeWithToken:(STPToken *)token completion:(STPTokenSubmissionHandler)completion {


    NSDictionary *productInfo = @{
                                  @"fullname ":self.name.text,
                                  @"token": token.tokenId,
                                  @"email": self.email.text,
                                  @"plan": @"000000",
                                  };
    [PFCloud callFunctionInBackground:@"subscribe"
                       withParameters:productInfo
                                block:^(id object, NSError *error) {
                                    if (error) {
                                        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", @"Error")
                                                                    message:[[error userInfo] objectForKey:@"error"]
                                                                   delegate:nil
                                                          cancelButtonTitle:NSLocalizedString(@"OK", @"OK")
                                                          otherButtonTitles:nil] show];

                                    } else {

                                    }
                                }];






    completion(STPBackendChargeResultSuccess, nil);
    return;


}

如果在测试模式下工作,为什么会出现这些错误? 注意:虽然我在实时模式下进行测试,但该应用仍然不是应用商店或试飞,它只是通过Xcode进行侧载。这可能是问题吗?

编辑:

在测试模式下,当我使用真实卡时,我得到了Card_Error,但是当使用4242424242424时它会通过......

0 个答案:

没有答案