Copied to clipboard

Flag this post as spam?

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


  • Stephen 22 posts 195 karma points
    Oct 07, 2020 @ 11:04
    Stephen
    0

    Vendr Opayo payment process

    Hi. I am trying to implement Opayo as a payment method using the Vendr.PaymentProviders.Opayo nuget package.

    We have step in the checkout where we set the payment method against the order using order.SetPaymentMethod. Then on the next step is where we want to actually take the payment. I'm not sure what should happen here. Will the Opayo form be embedded into this page or should the user be redirected to the Opayo site for payment? I'm not sure how to trigger this next step.

    Any help is appreciated. Thanks.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 07, 2020 @ 12:48
    Matt Brailsford
    0

    Hi Stephen

    It's worth checking out the demo store to see all the recomended steps https://github.com/vendrhub/vendr-demo-store/

    Generally though, you'll want to have some kind of final review step where the customer reviews the order and on this page you need to render a form using

    @using (Html.BeginPaymentForm(Model.Order))
    {
        <button type="submit">Make Payment</button>
    }
    

    By rendering this form, it will setup the payment with the configured payment providers gateway and then clicking the submit button will redirect you to the gateway to make the payment.

    You can see this example in the demo store here https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore.Web/Views/CheckoutReviewPage.cshtml

    Hope this helps

    Matt

  • Stephen 22 posts 195 karma points
    Oct 07, 2020 @ 15:01
    Stephen
    0

    Hi. Sorry I didn't realise there was a demo site. This will help me out a lot thanks. I can get the checkout flow working now using the "Invoicing" payment option but when I use the Opayo option I am getting the following error.

    Billing last name must be provided Parameter name: OrderPropertyBillingLastName'

    I have added the following properties to the order to try and cover this. billingLastName shippingLastName OrderPropertyBillingLastName

    I have also added text in the Umbraco back end to these 2 fields in the Opayo payment provider settings.

    Order property alias: Billing Last Name and Order property alias: Shipping LastName

    but I'm still getting this error when I hit

    @using (Html.BeginPaymentForm(Model))
        {
            <button type="submit">Make Payment</button>
        }
    

    I'm obviously missing something but can't figure out what.

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Oct 07, 2020 @ 15:13
    Nik
    2

    Hi Stephen,

    For the alias's on the payment provider, you need to ensure you give the full property alias and not the name (I notice you have spaces in your examples so just wanted to check). For example:

    enter image description here

    So, it needs to be the alias of the property you are setting values to on the order, this is then used by the payment provider to extract information from the order when the payment provider is establishing the transaction with Opayo's server.

    I also believe that Opayo requires those fields so I think the payment provider validates they have data set on them before communication happens.

  • Stephen 22 posts 195 karma points
    Oct 07, 2020 @ 15:28
    Stephen
    1

    Ah I see. I wasn't sure what the alias properties were for but I can see that they map to the properties on the order now. I seem to have this working now.

    Thanks a lot.

  • Stephen 22 posts 195 karma points
    Oct 07, 2020 @ 16:09
    Stephen
    0

    When I submit the payment form I am being directed to the cancel url. Is there a way to diagnose why this would be happening?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 08, 2020 @ 08:17
    Matt Brailsford
    0

    Hi Stephen,

    Was are your configured URLs in the payment provider settings for continue / cancel?

    Matt

    PS Thanks @Nik for the really helpful reply 🙏

  • Stephen 22 posts 195 karma points
    Oct 08, 2020 @ 08:24
    Stephen
    0

    Hi.

    I currently have these set to just /cancel and /continue. I haven't done the pages for these yet. But I would expect when I hit the pay button in the form I would be redirected to Opayo. Then depending on if the payment is successful, cancelled or there is an error be returned at that point back to the relevant page. It seems I am going straight to the cancel page.

    Thanks.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 08, 2020 @ 08:28
    Matt Brailsford
    0

    What does your markup look like where you are rendering the Vendr payment form to redirect to the payment gateway?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 08, 2020 @ 08:37
    Matt Brailsford
    0

    Actually, looking at the Opayo source, it looks like the payment form defaults to going to the cancel URL here https://github.com/vendrhub/vendr-payment-provider-opayo/blob/dev/src/Vendr.PaymentProviders.Opayo/OpayoServerPaymentProvider.cs#L37 but this should get replaced when a successful initialization of a payment has occurred https://github.com/vendrhub/vendr-payment-provider-opayo/blob/dev/src/Vendr.PaymentProviders.Opayo/OpayoServerPaymentProvider.cs#L58 so it would probably appear that there is a problem initiating the transaction with Opayo.

    I'd say maybe double check your configuration and that you have the relevant API keys setup etc.

  • Stephen 22 posts 195 karma points
    Oct 08, 2020 @ 08:43
    Stephen
    0

    Ok will do. Thanks.

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Oct 08, 2020 @ 12:32
    Nik
    2

    Hi Stephen,

    The most common issues I've had are with the following:

    1. The currency not being set up in Opayo
    2. Testing with a US address and not supplying the region.

    The payment provider does log information into your Umbraco log, so it would be worth checking in there to see why it's been rejected:

    logger.Warn<OpayoServerClient>("Payment transaction aborted:\n\tOpayoTx: {VPSTxId}\n\tDetail: {StatusDetail}", request.VPSTxId, request.StatusDetail);
    

    It does the same type of entry for

    logger.Warn<OpayoServerClient>("Payment transaction rejected:\n\tOpayoTx: {VPSTxId}\n\tDetail: {StatusDetail}", request.VPSTxId, request.StatusDetail);
    

    and

    logger.Warn<OpayoServerClient>("Payment transaction error:\n\tOpayoTx: {VPSTxId}\n\tDetail: {StatusDetail}", request.VPSTxId, request.StatusDetail);
    

    This should hopefully shed some light on your issue for you :-)

    Nik

  • Stephen 22 posts 195 karma points
    Oct 08, 2020 @ 12:35
    Stephen
    101

    Hi.

    Thanks. I have literally just got this working now. I didn't have my external IP in the whitelist in Opayo.

    Thanks a lot for the help.

  • Stephen 22 posts 195 karma points
    Oct 08, 2020 @ 15:33
    Stephen
    0

    Sorry. I have (hopefully) one more question. I have it to a point now where I am being redirected back to my sites complete page once payment is taken through Opayo. In my action should I have a parameter? If not is it safe to use _sessionManager.GetCurrentOrder(store.Id) to get the order that was just placed?

    Thanks.

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Oct 08, 2020 @ 15:35
    Nik
    0

    I used a parameter to do it, but I later found out from Matt that you can get it via the GetFinalisedOrder (I forget the methods exact name), but off of the sessionManager you can get the most recently finalised order

Please Sign in or register to post replies

Write your reply to:

Draft