8

I am using Paypal SDK 2.12.3. When i made payment through Paypal, some times i got below alert while making transaction.

enter image description here

And got this in my Console: PayPal SDK: Request has failed with error: PAYER_ACTION_REQUIRED - System error (PAYER_ACTION_REQUIRED). Please try again later. (400) | PayPal Debug-ID: 982dc2baccecb [sandbox, PayPal iOS SDK 2.12.3]

Here is my code for paypal

// This method is called when user presses payment button
- (IBAction)pay {

    NSMutableArray *items = [[NSMutableArray alloc] init];
    for (NSDictionary *dictCart in arrCartData) {

        PayPalItem *item1 = [PayPalItem itemWithName:dictCart[@"name"]
                                        withQuantity:[dictCart[@"qty"] intValue]
                                           withPrice:[NSDecimalNumber decimalNumberWithString:dictCart[@"amount"]]
                                        withCurrency:@"USD"
                                             withSku:dictCart[@"badge_id"]];

        [items addObject:item1];
    }

    NSDecimalNumber *subtotal = [PayPalItem totalPriceForItems:items];
    NSDecimalNumber *shipping = [[NSDecimalNumber alloc] initWithString:[NSString stringWithFormat:@"%d",[Utility getShippingCharge]]];
    NSDecimalNumber *tax = [[NSDecimalNumber alloc] initWithString:@"0.00"];
    NSDecimalNumber *total = [[subtotal decimalNumberByAdding:shipping] decimalNumberByAdding:tax];

PayPalPaymentDetails *paymentDetails = [PayPalPaymentDetails paymentDetailsWithSubtotal:subtotal
                                                                               withShipping:shipping
                                                                                    withTax:tax];
    PayPalPayment *payment = [[PayPalPayment alloc] init];
    payment.amount = total;
    payment.currencyCode = @"USD";
    payment.shortDescription = @"Badges";
    payment.items = items;  
    payment.paymentDetails = paymentDetails;

    self.payPalConfig.acceptCreditCards = YES;
    PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
                                                                                                configuration:self.payPalConfig
                                                                                                     delegate:self];
    [self presentViewController:paymentViewController animated:YES completion:nil];
}

// This method is called from viewDidLoad
- (void)setupPaypalConfig
{
    _payPalConfig = [[PayPalConfiguration alloc] init];
    _payPalConfig.payPalShippingAddressOption = PayPalShippingAddressOptionPayPal;
    [PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox];
}
AllianceTek
  • 201
  • 2
  • 6

0 Answers0