Im using your checkout api but there is only redirection for success but ideally there should be two redirect urls one for success and other one for failure how am supposed to handle that?

"checkout_options": {
  "redirect_url": "www"
}

If a payment fails the customer will not be redirected but shown an error on the Square hosted page. They’ll be able to reattempt he payment or enter a different payment method till the payment is successful. :slightly_smiling_face:

okay and how do I test payment with testing credentials ? because i want to save the payment log after successful payment in the db for that I need to work on consuming the response after payment

It’s not possible at this time to test the redirect in sandbox with the payment links. You’ll have to use production to test at this time. :slightly_smiling_face: