Cutting out Payment Selection Screen & How orders work

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hi all,

We are using the sage pay module t take pment ayments and only this module. Is it possible to simply bypass the select payment screen quickly and easily?

also, we are going to look at integrating their server side method whereby it will pass back confirmation of the payment once it has been completed and then deduct from the stock, place order in db as paid, etc.

any ideas how we can do this?
13 years ago
Hi,

Regarding your second question, we have developed a number of payment gateways that have some kind of automated payment confirmation (like PayPal ITN, Nochex APC etc.).

When you redirect the customer to the payment page you also pass your confirmation url. We typically create these as HttpHandlers e.g. http://www.youstore.com/paymentconfirm.ashx.

Your payment gateway will then post the results of the transaction to this url. Often you will need to post the data back to them as an additional security step.

It is also a good idea to check the hostname and ip address of the poster to ensure that this has come from your payment gateway.

Once you have done this and you can see the transaction is successful you can update your order as paid.

HTH

Ben
13 years ago
Hi Thanks for that the validation.

Initially what we are going to do is effectively cut out the checkoutpaymentmethod.aspx and checkoutpaymentinfo.aspx and simply redirect to the checkoutconfirmorder.aspx page, informing that after confirming the order they will be redirected to the sagepay page.

One thing i have noticed after looking through the code is that through out there is a OnePageCheckout bool. What is this one page cart?

Thanks again for the reply.
13 years ago
Go to global settings on your site and enable one page checkout.

Then go to your checkout - all will become clear :)

Basically that is what it is checking in code
13 years ago
Hi,

thanks for tht. Yes you were correct! it did all become clear.

Ok, I've modifyed the code in checkoutshippingmethod.aspx so tat it will cut out checkoutpaymentmethod.aspx and checkoutpayment.apsx and simply go straight to the checkoutconfirm.aspx page.

This is working. However I must be missing something as when it reaches the order confirm page instead of the redirecting to the sage pay portal it is simply ging to the order complete page.

can you please tell me what i'm missing out? heres the code i have changed in the next button click on the checkoutshippingmethod.aspx page

        protected void btnNextStep_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                var shippingOption = this.SelectedShippingOption;
                if (shippingOption != null)
                {
                    NopContext.Current.User.LastShippingOption = shippingOption;
                    var args1 = new CheckoutStepEventArgs() { ShippingMethodSelected = true };
                    OnCheckoutStepChanged(args1);
                    if (!this.OnePageCheckout)
                    {
                        //was simply redirecting to take the payment etc
                        //but we wan tto cut this out
                        //Response.Redirect("~/checkoutpaymentmethod.aspx");

                        //id 38 = sagepay
                        //hardcode the payment method (caught @ checkoutpaymentmethod.aspx
                        NopContext.Current.User = CustomerManager.SetLastPaymentMethodId(NopContext.Current.User.CustomerId, 38);

                        //next set the paymentinfo
                        //set @ checkoutpaymentinfo.aspxment
                        Control child = base.LoadControl(NopContext.Current.User.LastPaymentMethod.UserTemplatePath);

                        if (child is IPaymentMethodModule)
                        {
                            IPaymentMethodModule temp = (IPaymentMethodModule)child;

                            PaymentInfo paymentInfo = temp.GetPaymentInfo();
                            paymentInfo.PaymentMethodId = NopContext.Current.User.LastPaymentMethodId;
                            this.PaymentInfo = paymentInfo;
                        }

                        //set the payment info as entered (not sure we need to do this may be able to just change args1?)
                        var args2 = new CheckoutStepEventArgs() { PaymentInfoEntered = true };
                        OnCheckoutStepChanged(args2);

                        //then simply redirect to the checkoutconfirm.aspx page
                        Response.Redirect("~/checkoutconfirm.aspx");
                    }
                }
            }
        }
13 years ago
Ok, I've managed to work out a little more about whats going on.

After debugging if found that it seems to be marking the order as being paid?. So i physically marked the order and being pending, which then redirected to the sagepay screen for me.

However I then get an error saying the basket was invalid?

I assume then I am not getting the basket infor correctly?

any ideas what I'm doing wrong here?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.