Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Espin 368 posts 1335 karma points
    Jan 13, 2015 @ 14:42
    Jason Espin
    0

    Base vs Surface Controller for payment processing Umbraco 7.2

    Hi all,

    Sorry if this is the wrong place to ask this but I was looking for some advice regarding the best methods to use for payment processing in Umbraco. So far, I have only built brochure sites for our clients however we have a huge project coming up that will require the ability to process payments on top of just displaying the products that our client offers.

    I'm still relatively new to .Net and MVC despite having completed the Umbraco level 2 certification last year but what I want to achieve is a multistage checkout procedure that does the following:

    • User clicks the 'check availability' button on a product. This should fire a web service call to the servers of our software product before refreshing the page with Ajax so that a 'Buy' button is displayed if the product is available and an 'unavailable' message is displayed if the product is not.

      • Upon clicking the buy button, the user will be redirected to the payment provider we choose to use e.g. Paypal and the payment side of things will be handled there. Once the payment is complete, the user should be redirected back to the product page where they are informed their payment has been processed. A web service call should then be passed in the background that sends a message to our software to decrement the availability by one.

    From my understanding of Umbraco there are two main ways of doing Ajax calls (and therefore triggering the necessary web service calls required in this process) in Umbraco. Base or using a surface controller however neither of these methods are outlined in a means that is understandable to someone who is new to .Net unless I am missing something.

    Does anyone have any suggestions?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 13, 2015 @ 16:50
    Jeroen Breuer
    0

    Base is legacy code and will be removed in v8: http://issues.umbraco.org/issue/U4-5484

    You should try a SurfaceController or WebAPI.

    Jeroen

  • Jason Espin 368 posts 1335 karma points
    Jan 13, 2015 @ 17:59
    Jason Espin
    0

    Hi Jeroen,

    Thanks for the additional information, I wasn't aware of the WebAPI method and it actually looks (initially) like it would be a lot easier to implement than a surface controller method driven by forms. I am assuming that the WEBAPI controller that is created is just placed under the controllers folder like a surface controller would be?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 13, 2015 @ 18:02
    Jeroen Breuer
    0

    Yes you could just place the WebAPI controller in the controller folder. They just need to inherit from the correct controller which you can find in the documentation.

    Jeroen

  • Jason Espin 368 posts 1335 karma points
    Jan 13, 2015 @ 18:25
    Jason Espin
    0

    Great, thanks!

    So from what I can gather so far, when I click my button to check availability, I can fire an Ajax call to my WebAPI controller method which will return some json relating to whether or not the product is available. Thinking about it though, this would leave me a little bit stuck as I would then need to redirect the user to page where they can fill out their details that is only accessible if the first stage confirms that a place is available. With this in mind, it might be better to use a surface controller and enclose the initial button in a form. Am I thinking along the right lines?

Please Sign in or register to post replies

Write your reply to:

Draft