What exactly is a dose? Each transaction you create belongs to a so-called batch. Like a receipt, each batch has its own number and is actually a package of transactions. close batchis an administrative operation by which a terminal closes a batch and prompts systems to close the batch and open a new one. In Global Payments, 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. You get the token (with a lifetime of 90 days) through the /cloud/oauth/token endpoint with the following arguments provided:
- Basic authentication for token endpoints (name/password) - will be provided for each user.
- Merchant username - same as for GP tom
- Merchant password - same as for GP tom
- Terminal ID (TID) – Destination terminal ID
- The authorization endpoint is located at:
Get 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", }
Token renewal
When the access_tokenu expires, 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
Create a task
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 response [CloudTaskDetailApiResponse]:
Possible response codes are:
Below you will find the variables used in the response:
Check the status of a task
V dalším kroku budete kontrolovat stav tasku na koncovém bodu GET /v1/tasks/{taskID} pomocí požadavku, který zahrnuje:
Possible return codes:
Variables in the response:
The task status request should be repeated until you get one of the final response codes, which are:
You can proceed to the next step only when the response is in the COMPLETED state.
Getting the closing result
Nyní víme, že uzávěrka byla autorizována. Cílem tohoto kroku je získat stav uzávěrky a její údaje. Pro nový požadavek zavoláte koncový bod GET /v1/batches/{batchId}, kde použijete následující proměnné:
Possible response codes are:
The response contains the following variables, depending on the response code:
-closeBatchNumber (string) - closeBatchNumber child batch
- totalCount (number) - Total number of transactions in batch
- saleCount (number) - Number of transactions of the sales type in batch
- saleAmount (number) - Volume of transactions of the sales type in batch
- voidCount (number) - Number of transaction cancellations
- voidAmount (number) - Transaction cancellation volume in batch