paypal status is pending

2020-06-06 02:24发布

问题:

hello everyone in my application i have to use Paypal for Norway currency(NOK) and everything is fine but when i used sandbox for testing the Paypal the state comes as pending while when i tried the same code for US Dollars the state is approved why this happening. Here is my code and response

  @try
   {
    self.resultText = nil;
    NSUserDefaults *defpay=[NSUserDefaults standardUserDefaults];
    NSString *mon=[defpay objectForKey:@"month"];

    app *ap=[app new];
   dictpay=[ap paypal:mon category:_strcategoryid1 catid:_strpostid1];
    NSString *strprice=[dictpay objectForKey:@"price"];
    _lbl.text=strprice;
    NSLog(@"%@", _lbl.text);

    PayPalPayment *payment = [[PayPalPayment alloc] init];
    payment.amount = [[NSDecimalNumber alloc] initWithString:strprice];
     //payment.amount = [[NSDecimalNumber alloc] initWithString:@"12"];
    payment.currencyCode = @"NOK";
    payment.shortDescription = @"Payment";

    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;
    paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
                                                                   configuration:self.payPalConfig
                                                                        delegate:self];

    // Present the PayPalPaymentViewController.
    [self presentViewController:paymentViewController animated:YES completion:nil];


  }
   @catch(NSException *e)
    {
        NSLog(@"%@",e.reason);
    }

Here is the response which i got for NOK

     client =     {
         environment = sandbox;
         "paypal_sdk_version" = "2.0.5";
          platform = iOS;
        "product_name" = "PayPal iOS SDK";
            };
            response =     {
       "create_time" = "2014-04-30T05:43:49Z";
       id = "PAY-7DX14671UN8535156KNQI3FI";
        intent = sale;
        state = pending;
        };
        "response_type" = payment;
       }  

回答1:

I had the same issue, the problem is the buyer is buying buy using a currency which is not the default currency of the seller, and by default paypal set something like manually approve different currencies, as they have conversion fee.

Login to your sandbox account, and click on profile then choose My Selling Preferences and on that page click on payment receiving preferences. And there choose

Allow payments sent to me in a currency I do not hold Yes, accept and convert them to blabla

After this your tests will be back to normal and they will be approved too

Screenshots for settings:

Dont forget to save your settings after changing :)



回答2:

UPDATE

The answer that @stephanruhl provided is correct but the PayPal made some changes and those who are not finding useful its instructions follow the steps below.

Answer

To make this payment with status completed we need to login to your PayPal Account go to My Account -> Profile -> My Selling Tools -> (Getting paid and managing my risk) Block payments and hit update:

The following screen will pop up:

Scroll to the section Allow payments sent to me in a currency I do not hold and select YES

By doing this you will be able to automatically confirm your payments without reviewing each one (Remember: Payment Review must be disabled). If haven't disabled yet the Payment Review the follow these steps:

Under http://developer.paypal.com go to your Application. Click on Sandbox accounts and choose your business email, click on Profile link. Select Setting tab, and turn off Payment review. You shall get Approved status of PayPal Payment and Completed Sale JSON object. (Original Post: Paypal Sandbox payment state pending)

Hope it helps :)