Relevant information:
I am using aws lambda and apigatway to listen for the POST request from square after a completed transaction.
As of right now, I am able to go into my web app, complete a form and be successfully sent to the square POS app to complete the transaction.
The problem is, once the transaction is complete and I tap the success screen, my callback_url seems to get opened in the web browser with a query string of data, and no POST request ever gets sent to my api. (based on the aws logs)
I have tested this api manually using a cURL and I get logs in aws and the response I am expecting.
Is there something I am missing to be able to get this POST request to get sent to my endpoint?
What’s the query string of data that your getting back from Square? Is it the documented response with the transaction_id
in it?
Hi Bryan,
yes, it’s what is documented as the expected response with transaction_id, client_transaction_id, status, etc.
Okay, then this is behaving as expected. Any additional POST once the data’s received will be functionality you’ll need to add to your application.
Am I misunderstanding the docs? I was expecting the square app to send a post request directly to my endpoint. All it actually does is navigate to that endpoint.
Should I have it navigate to a some kind of ‘success’ screen on my web app? From there I can capture the response and make my own POST request as needed?
Can you let me know if this is correct:
-
User fills out form in web app and hits ‘pay’
-
Web app sends user to Square POS app with the data
-
User completes payment
-
Square POS app navigates to the ‘callback_url’ and opens it in the ipad browser
OR
-
Square POS app sends POST request to the ‘callback_url’
I guess the question is, should the callback_url be my web app’s address? or should it be the endpoint I have set up in aws?
The POST parameters provide information about whether the associated transaction succeeded or failed along with its accompanying metadata. Any additional actions or writes to you database will be something you’ll need to add.
So with that in mind, should I set my callback_url to my actual app url success screen or something? Because as of now, no POST request is being made to my aws route.