x

Square Connect API is not responding properly

I am a .net developer and I am using Square connect API but

Square connect API is not working properly.

I am using sandbox application ID and Sandbox Accesss Token for my testing.

With different card-nonce, different value of money or amount , it is giving same transaction as response. Even for different transaction type like "delay_capture", "true" and "delay_capture", "False".

Is there problem in API. 

Tags (1)
3,445 Views
Message 1 of 4
Report
3 REPLIES 3

Did you ever get this working? I'm a .NET developer trying to write some code to use the Square API for an application and I'm just getting started and there doesn't seem to be many resources available other than this example which isn't written in .NET:

 

https://docs.connect.squareup.com/articles/processing-payment-rest/

 

I also need to figure out how to obtain the card token (what Square calls a card_nonce) in JavaScript and then send that back to the VB server and charge it from there using the APIs.

 

Any help or snippets you could provide would be GREATLY appreciated and I will gladly help as best as I can as well.

3,438 Views
Message 2 of 4
Report
Square

Great questions, though I'd love to help you out with this we have a few people who may be more knowledgable regarding our API's and troubleshooting. if you haven't figured these questions out yet, feel free to visit our developers Twitter page or shoot them an email at developers@squareup.com. 

 

 

3,415 Views
Message 3 of 4
Report
Square

Just to close the loop here, I did want to publish what we were able to sort out offline. 

 

It looks like there were two issues here:

 

1. A HTTP GET request was being used instead of a POST request when calling 
https://connect.squareup.com/v2/locations/CBASEFXLqO9ll9Y7O8qJcy5r0jA/transactions

(Refer to this page for more info on endpoint names are return values: https://docs.connect.squareup.com/api/connect/v2/#endpointnamesandreturnvalues)

 

2. There was passing endpoint parameters in the Header, but there should be providing parameters as JSON in the body of the request.

(Refer to this page on providing parameters: https://docs.connect.squareup.com/api/connect/v2/#providingparameters)

 

The same transaction data was currently being returned by all of the requests because of submitting a HTTP GET request to the ListTransactionsendpoint:

System.Net.Http.HttpResponseMessage response = await client.GetAsync(uril);

To charge, you should submit a POST request. Additionally, the parameters should be included as JSON in the body of the POST request, not the request Header.

 

From what else I was able to deicper, it's also important to include an Authorization header in the request, and to make sure you are looking at the specific error message in the 400 response.

 

@UnifirmMarket - Please correct me if any of the details above don't make sense, you're certainly more of an expert on this than me. 😊

 

 


Sean
he/him/his
Product Manager | Square, Inc.
3,405 Views
Message 4 of 4
Report