redirect in PostProcessPayment IPaymentMethod

Friday, April 19, 2024 7:01:56 AM
  • Posted: Sunday, September 15, 2019 4:21 PM
  • 41
hi i try make a payment plugin
i use   IHttpContextAccessor
for redirect to payment page but this is not work and don't redirect to payment page
i try redirect to google.com but can't do it
public async Task<ProcessPaymentResult> ProcessPayment(ProcessPaymentRequest processPaymentRequest)
        {
            var result = new ProcessPaymentResult();
            result.NewPaymentStatus = PaymentStatus.Pending;
            return await Task.FromResult(result);
        }
        public async Task PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {
            var total = Convert.ToInt32(Math.Round(postProcessPaymentRequest.Order.OrderTotal, 2));
           string urlToRedirect = "http://www.google.com";
        
                _httpContextAccessor.HttpContext.Response.Redirect(urlToRedirect);
                return;

        }

plz help me thx
0
  • Posted: Monday, September 16, 2019 8:15 AM
  • Team
  • 150
Hi,
In method PostProcessPayment remove line "return".

Method PaymentMethodType should be set like this:

public PaymentMethodType PaymentMethodType {
  get { return PaymentMethodType.Redirection; }
}

Regards
Krzysztof
1
back to top
Filters