Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set redirect to url on payment failure? #12

Open
davecosec opened this issue May 13, 2020 · 3 comments
Open

How to set redirect to url on payment failure? #12

davecosec opened this issue May 13, 2020 · 3 comments

Comments

@davecosec
Copy link

is there a way to set the redirect on payment failure?

@billythekid
Copy link

@davecosec did you work this out?

@davecosec
Copy link
Author

davecosec commented May 23, 2020

yeah, ended up editing the JS code after setting the repo to path @billythekid which is not ideal at all. Had to unminify web-payments.js then in the onToken function in the post("pay", {... call back

               if(data.status == "fail"){

                   e.complete('fail');

                   alert('Payment failed, please try another method');

               }else {

                   e.complete(data.status), state.onComplete.js && eval("const cwp = { number: '" + data.number + "' };" + state.onComplete.js), state.onComplete.redirect && (window.location = state.onComplete.redirect.replace("{number}", data.number))
                }

@billythekid
Copy link

@davecosec yeah not ideal to have to fork the repo and edit it but great to know it is possible. Would be nice to be able to pass the path as a property in the twig call or something.

Thanks so much for taking the time to respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants