Square APIs and Xojo


Has anyone been successful on implementing Square APIs such Payment or Terminal? Is this something that is possible in Xojo. I did some experimentation with a couple of apps. I used Xojo to make a restful api (using the urlconnection object) to Square sandbox environment and i received an authentication error: “This request could not be authorized”. I then used webstorm api window to call the same endpoint and it worked with 200 and data. Why would Xojo call to the endpoint fail but not webstorm? Any ideas?


It could be a missing or incorrect header in the URLConnection.


There are some API examples showing how to connect to a restful API included in Xojo’s example projects. (see below) They might be a good place to start. :grinning:



I had my code wrong…I was calling the URLConnnection.send first and then adding the URLConnection.RequestHeader. I inverted the code (added the headers first and then the send method) and it worked.

So sorry for wasting your time.

1 Like