Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1326

How to parse the result from getOrders

$
0
0

Hello,

below is an example of list locations from the dev site and from my live site. I am using the php sdk and trying to figure out how to get a JSON response like the site shows. I feel like this should obvious.

When running queries on the site they return normal json response

{
  "locations": [
    {
      "id": "L12H47G7MB9CV",
      "name": "Default Test Account",
      "address": {
        "address_line_1": "1600 Pennsylvania Ave NW",
        "locality": "Washington",
        "administrative_district_level_1": "DC",
        "postal_code": "20500",
        "country": "US"
      },
      "timezone": "UTC",
      "capabilities": [
        "CREDIT_CARD_PROCESSING",
        "AUTOMATIC_TRANSFERS"
      ],
      "status": "ACTIVE",
      "created_at": "2024-09-09T00:39:56.529Z",
      "merchant_id": "ML2FMC6D5MT66",
      "country": "US",
      "language_code": "en-US",
      "currency": "USD",
      "business_name": "Default Test Account",
      "type": "PHYSICAL",
      "business_hours": {},
      "mcc": "7299"
    }
  ]
}

but when running them via the SDK getting a totally different reponse

object(Square\Models\ListLocationsResponse)#176 (2) {
  ["errors":"Square\Models\ListLocationsResponse":private]=>
  NULL
  ["locations":"Square\Models\ListLocationsResponse":private]=>
  array(1) {
    [0]=>
    object(Square\Models\Location)#179 (27) {
      ["id":"Square\Models\Location":private]=>
      string(13) "xxxxxx"
      ["name":"Square\Models\Location":private]=>
      array(1) {
        ["value"]=>
        string(25) "xxxxx"
      }
      ["address":"Square\Models\Location":private]=>
      object(Square\Models\Address)#245 (14) {
        ["addressLine1":"Square\Models\Address":private]=>
        array(1) {
          ["value"]=>
          string(13) 'xxxxx"
        }
        ["addressLine2":"Square\Models\Address":private]=>

Thanks for any help
Don

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1326

Trending Articles