SagePay OrderGuid lost when clicking "complete"

2 years ago
#13428 Quote
  • 1

I'm having trouble getting the SagePayServer payment and Nop One Page Checkout plugins to work together well. When the sagepay plugin shows its view (in an iframe) and I enter payment details within it, I can then click its "pay now" button for it to submit the initial transaction to sagepay.

It then returns with an OrderGuid, an example as follows:-

    <title>Sagepay Server Response page</title>
    <script src="/Plugins/Payments.SagePayServer/Scripts/jquery-1.7.1.min.js"></script>
    <div class="cols cols--white clearfix">
            <form id="sagepayPaymentInfoForm" action="/checkout/paymentinfo" method="post" target="_parent">
                    Your payment has been made.
                <p id="sagepayPleaseWait">
                    You will be automatically redirected <span id="sagepaySeconds">3</span> seconds...

                <input type="hidden" id="OrderGuid" name="OrderGuid" value="ed58e495-0463-4426-b2ec-1adbc56efb21">
                <input type="hidden" name="nextstep" id="nextstep" value="this form value is required">

                <input id="sagepayPostPaymentInfo" type="submit" value="Click to continue" style="display: none;">
                <script type="text/javascript">
                    var serialisedPaymentinfo;
                    $(function() {
                        var checkout = window.parent.Checkout;
                        var paymentInfo = window.parent.PaymentInfo;
                        serialisedPaymentinfo = $('#sagepayPaymentInfoForm').serialize();
               = function() { //Extending PaymentInfo Class
                            if (checkout.loadWaiting != false) return;
                                url: '',
                                data: serialisedPaymentinfo,
                                type: 'post',
                                success: paymentInfo.nextStep,
                                complete: paymentInfo.resetLoadWaiting,
                                error: checkout.ajaxFailure


When I then proceed to click "Complete" in the checkout page, One Page Checkout would refresh the different elements of the page as it usually does and then show again with an error/warning saying that it couldn't find the OrderGuid. At this point, SagePay has used jQuery to get the OrderGuid and it does get it successfully at first but I found that it tries to get it again and it returns with an empty/null result which is causing problems as NopCommerce will attempt to generate a new guid in OrderProcessingService.cs in the PlaceOrder function and sagepay would fail to match the new guid with the one it had originally.

The functions I've found to be hit a second time in SagePay are GetPaymentInfo and ValidatePaymentForm in PaymentSagePayServerController.cs. These functions are only hit once in the original one page checkout module in nop commerce. I assume this is related to the multiple forms on the checkout page; one for one page checkout and another within sagepay's iframe.

Please have a look at the original files for sagepay on

I am using Nop-Commerce 3.8.

Do you have any suggestions as to how I can overcome this?

Any help would be much appreciated.

Kind Regards,

2 years ago
#13433 Quote
  • Moderator
  • 271
Hello Samson,

We have a hard time getting a test account for Sage Pay so we could test the plugin for the issues you are having. Can you Submit a Ticket with Sage Pay (test) credentials so we can debug the code and see why this problem is occurring?

Also, the link you have provided us is the plugin for version 3.60. Have I missed something or have you upgraded the plugin yourself for nopCommerce 3.80?
Anton Ivanov