I’m sending a payment confirmation email to customers (currently in sandbox) for their payment. I have a mailer function added to process-payments.php and I am calling it if $response->isSuccess() just before the echo json_encode($response->getResult());. Here is the code snippet:
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The issue might be due to the sendConfirmationEmail() function. If this function is causing an error or exception, it could prevent the success message from being displayed. To debug this, you could try commenting out the sendConfirmationEmail() function call and see if the success message appears. If it does, then the issue is likely within the sendConfirmationEmail() function. You should then debug this function to find the exact cause of the issue.
Thanks. I found the issue. I had copied another email function that was part of a php ajax call anf it had an echo at the end, so that was overriding the echo for the success message. Everything is good now.