Developer forum

Forum » Development » Checkouthandler waiting template

Checkouthandler waiting template

Reynir Viðar Ingason
Reply

Hey there,

I am working on a checkouthandler and am having a bit of an issue.

The flow I am working with is as follows:

1. start checkout: render a template with and input field in a form that then gets posted.
2. redirect: Identify redirect via request parameter. post a create order to payment gateway. This response with a status OK if all goes well. We then render a waiting template for the user.
    The waiting template has a js timout function that posts another form to the redirect method if it expires.
3. redirect: if the user accepts the payment on the mobile device a callback is made by the payment gateway to the checkouthandler. We identify this callback with a request parameter and proceed to validate the request. If all goes well the order is completed via CheckoutDone, we post a receipt to the gateway, we call RedirectToCart.
4. At this point I would like the user to be redirected to the cart but it appears the callback is not running in the same context or session as the user. At least the redirect to cart method does not appear to have any effect when run during the gateway callback.

 

I feel like I am missing something here and am having a bad time figguring it out.
Any advice would be greatly appreciated.

Reynir


Replies

 
Nicolai Pedersen
Reply

Hi Reynir

Most checkouthandlers have multiple URLs that nees to be specified for the callbacks - the callback URL which is server-to-server with the result of the payment. Then you have a cancel and accept url for if the user either does not get through the payment or everything goes smooth.

The callback is server-to-server and the accept url will redirect the user browser to the receipt if payment is ok. Cancel of course back to the cart.

But all these gateways have different ways of working. Feel free to post some code pieces if you need an eye on it. You are also very welcome to get the source code to the gateways we have developed to see if there is anything interesting.

BR Nicolai

 
Reynir Viðar Ingason
Reply

Hey there,

 

I have resolved this issue by chaning the pattern used to wait.
I.e. not using one template to display a waiting state and another one to gather post information.

Instead I just display one template and switch the view in JS.

But to elaborate on the issue:
During a callback from the payment gateway server a different session is in effect. This results in us not being able to affect the interface being displayed to the user.

Reynir
 

 
Nicolai Pedersen
Reply

Great - glad you made it work!

 

You must be logged in to post in the forum