3

I use Omnipay paypal library. I can make a successful payment but I have problems confirming the payment status. In the response I always get PAYMENTINFO_0_PAYMENTSTATUS => Pending

Here is my purchase code - I get redirected to paypal and it's all good here:

    $gateway = Omnipay::create("PayPal_Express");
    $gateway->setUsername( $this->USERNAME );
    $gateway->setPassword( $this->PASSWORD );
    $gateway->setSignature( $this->SIGNATURE );
    $gateway->setTestMode(true);

    $params = [
      'cancelUrl'=>'http://xxxx.com/paypal_tests/cancel',
      'returnUrl'=>'http://xxxx.com/paypal_tests/confirm_paypal',
      'amount' =>  '10.00',
      'currency' => 'EUR'
    ];

    $response = $gateway->purchase( $params )->send();

    $response->redirect();

And returnUrl, where in the response I always get [PAYMENTINFO_0_PAYMENTSTATUS] => Pending:

      $gateway = Omnipay::create("PayPal_Express");
      $gateway->setUsername( $this->USERNAME );
      $gateway->setPassword( $this->PASSWORD );
      $gateway->setSignature( $this->SIGNATURE );
      $gateway->setTestMode(true);

      $response = $gateway->completePurchase( $this->session->PAYPAL  )->send();
      $data = $response->getData(); // this is the raw response object

      echo print_r($data);

Here is full response, as you can see status is "Pending".

Array
(
    [TOKEN] => EC-1RA27631NJ550530P
    [SUCCESSPAGEREDIRECTREQUESTED] => false
    [TIMESTAMP] => 2016-03-07T10:29:43Z
    [CORRELATIONID] => 8010f2af74b8
    [ACK] => Success
    [VERSION] => 119.0
    [BUILD] => 18316154
    [INSURANCEOPTIONSELECTED] => false
    [SHIPPINGOPTIONISDEFAULT] => false
    [PAYMENTINFO_0_TRANSACTIONID] => 97R504742X7344311
    [PAYMENTINFO_0_TRANSACTIONTYPE] => expresscheckout
    [PAYMENTINFO_0_PAYMENTTYPE] => instant
    [PAYMENTINFO_0_ORDERTIME] => 2016-03-07T10:29:41Z
    [PAYMENTINFO_0_AMT] => 1.44
    [PAYMENTINFO_0_TAXAMT] => 0.00
    [PAYMENTINFO_0_CURRENCYCODE] => EUR


    [PAYMENTINFO_0_PAYMENTSTATUS] => Pending


    [PAYMENTINFO_0_PENDINGREASON] => multicurrency
    [PAYMENTINFO_0_REASONCODE] => None
    [PAYMENTINFO_0_PROTECTIONELIGIBILITY] => Ineligible
    [PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE] => None
    [PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => Z6GHSVEW4KGWG
    [PAYMENTINFO_0_ERRORCODE] => 0
    [PAYMENTINFO_0_ACK] => Success
)

How to confirm that payment has been processed, confirmed and it is safe to dispatch?

Thanks!

Farside
  • 9,923
  • 4
  • 47
  • 60
bukowski
  • 1,893
  • 7
  • 34
  • 54
  • 1
    I think you must to investigate about `[PAYMENTINFO_0_PENDINGREASON] => multicurrency`: https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/ – Marcos Pérez Gude Mar 07 '16 at 12:12
  • Thanks that turned out to be the problem. Didn't even noticed that param. Thanks!! – bukowski Mar 07 '16 at 13:03

1 Answers1

2

OK, I found the problem, it is here:

[PAYMENTINFO_0_PENDINGREASON] => multicurrency

Basically my customer's test account was in US and seller's test account was charging in EUR, that's why it was pending....

And the answer is here: How do I use omnipay to check if it's a pending payment or not

Community
  • 1
  • 1
bukowski
  • 1,893
  • 7
  • 34
  • 54