This section highlights some of the additional API calls that can be made with GraphQL to perform things like reader health/status checks, or querying a list of readers or transaction history, etc...
Ping Reader
It is possible to ping a specific reader in order to extract certain information from it, such as whether the reader is offline or online, or what firmware version is running on the reader. To perform this function you would need to ping the reader using the API call shown below:
More information on how to structure your reader ping query here. Important to note that the data returned in the response is not accurate in real time, it is accurate within several minutes. For building offline transaction request routing logic, we would suggest utilizing the reader status returned in the request charge mutation.
queryPingInStoreReader($readerId: ID!) { pingInStoreReader(readerId: $readerId) { id name status pairedAt lastSeenAt offlineSince softwareVersion location { id name internalName address { streetAddress extendedAddress locality region postalCode countryCode } } }}
This API mutation can be used if you would like to validate that you can ping a reader while offline without actually sending a charge request. The result is a simple response that will indicate you can ping the reader using the offline endpoint, example below:
https://readerIPaddress:3030/graphql
{ping}
{"readerId": "Your reader ID"}
{"data": {"ping": "pong" }}
Query a list of Locations
You may want to query a list of locations to retrieve things like locationId or location address info or other info linked to a location. See below example of how you may do this:
queryLocations { inStoreLocations(first: 100) { pageInfo { hasNextPage hasPreviousPage startCursor endCursor } edges { node { id name internalName geoCoordinates { latitude longitude } qrCodePaymentsEnabled payerId address { streetAddress locality region countryCode postalCode } } cursor } }}
It is possible to query a list of readers that are associated with a specific location or specific merchant account. To do this you can simply use a query as shown below in the example:
query ($input: InStoreReaderSearchInput!) { search { inStoreReaders(input: $input) { pageInfo { hasNextPage hasPreviousPage startCursor endCursor } edges { cursor node {...onInStoreReader { id status name softwareVersion location { id } vendor {...onVerifoneVendor { model osVersion } } } } } } }}
If you would like to automate/streamline your reconciliation process, one way of doing so is by utilizing a transaction query. There are a few ways of querying transactions, try modifying the variables in your request to alter the results of your search:
For more information on how to use the query function to search for transactions or other objects see our documentation here with more specific details on constructing transaction searches