API Example Not Working

I am trying to integrate the new API and having 0 luck. Just get a “charge failed”. Is there any way to see exactly what is failing. I am using the sandbox to integrate into the API.


:wave: Yes, with our API Logs you can see the error messages that Square returns for failed payments. :slightly_smiling_face:

Can you point me to a document that would explain how this is done please.

Yeah, here is the documentation for the Web Payments SDK. :slightly_smiling_face:

how do I get the failed transaction to show up in the error logs. The only option I see is for checkout

in the example code it mentions…

const paymentResponse = await fetch(’/payment’, {

So it is looking for a response from some server code, was this not included in the example because I can not find any references to it.

That /payment function is the server side call that is included in the server.js in our quickstart. You’ll need to take the source_id that is generated from the Web Payments SDK and pass it to the server side CreatePayment request. :slightly_smiling_face:

Thanks for sharing this info this is useful keep it up.