A sale transaction is a basic payment operation that transfers a specified amount from the cardholder's bank account to the merchant's account.
As far as the payment process is concerned, the procedure is as follows:
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:
This authentication method is the same for all terminals.
Getting an access token
Example request:
POST {{apiCloudHost}}/cloud/oauth/token
Authorization: Basic YXRvbTphc2hmdWY0ZTVmYQ==
Content-Type: application/x-www-form-urlencoded
(Authorization and Contect-Type is always the same for all customers - please use the same data as in the example. You need to insert the unique client data into the grant_type afterwards).
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/TRANSACTION and use CreateCloudTaskTransactionApiRequest with the following information filled in to create the request:
MANDATORY
MANDATORY
MANDATORY
MANDATORY
Example: „Invoice 37364FD“
True if the receipt is to be printed on the device.
Note: For mobile phones, you need to make sure the Bluetooth printer is connected.
MANDATORY
MANDATORY
Possible values: [ LAST_TRANSACTION, OLDER_TRANSACTION ]
MANDATORY
Pokud se nastaví true, tak se nejdříve vyvolá obrazovka zadání spropitného v GP tom.
Pro vyvolání této obrazovky je potřeba mít také aktivované spropitné v aplikaci
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 payment result
We now know that the transaction has been authorized. The goal of this step is to get the transaction status and details of the transaction. For the new request, you will call the GET endpoint /v1/transactions/{transactionId} using the following variables:
Possible answer codes are:
The response contains the following variables depending on the response code:
ACCEPTED - transakce byla úspěšně autorizována
DECLINED - transakce byla zamítnuta z nějakého důvodu
CANCELLED - pokud je transakce zrušena obsluhou nebo zákazníkem
Operation / transaction type."
EN: Indicates the DCC status. If "ACCEPTED", the transaction was made via DCC and you must fill in the receipt with DCC data. If "NOT_ACCEPTED", then you can ignore the DCC data.
NOT_ACCEPTED
EN: Transaction amount in DCC currency – in the currency of the customer’s card. You must display this on your receipt exactly as received via the API response, including the correct decimal places.
EN: Currency of the customer's card.
EN: Indicates the exchange rate. This value is in the local terminal currency. You must display it on your receipt exactly as received in the API response, including the correct decimal places.
EN: Markup for the conversion rate. You must display it on your receipt exactly as received in the API response, including the correct decimal places.
EN: Indicates whether the customer's card was issued within the EU or outside. If the value is "0" or "1", the text "Markup" must be displayed on the receipt. If the value is "2", the text "Markup over ECB rate" must be displayed on the receipt.
1
2
Pokud budete účtenku generovat nebo tisknout na své straně, doporučujeme zkontrolovat, která pole jsou povinná a musí být vytištěna/zobrazena na účtence. Popis je k dispozici zde.
