问题描述
更新:hideCreditCardButton
在此问题中没有任何作用,这只是一个巧合,当我尝试不使用信用卡对它有用时,情况就不再如此了.工作,但只有20%到30%的时间.
Update: hideCreditCardButton
has no role in this issue, it was just a coincident that when I tried it w/o credit card it worked for me but thats not the case anymore.I does work but only 20-30% of the time.
我正在使用PayPal iOS SDK 1.4.6.如果我使用paymentViewController.hideCreditCardButton = YES;
可以正常工作,但是如果将其设置为paymentViewController.hideCreditCardButton = NO;
则会收到服务器错误(参考图像).
I am using PayPal iOS SDK 1.4.6. if I use paymentViewController.hideCreditCardButton = YES;
it works fine but if I set this to paymentViewController.hideCreditCardButton = NO;
I get the server error (ref. to image).
这是我的代码:
- (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 = @"[email protected]";
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];
}
推荐答案
从PayPal离开.
那确实很奇怪.呈现ViewController后,您会立即获得此信息吗?今天还在发生吗?
That's indeed weird. You're getting this as soon as you present the viewcontroller? Is it still happening today?
从您的屏幕截图看来,SDK仍在尝试与PayPal服务器建立初始连接.在此早期阶段,hideCreditCardButton
的设置应该不会影响任何内容.
From your screenshot, it looks like the SDK is still trying to get an initial connection with the PayPal server. At this early stage, the setting of hideCreditCardButton
shouldn't yet affect anything.
您使用的是为生产指定的客户端ID(而不是为沙盒指定的客户端ID),对吗?
You are using the Client ID that's designated for Production (as opposed to the Client ID designated for Sandbox), right?
您在控制台日志中看到任何有用的信息吗?
Do you see anything helpful in the console log?
这篇关于无法与PayPal服务器通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!