Checkout API how can a customer cancel after redirected to Checkout

Hello,
I am building a web app, using Checkout API I create a checkout and redirect user to checkout_page_url

But when the customer is on checkout page which is typically
https://connect.squareupsandbox.com/v2/checkout?c=CBASENIc79eNx6PdArKd5UAul0c&l=LSGEVNXPAP82B

they do not have option to gave up. I would expect a CANCEL button which redirects to my app.
Back button kills my SPA.

How do you guys handle this problem.

Cheers

Hi @adilatilgan welcome to the forums!

Unfortunately, you are correct, there is no way to really “cancel” the payment once they’re redirected to the checkout API. They can either hit back, or just close out of the page at that point, but there is no way to be redirected back to your web page without paying.

If you want to create a better flow, I would suggest looking into the Square Payment Form, which allows you to fully have it embedded in your own site, so you can control everything that happens. As for the original request, I will update this to be a feature request since it doesn’t technically exist.

the addition of a cancel or back button would be extremely helpful in Square hosted checkout.
both stripe and paypal allow this on their hosted checkout pages
and return either a success_url/return_url for successful charge
or a cancel_url when cancel/back button is selected.

We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. :slightly_smiling_face: