新的PayPal iOS SDK(测试版) - 无法连接到沙箱 [英] New PayPal iOS SDK (beta) - Can't connect to sandbox

查看:438
本文介绍了新的PayPal iOS SDK(测试版) - 无法连接到沙箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将新的PayPal iOS SDK整合到我的应用程式中。请参阅此处。新的SDK真的很容易设置,它允许您在3种不同的环境工作1.)PayPalEnvrionmentNoNetwork 2.)PayPalEnvironmentSandBox和3)没有环境意义去到他们的现场服务器。一切都适用于NoNetwork环境,显然是因为它使用模拟哑数据,而不必访问任何服务器。当我尝试切换到SandBox环境,PayPal无法连接到服务器,我得到以下错误:

I've integrated the new PayPal iOS SDK into my app. Reference can be found here. The new SDK is really easy to set up and it allows you to work in 3 different environments 1.) PayPalEnvrionmentNoNetwork 2.) PayPalEnvironmentSandBox and 3) No environment meaning to go onto their live servers. Everything works for the NoNetwork Environment, obviously because it uses mock dummy data, not having to access any servers. When I try to switch to the SandBox environment, PayPal can't connect to the servers, I get the following error:

  We're Sorry
  There was a problem communicating with the PayPal servers. [Cancel][Try Again]

我不知道这是否是我的一方他们的。以下是配置:

I'm not sure if this is a problem on my side or theirs. The following is the configuration:

 #define kPayPalClientId @"AbRN_BAV7YMsvde9KUFPsbSC_72NA9swMcY-j0QZL629lXrjSc9CNwfFn8Ac"
 #define kPayPalReceiverEmail @"The email I use to login into PayPal"


- (IBAction)pay {
   PayPalPayment *payment = [[PayPalPayment alloc] init];
   payment.amount = [[NSDecimalNumber alloc] initWithString:@"14.99"];
   payment.currencyCode = @"USD";
   payment.shortDescription = @"Testing.";

   if (!payment.processable) {
    // This particular payment will always be processable. If, for
    // example, the amount was negative or the shortDescription was
    // empty, this payment wouldn't be processable, and you'd want
    // to handle that here.
   }

   // Any customer identifier that you have will work here. Do NOT use a device- or
   // hardware-based identifier.
   NSString *customerId = nil;

   // Set the environment:
   // - For live charges, use PayPalEnvironmentProduction (default).
   // - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
   // - For testing, use PayPalEnvironmentNoNetwork.
   [PayPalPaymentViewController setEnvironment:self.environment];

   PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:kPayPalClientId
                                                                                             receiverEmail:kPayPalReceiverEmail
                                                                                                   payerId:customerId
                                                                                                   payment:payment
                                                                                                  delegate:self]; 
   paymentViewController.hideCreditCardButton = NO;

   [self presentViewController:paymentViewController animated:YES completion:nil];

}






strong> FIX:最后我想出了问题,你需要在视图加载后添加。

  [PayPalPaymentViewController prepareForPaymentUsingClientId:kPayPalClientId];






推荐答案

正如我的同事在评论中确定的,这个问题是PayPal iOS SDK中的错误,而不是在您的代码。我们已在版本1.0.4 .tgz )。

As my colleagues determined in the comments, the issue was a bug in the PayPal iOS SDK, not in your code. We've fixed the issue in version 1.0.4 (.tgz).

使用更新的库,您的代码现在应该按预期工作; prepareForPaymentUsingClientId:调用应始终是可选的(但仍建议)。

With the updated library, your code should now work as expected; the prepareForPaymentUsingClientId: call should always be optional (though still recommended).

再次感谢!

这篇关于新的PayPal iOS SDK(测试版) - 无法连接到沙箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆