Forum

Thread tagged as: Problem, Shop

PayPal Express Checkout Callback Issue?

Hi

Have Paypal set up on my Shop installation.

Now, everything seems to be ok... the customer is taken off to paypal to pay, and then sent back to my site's thanks page. The order is added correctly into the admin, the client receives the correct email to say they've paid and payment is actually taken correctly too (it's in the paypal admin panel)

BUT an incorrect message is shown on the thanks page.

On my paypal thanks page I have

    <?php
  perch_shop_complete_payment('paypal-express');

  if (perch_shop_order_successful()) {
      echo '<h1><span>Thank you for your order!</span></h1><p>We will send your order as soon as possible.</p>';
    }else{
      echo '<h1><span>Sorry!</span></h1><p>Please contact us as soon as possible so we can resolve it.</p>
    <a href="contact.php" class="button">Contact us now</a>';
    }
?>

We're getting the 'Sorry' message appearing for all successful transactions.

On the page where checkout is called we have

<?php
if (perch_member_logged_in()) {

  // your 'success' return URL
  $return_url = 'https://www.myurl.com/paypal-thanks.php';
  $cancel_url = 'https://www.myurl.com/payment-failed.php';

  perch_shop_checkout('paypal-express', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
  ]);
}
?>

Any ideas?

Nik Gill

Nik Gill 1 points

  • 3 years ago

The thanks page URL also comes through with the PayPal token and payer ID - which I'm taking as correct also

Drew McLellan

Drew McLellan 2638 points
Perch Support

What's your order status set to?

The order status in the Admin? it comes though as Paid

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's all that should be required for perch_shop_order_successful() to return true.

Is there anyway I can check why it's showing the alternative message instead? Will it show up in debug why it's doing it?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, it might. Have you looked at the debug?