Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Max 28 posts 80 karma points
    Mar 25, 2014 @ 19:17
    Max
    0

    API way to "Excecuting a pipeline on callback" with PayPal

    I have an almost pure MVC web site that is using Umbraco as a content management backend. Umbraco has uCommerce installed and we are interacting with uCommerce via it's API's from C# code.

    The purchasing pipeline includes all the "common" steps of purchase. After I am done with collecting the order details, I have a button "Peroform Payment" which is going to redirect customer to PayPal. Callback for Return is configured in paypal.config.

    The return URL, when navigated to, will trigger, my ReturnController in which I need to do the following two things:

    1. Check if the user has actually paid and not just navigated to "successful payment" url. 

    2. Mark the current order as paid for. 

    How can I achieve those two things from controller code? 

    I've followed this instructions to set up PayPal:

    http://www.publicvoid.dk/SetupUCommerceToIncludePayPalAsAPaymentMethod.aspx

    And at the end there is a section to mark the order as paid (section named "Excecuting a pipeline on callback").

    I'd like to avoid mingling with SQL directly and would like to do it in some "API" way.

    Thanks in advance for any info that could be helpful.

     

    Regards,

    Max

  • Morten Skjoldager 440 posts 1499 karma points
    Mar 27, 2014 @ 09:11
    Morten Skjoldager
    0

    Hi Max. All this should be done automatically. If you use the out-of-the-box payment provider, all you need to do is call RequestPayment so the user is redirected and the communication back and forth will be handeled for you - even the redirect to your success url, where you then can check the status of the order in terms of having the OrderGuid as a querystring parameter.

    You can modify which pipeline is run in the payment method section in the backend. Typically you would just want the checkout pipeline to be run.

    Hope that helps.

    Regards

    Morten

  • Max 28 posts 80 karma points
    Mar 27, 2014 @ 16:50
    Max
    0

    Hi. Thanks for the info.

    I've followed the instruction in this article: http://www.publicvoid.dk/SetupUCommerceToIncludePayPalAsAPaymentMethod.aspx

    In my case everything goes smoothly until I return to the store site after successfully performing payment. 

    My return parameter in paypal.config is `return="http://my-site.com/order/success/"`

    Navigation to this url triggers my custom mvc controller with an OrderGuid parameter provided by PayPal. Ok, the instructions say I need to just run this:

    `UPDATE uCommerce_PaymentMethod SET Pipeline = 'Checkout' WHERE Name = 'PayPal'`

    to have the system automatically mark the order as payed upon callback navigation. But how would uCommerce know the callback is made, it's my own controller code that processes the callback. Even if there is a mechanism to subscribe to the navigation to this url even, in my case order checkout isn't being performed. If I call it manually in controller's action code:

    `TransactionLibrary.Checkout();`

    I am getting an error `[SecurityException: Payment insufficient to cover order total for OrderGuid...`

    I see the Payment object being added (with PaymentStatus = 'AwaitingAuthorization') to the PurchaseOrder of mine with an exact ammount needed but the checkout pipeline gived the above mentioned error. What is the correct way to process the paypal call back so that it's "legit" with uCommerce.

    Regards,

    Max

  • Morten Skjoldager 440 posts 1499 karma points
    Mar 28, 2014 @ 14:52
    Morten Skjoldager
    0

    PayPal does an automatic callback to PaymentProccessor.axd which will take care of all this (that is why you set the Pipeline to Checkout where PaymentMethod is paypal (PaymentProcessor will then execute Checkout pipeline in the callback). You just need to check the OrderGuid parameter in your success url and see the orderstatus of the order and render information in the frontend based on that.

Please Sign in or register to post replies

Write your reply to:

Draft