Developer forum

Forum » Development » CheckOutDone and SetOrderComplete

CheckOutDone and SetOrderComplete

Per Ljung
Reply
Hi!

Have two quick questions:

If I understand right, CheckOutDone shall always be called in a custom checkouthander, no matter if there is some error or everything succeeded.

And SetOrderComplete shall only be called if, for example, there were no errors in the payment transaction to the external provider? Shall not be called unless everything is fine.

An uncompleted order is marked with red text in the order list in the Ecom module?

Best regards,
Per

Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Per

You use CheckoutDone to tell CartV2 that you (the CheckoutHandler) has finished and you don't want to control the next step. This is usually done after a callback from an external provider or if a "Cancel" state is returned from the provider. You use SetOrderComplete to set all the properties on the order object that indicate that payment succedeed.

Consider this example:
You POST a user to your external providers system. You then receive a callback from your provider. You verify that everything is ok, invoke SetOrderComplete and tell CartV2 that you're done by invoking CheckoutDone. The cart will then take over and do whatever it needs to do and then the callback request ends. Usually the external provider will then redirect the user back to the cart. At this point your Redirect method is invoked again. If you need to do some more validation on the order, you can, otherwise simply invoke the RedirectToCart method to tell the cart that you're done and the flow can continue.

Hope this helps :)

- Jeppe

 

You must be logged in to post in the forum