无法与PayPal服务器通信

时间:2014-02-10 10:30:38

标签: ios paypal

更新: hideCreditCardButton在这个问题上没有任何作用,只是巧合的是,当我尝试使用无信用卡时,它对我有效,但事实并非如此。我确实工作,但只有20-30%的时间。

我正在使用PayPal iOS SDK 1.4.6。如果我使用paymentViewController.hideCreditCardButton = YES;它工作正常但如果我将其设置为paymentViewController.hideCreditCardButton = NO;我会收到服务器错误(参考图像)。

enter image description here

这是我的代码:

- (void)paypalPayment {

// Create a PayPalPayment
float paypalPrice =[youPay floatValue];
NSString* currencyCode = appDelegate.countryCurrency;
if ([currencyCode isEqual: @"INR"]) {
    float new = [[[ExchangeRate sharedManager]getExchangeRate:@"INR" toCurrency:@"USD"]
 floatValue];
    paypalPrice = paypalPrice*new;
}


PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:
[NSString stringWithFormat:@"%.2f",paypalPrice]];
payment.currencyCode = @"USD";
payment.shortDescription = @"Total Order";

[PayPalPaymentViewController setEnvironment:PayPalEnvironmentProduction];

// Provide a payerId that uniquely identifies a user within the scope of your system,
// such as an email address or user ID.
NSString *aPayerId = @"abc@msronline.in";

PayPalPaymentViewController *paymentViewController;
paymentViewController = [[PayPalPaymentViewController alloc] 
initWithClientId:kPayPalClientId
receiverEmail:kPayPalReceiverEmail
                              payerId:aPayerId
                              payment:payment
                              delegate:self];
paymentViewController.languageOrLocale = @"en";
 paymentViewController.hideCreditCardButton = NO;
[self presentViewController:paymentViewController animated:YES completion:nil];
}

2 个答案:

答案 0 :(得分:1)

戴夫来自PayPal。

这确实很奇怪。你提出viewcontroller后你会得到这个吗?今天还在发生吗?

从截图中看,SDK似乎仍在尝试与PayPal服务器建立初始连接。在这个早期阶段,hideCreditCardButton的设置不应该影响任何事情。

您使用的是为生产指定的客户端ID(而不是为Sandbox指定的客户端ID),对吗?

您是否在控制台日志中看到任何有用的内容?

答案 1 :(得分:0)

  • 我有同样的问题,并通过更改kPayPalReceiverEmail解决。

  • 如果您使用与kPayPalReceiverEmail相同的电子邮件登录PayPal来发送付款而不是此错误。

  • 我只是将kPayPalReceiverEmail电子邮件更改为另一个,我从paypal服务器获得成功回复。

它可能对你有帮助

相关问题