0

当我选择沙盒环境时,我收到一条警告消息,提示“我们很抱歉,与 PayPal 的服务器通信时出现问题”。下面给出了我的代码和屏幕截图。

- (IBAction)pay {

  // Remove our last completed payment, just for demo purposes.
  self.completedPayment = nil;

  PayPalPayment *payment = [[PayPalPayment alloc] init];
  payment.amount = [[NSDecimalNumber alloc] initWithString:@"9.95"];
  payment.currencyCode = @"USD";
  payment.shortDescription = @"Hipster t-shirt";

  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 = @"user-11723";

    // 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 = !self.acceptCreditCards;

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

   }

在此处输入图像描述

4

1 回答 1

2

@chetu,请访问https://github.com/paypal/PayPal-iOS-SDK并下载 1.1.0 版本的 PayPal iOS SDK。(请务必阅读 release_notes.md 文件,了解您可能需要对链接器标志进行的项目更改。)

安装较新版本的 SDK 后,请再次运行上述代码。现在检查控制台日志——那里应该有一些关于从服务器返回的特定错误的额外细节。

如果您可以在此处复制并粘贴这些详细信息,我们应该能够确定您的困难来源。

Dave Goldman
card.io / 贝宝 / 易趣

于 2013-07-16T00:20:08.023 回答