What to do when Charge status is declined or pending?

Hi Guys,

When someone’s charge is pending or declined then in that case i am checking and if status is not active then i am redirecting it to confirmation URL but it’s not working and giving Redirected too many times error.

What to do in this case ?

I am using CLI 3 Node JS template.

Any help would be really appreciated