What exactly is a dose? Every transaction you create belongs to a batch. Like a receipt, each batch has a number and is actually a package of transactions. A close is an administrative operation whereby the terminal closes a batch and prompts the systems to close the batch and open a new one. In Global Payments systems, it is possible to see the closing number for each transaction and it is possible to filter transactions by this number.
Login & Authentication
JWT token authentication is required for all non-public endpoints. The token (with a lifetime of 90 days) is obtained via the /cloud/oauth/token endpoint with the following arguments provided:
- Basic authentication for token endpoints (name/password) - will be provided for each user.
- Trader username - same as for GP tom
- Trader password - same as for GP tom
- Terminal ID (TID) - ID of the destination terminal
- The authorization endpoint is located at:
Getting an access token
Example request:
POST {{apiCloudHost}}/cloud/oauth/token
Authorization: Basic YXRvbTphc2hmdWY0ZTVmYQ==
Content-Type: application/x-www-form-urlencoded
grant_type=password&username=jan.novak@example.com&password=ABCDEFGHIJKL&tid=999888
Example answer:
{
"access_token": "eyJh...", // access token used in authenticated API requests
"token_type": "bearer",
"refresh_token": "GciO...",
"expires_in": 3600,
"scope": "read write",
"tid": "999888",
}Renewing a token
When the access_token expires, a refresh_token is available.
Example request:
POST {{apiHost}}/api/oauth/token
Authorization: Basic YXRvbTphc2hmdWY0ZTVmYQ==
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=GciO...
GPTomAuth
Creating a bag
Call the POST endpoint /v1/tasks/BATCH and use CreateCloudTaskTransactionApiRequest with the following information filled in to create the request:
MANDATORY
MANDATORY
MANDATORY
MANDATORY
MANDATORY
Example: „Invoice 37364FD“
Content of the [CloudTaskDetailApiResponse]:
Possible answer codes are:
Below are the variables used in the response:
Check the status of the bag
In the next step, you will check the status of the task on the GET /v1/tasks/{taskID} endpoint using a request that includes:
Possible return codes:
Response variables:
The request for the state of the bag should be repeated until you get one of the final response codes, which are:
You can only proceed to the next step if the answer is in the COMPLETED state.
Getting the closing result
We now know that the closure has been authorised. The goal of this step is to get the status of the deadline and its data. For the new request, you call the GET /v1/batches/{batchId} endpoint using the following variables:
Possible answer codes are:
The response contains the following variables depending on the response code:
-closeBatchNumber (string) - closeBatchNumber of the child batch
- totalCount (number) - Total number of transactions in the batch
- saleCount (number) - Number of transactions of the sale type in the batch
- saleAmount (number) - The volume of transactions of the sale type in the batch
- voidCount (number) - Number of transaction cancellations
- voidAmount (number) - The amount of transaction cancellations in the batch
