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.
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
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.
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
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:
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.
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.
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.
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?
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
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.
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
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
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
I'm obviously missing something but can't figure out what.
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:
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.
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.
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?
Hi Stephen,
Was are your configured URLs in the payment provider settings for continue / cancel?
Matt
PS Thanks @Nik for the really helpful reply 🙏
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.
What does your markup look like where you are rendering the Vendr payment form to redirect to the payment gateway?
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.
Ok will do. Thanks.
Hi Stephen,
The most common issues I've had are with the following:
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:
It does the same type of entry for
and
This should hopefully shed some light on your issue for you :-)
Nik
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.
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.
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
is working on a reply...