我在appdelegate中使用以下代码
[PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : @"some client id"}];
使用此代码进行paypalpayment
#define kPayPalEnvironment PayPalEnvironmentProduction
- (void)viewDidLoad
{
[super viewDidLoad];
// Set up payPalConfig
_payPalConfig = [[PayPalConfiguration alloc] init];
_payPalConfig.acceptCreditCards = YES;
_payPalConfig.languageOrLocale = @"en";
_payPalConfig.merchantName = @"Anything";
_payPalConfig.languageOrLocale = [NSLocale preferredLanguages][0];
// Do any additional setup after loading the view, typically from a nib.
// use default environment, should be Production in real life
self.environment = kPayPalEnvironment;
NSLog(@"PayPal iOS SDK version: %@", [PayPalMobile libraryVersion]);
}
- (IBAction)btnPaypalClicked:(UIButton *)sender
{
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:@"5"];
payment.currencyCode = @"GBP";
payment.shortDescription = @"anything";
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.
}
// Update payPalConfig re accepting credit cards.
self.payPalConfig.acceptCreditCards = self.acceptCreditCards;
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
configuration:self.payPalConfig
delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment
{
NSLog(@"PayPal Payment Success!");
NSLog(@"%@",completedPayment);
[self saveCompletedPayment:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
[self dismissViewControllerAnimated:YES completion:nil];
}
我使用以上所有代码进行PayPal付款。 但是当我付款时显示以下错误
TRANSACTION_REFUSED - 交易被拒绝。
我的paypal帐户中有余额,但仍然收到此错误。
我还有什么遗失。
请帮我解决这个问题。
提前致谢。
答案 0 :(得分:0)
请参阅https://github.com/paypal/PayPal-iOS-SDK/issues/111的讨论。拒绝的原因很遗憾,选择的资金来源无法完成付款。请尝试使用其他资金选项。