Lack of compatibility between REST and GraphQL Order API

Is anyone else having issues in trying to achieve parity when trying to convert from the Order REST API to the GraphQL version? A few properties that we are relying on that don’t have compatible mappings in GraphQL:

  • Order.device_id: No equivalent on the GraphQL order object.
  • Order.user_id: Not available unless you get “read_users” scope. Even then it is only available on Advanced and Plus stores.
  • Transaction.location_id: The documentation shows that the mapping is the Order.retailLocation property, but this is not true. The Order.retailLocation property contains the location at which the order was placed, which is not necessarily where the payment transaction was recorded.

I’m sure there are many others, but interested to hear how others have dealt with similar incompatibilities. Has anyone received any feedback directly from Shopify about similar issues?

Hey Sam,

Appreciate you flagging these - I have connected with the relevant team and will update here when get their recommendations.

Hey Sam,

Can you describe the use cases you’d need the device_id for - and the impact of having it available?

Hi Liam!

Thanks for getting back with me. Use cases for our customers (we are a reporting app):

  • Auditing when staff are using specific devices to process orders. This is important from both operational procedure and security standpoints.
  • Cash/payment audit tracking when trying to balance registers.

We are generally used where they cannot perform reporting functions at all or at scale using Shopify functionality. The impact of not having it available means that merchants can no longer perform on these functions at all.

1 Like

Also for this part:

  • Transaction.location_id: The documentation shows that the mapping is the Order.retailLocation property, but this is not true. The Order.retailLocation property contains the location at which the order was placed, which is not necessarily where the payment transaction was recorded.

Can you share examples of returns for both APIs to show how they’re different?

Sure, no problem. Below are both the the REST response from a call to orders/transactions and the GraphQL response on a call to orders.

See the location id fields of the transactions in the REST call. One transaction is location id 41469645 and the other is 14400978978.

See the retailLocation.id from the GraphQL response. It is 41469645, which doesn’t match the location of the second transaction found in the REST response.

This is an example of a refund being processed at a different location. We can also show examples where the original order location is different from the transaction location. For example, you place an order at store A and pickup and pay at store B. The current GraphQL model does not allow for this either.

Please let me know if you have any questions. Happy to get on a call if it would help.

{
  "transactions": [
    {
      "id": 7661794689196,
      "order_id": 6371634938028,
      "kind": "sale",
      "gateway": "Credit/Debit Card",
      "status": "success",
      "message": "Paid via Credit/Debit Card",
      "created_at": "2024-12-05T13:42:01+02:00",
      "test": false,
      "authorization": null,
      "location_id": 41469645,
      "user_id": 112495053,
      "parent_id": null,
      "processed_at": "2024-12-05T13:42:01+02:00",
      "device_id": 5079400620,
      "error_code": null,
      "source_name": "checkout_one",
      "receipt": {},
      "amount": "1299.00",
      "currency": "ZAR",
      "payment_id": "rno06f7X70XWyMCqPTLPyx3Yp",
      "total_unsettled_set": {
        "presentment_money": {
          "amount": "0.0",
          "currency": "ZAR"
        },
        "shop_money": {
          "amount": "0.0",
          "currency": "ZAR"
        }
      },
      "manual_payment_gateway": true,
      "amount_rounding": null,
      "admin_graphql_api_id": "gid://shopify/OrderTransaction/7661794689196"
    },
    {
      "id": 7661798293676,
      "order_id": 6371634938028,
      "kind": "refund",
      "gateway": "Credit/Debit Card",
      "status": "success",
      "message": "Refunded 450.00 ZAR from manual gateway",
      "created_at": "2024-12-05T13:45:17+02:00",
      "test": false,
      "authorization": null,
      "location_id": 14400978978,
      "user_id": 85371977900,
      "parent_id": 7661794689196,
      "processed_at": "2024-12-05T13:45:17+02:00",
      "device_id": 5091950764,
      "error_code": null,
      "source_name": "pos",
      "receipt": {},
      "amount": "450.00",
      "currency": "ZAR",
      "payment_id": "#34802.2",
      "total_unsettled_set": {
        "presentment_money": {
          "amount": "0.0",
          "currency": "ZAR"
        },
        "shop_money": {
          "amount": "0.0",
          "currency": "ZAR"
        }
      },
      "manual_payment_gateway": true,
      "amount_rounding": null,
      "admin_graphql_api_id": "gid://shopify/OrderTransaction/7661798293676"
    }
  ]
}
{
  "data": {
    "orders": {
      "edges": [
        {
          "node": {
            "name": "#34802",
            "id": "gid://shopify/Order/6371634938028",
            "retailLocation": {
              "id": "gid://shopify/Location/41469645",
              "name": "Head Office"
            }
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 4,
      "actualQueryCost": 4,
      "throttleStatus": {
        "maximumAvailable": 2000.0,
        "currentlyAvailable": 1996,
        "restoreRate": 100.0
      }
    }
  }
}