Build Payment Plugin_How to build a Url in PaymentProcessor.cs file

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi everyone!

I'm creating a Payment plugin and currently I need to build a Url in PostProcessPayment(This function is for redirect after process checkout) function (for redirect back to my own Controller).

If this is inside controller, I can use the below to build a Url by using @Url.
Url.Content("~")) + Url.Action("HandlePaymentResponse", "abc");

But here is in PaymentProcessor.cs file. So is there another way to create url here ?
I tried to inject the IUrlHelper here in PaymentProcessor.cs constructor but it look not allow to do this.

Thanks for all help in advance!
4 years ago
In am not sure exactly what you want to do ?

Normally URL's are setup in the configuration and settings and so they don’t need to be built
When building a new Payment Plugin it should just be the case of looking at existing plugins like PayPal Standard or the others to see how things have been done previously

Can you clarify what and why you need to do it
4 years ago
Hi,
i think you are trying to create callback url for a third party payment website.

Here is the solution:

string callBackUrl = _webHelper.GetStoreLocation().Trim() + "PaymentHandler/PaymentResult";


have a nice day.
4 years ago
Thanks a lot, everyone.
A callBack url was what I need.

Thanks again!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.