Integer only Payment does not convert as expected in the Sandbox

This is the first time that I’ve tried the Square API, and I’m working on a web/mobile app for a client.

In the SandBox, I came across 2 separate issues:

  1. The Idempotency_key value is limited to 45 characters. Too short to add my own salt to that particular key, so that I can know that the transaction was not tampered with mid-flight.
  2. When I tried to submit a payment of $55.67 (USD), I got an error saying that an integer was expected. This should not be an issue in a financial tool, since fractional denominations exist all around the world. I also tried 55.60, which got shortened to 55.6. and when I put in just 55, the payment was received, but Instead of registering $55.00, it registered $0.55. And as a test, I just tried 5567, and it returns $55.67 to the dashboard, which may or may not be correct depending on the scenario. Cashiers may not remember to put in the extra zeroes for whole amounts, regardless of the type of currency

Hi @cobaltsoft, welcome to the forums!

The Idempotency_key value is limited to 45 characters,

On Square’s end, the only function of the idempotency_key is to prevent duplicate requests from being processed, so the only requirement for them is that they are unique for each different request made. There is not currently any way to exceed that character limit, but I understand that would be ideal for your use case. I’ll be sure to pass the feedback along to the team!

I got an error saying that an integer was expected.

Square’s APIs handles currencies in the base unit of the currency. For example, when working with USD, an amount of 100 is processed in cents, resulting in $1.00. Your application is expected to handle converting the amounts entered by cashiers in your interface into the appropriate amount for the API. You can read more about this in our Working with Monetary Amounts document.