Forum

Thread tagged as: Problem, Shop

Paypal return url

I just had a customer place an order using Paypal but they were shown the error message instead of the success message on the return URL. The payment went through fine, all the emails were successfully received (from paypal and perch) but the customer was shown the failed error message. This isn't happening for all customers (it's safe to assume) as we've had other Paypal payments come through and those customers haven't notified us of the error message. I also had no similar issue when testing the system before go live. So I'm wondering how I can investigate this particular case to ensure it doesn't happen again?

Here's the code I'm using on the return URL:

<?php 
    include($_SERVER['DOCUMENT_ROOT'].'/admin/runtime.php');
    perch_layout('header', array(
        'title' => "Your order - ESLstarter",
    ));
?>


<div>
    <div class="wrap wrap--large">
        <h1>Your order</h1>
   </div>
</div>


<div class="clear">
    <div class="wrap wrap--small">

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

        if (perch_shop_order_successful()) {
        echo '<h2>Thank you for your order!</h2>
        <p>We have successfully received your payment from Paypal. You should receive a confirmation email shortly. Please take a moment to like us on Facebook and sign up for our newsletter (see footer below).</p>
        <p><a href="/">Back to homepage</a></p>';
        }

        else{
        echo '<h2>Sorry, we encountered a problem with your order. You have not been charged.</h2>
        <p>If you accidentally cancelled the order you can go back to <a href="/pay/confirm">the cart</a> and try again. If you need help then please email us and one of our staff will be in touch as soon as possible. Include in the email your name, what you were trying to order and what happened.</p>
        <p>You can also call us on <strong>0800 338 8038</strong> (Mon-Fri 9am-5pm).</p>';
        }

        ?>

    </div>
</div>


<?php 
    perch_layout('footer', array(
        'hide-social' => true,
    )); 
?>
Stephen Turvey

Stephen Turvey 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Without being able to reproduce it, it's hard to say for sure.