redirect in PostProcessPayment IPaymentMethod

Monday, November 25, 2024 6:52:36 PM
  • 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
  • 152
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