Copied to clipboard

Flag this post as spam?

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


  • Ben McKean 272 posts 549 karma points
    Aug 02, 2016 @ 13:43
    Ben McKean
    0

    PayPal - get invoice key in controller

    Hi

    I'm using the build in PayPal payment gateway. I have two checkout flows in my site therefore I can't hardcode the return URL in the PayPal settings. I've set this to go to an Umbraco suface controller.

    I want to be able to get the invoice key so I can look this up in my controller and then pass it to my View.

    I can see that PayPal does return this information like this:

    ../umbraco/merchello/paypalexpress/success?invoiceKey=c4e16d7c-db24-4f94-b844-c7444f4ee59f&paymentKey=340fcc18-07d8-4321-b20d-e8833880ce88&token=EC-7RE13736NA577143J

    and then performs a 302 redirect to the value of the Return URL field in Merchello's settings.

    Is there anyway to get these values or pass these onto my controller?

    Thanks

    Ben

  • Ben McKean 272 posts 549 karma points
    Aug 03, 2016 @ 10:10
    Ben McKean
    2

    For anybody who is interested I managed to get around this storing in the invoice key in ExtendedData before I redirect the user off to PayPal like so:

    customerContext.SetValue("invoiceKey",paymentResult.Invoice.Key.ToString());
    

    I then retrieve on my view that I return the success to like :

    var invoiceKey = customerContext.GetValue("invoiceKey");
    

    Hope that helps somebody in the future

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Aug 03, 2016 @ 15:21
    Rusty Swayne
    0

    Hey Ben,

    Yep - your basically storing the value in the encrypted Merchello cookie. That's a perfect use for it. This will also help with your receipt page.

  • Simon 692 posts 1068 karma points
    Nov 24, 2016 @ 12:21
    Simon
    0

    Hi Ben,

    On which view are setting that invoice key?

    Can you be more specific please?

    Kind Regards

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Nov 28, 2016 @ 18:35
Please Sign in or register to post replies

Write your reply to:

Draft