I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
(I even added an itemType of ITEM and that didn’t help my issue
When I download the order from square, the old code has the line items correctly, the new API does not have the name or note in it. It has ‘Custom Amount’ instead.
the composer line that works with the old code is:
“name”: “square/square”,
“version”: “40.0.0.20250123”,
the one that doesn’t with the new code is:
“name”: “square/square”,
“version”: “41.0.0.20250220”,
I am running this in several sites:
the log file I sent you was from seattle’s site:
appid=“sq0idp-kOcJS–olIdktCPyTbMZDA”
Philadelphia’s site is:
appid=“sq0idp-wCxxyX3NcpGkf4FkTAGw4Q”
In seattle, this is an example of the older 40 api code working: (downloaded from the square site as an orders file)
Name field: all Membership for Mia
Note field: 606,n4410: memId, p/n id
API 41: Not working:
Name field: Custom Amount
Note field: Online payment from portal
The note field is the correct value for the note on the Order (not the order Item).
A section of the var_dump from the order object showing the order line item section of that not working one above:
[uid:Square\Types\OrderLineItem:private] => badge1
[name:Square\Types\OrderLineItem:private] => all Membership for
[quantity:Square\Types\OrderLineItem:private] => 1
[quantityUnit:Square\Types\OrderLineItem:private] =>
[note:Square\Types\OrderLineItem:private] => 606,n4500: memId, p/n id,
having found (again) the developer sandbox, It looks like it’s not getting the order line items, even though it looks to me like I’m passing it correctly.
(PS: in my test environment I just switched from v41 to v42, just to see if that makes any difference).
What I really wish the docs had (and I can’t seem to find it), is the translation of the api element name to the php element name, like applied_money => appliedMoney. Guessing that it’s always alpha_beta_gamma => alphaBetaGamma is likely to be wrong somewhere.
I have to do a grep of all the PHP files in the SDK to try and find the mappings.
to test if the line items are in the order, I added the following line after doing a “new order” …
$testLineItems = $order->getLineItems();
and it returned
Square\Types\OrderLineItem Object
(
[__additionalProperties:Square\Core\Json\JsonSerializableType:private] => Array
(
)
In converting from v40 to v41, a line got in the wrong place on the cut/paste and I totally missed seeing it. So the order wasn’t being attached to the payment. Alas the new API doesn’t complaing about the order id being in the amountMoney not the body.
Moving the line solves the issue. I see it correctly now in the dashboard.
So your going to have sellers create and configure an application in there Developer Console? That’s not ideal and we would rather recommend OAuth. However if you do take this approach each application that’s created in the Developer Console will automatically go to the latest API version.
If you need your application to be set to a specific version you can include the Square-Version in the header of your API requests and that will override the version set in the Developer Console.
actually they have the application in their website. We are a freely redistributable application. We don’t run it ourselves. Each organization that uses it, clones the github repository, and installs it on their own web server, sets up their own database, locations, and tokens. We don’t have a server on which we ‘run’ it except for demo and development test (and that doesn’t have a square account). Each site creates it’s own test and production instances and configures it with their own square accounts.
(We don’t even have a record of everyone who is using the application).
Welcome to the open source software world. (ConTroll is developed entirely by volunteers).
That you for the help and I’ll look to add Square-Version to the PHP api call, (we use the PHP SDK).