The terminal REST API is used to connect a cash register or other business system to a payment terminal from Comgate over the Internet. It allows you to remotely enter instructions to the terminal, typically to initiate a payment and subsequently determine its result. In the terminal REST API, we only support the JSON data format. The process of processing one transaction usually consists of the following steps:
Creating a payment (mandatory step)
The cash register system calls the POST /v2.0/terminalPayment.json
method and passes it the mandatory data: amount (price
), currency (curr
), or it is possible to add a payment reference/variable symbol (refId
). If the request is correct, the API returns a unique transaction identifier transId
. You must save this code, it is key for all further operations with this payment.
Determining the payment status (optional step)
The cash register system can determine how the payment went on the terminal. Repeatedly call the GET /v2.0/terminalPayment/transId/{transId}.json
method until the status
changes from 'PENDING' to the final value. Possible final states are:
DELETE /v2.0/terminalPayment/transId/{transId}.json
method. Cancellation can only be made for payments in the 'PAID' status and only until the 'closing' is performed.GET /v2.0/terminal.json
method.POST /v2.0/terminalClosing.json
method is used to perform a closing, which returns summary information about transactions made since the previous closing and clears the transaction history in the terminal.Authorization: Basic [base64_encode(merchant:secret)]
. The 'merchant' parameter is your terminal login identifier and 'secret' is your password. You can find this information, along with the options for setting allowed IP addresses for API access, in the Client Portal in the Integration - Shops Settings - Terminals section.We are currently preparing additional methods for working with preauthorizations, refunds, and MOTO payments.
authorization required | string Authorization header is added in the form: 'Authorization: Basic [base64_encode(merchant:secret)]'. Merchant is the Login identifier in the ComGate system - you can find it in the Client Portal in the section Integration - Shop settings - Terminals. Secret is the password. |
Create new paymentVytv * orenie novej platby
price required | integer <int32> Price for a product in cents or pennies. For example, for a payment of 10 EUR, the value '1000' should be used. |
curr required | string Currency code according to ISO 4217. Available currencies: CZK, EUR. |
refId | string Parameter suitable for entering a variable symbol or order number on the Client's side (it does not have to be unique, ie it is possible to create more payments with the same refId). In the Client Portal and daily csv the parameter is marked as Client ID. |
code required | integer Method return code and error (value of message) description: |
message required | string |
transId | string Unique alphanumeric identifier (code) of the transaction |
{- "price": 1000,
- "curr": "CZK",
- "refId": "2010102600"
}
{- "code": 0,
- "message": "OK",
- "transId": "AB12-CD34-EF56"
}
Getting payment status, possibly with detailed transaction data (if available).
transId required | string Example: AAAA-BBBB-CCCC Unique alphanumeric identifier (code) of the transaction (transactionId) |
authorization required | string Authorization header is added in the form: 'Authorization: Basic [base64_encode(merchant:secret)]'. Merchant is the Login identifier in the ComGate system - you can find it in the Client Portal in the section Integration - Shop settings - Terminals. Secret is the password. |
code required | integer Method return code |
message required | string Method return code and error description: |
price required | string Price of the product in cents or pennies. For example, for a payment of 10 EUR, the value '1000' will be returned. |
curr required | string Currency code according to ISO 4217 |
refId required | string Payment references (variable symbol) |
transId required | string Unique alphanumeric identifier (code) of the transaction (transactionId) |
status required | string Current transaction status, values |
fee | string The calculated transaction fee in cents or pennies, or may contain the value 'unknown'. Payment fees are available in the response the next day at the earliest based on payment processor reports. |
cardValid | string Payer's card expiration date in MM/YY format (if the card was used). For example: '04/28' |
cardNumber | string Partial payer card number (if the card was used) |
paymentErrorReason | string Reason for payment rejection (if available). |
# You can also use wget curl -X GET https://payments.comgate.cz/v2.0/terminalPayment/transId/{transId}.json \ -H 'Authorization: Basic MTIzNDU2Omd4NHE4T1YzVEp0Nm5vSm5maGpxSkt5WDNaNlljaDB5'
{- "code": 0,
- "message": "OK",
- "price": "1000",
- "curr": "CZK",
- "refId": "2010102600",
- "transId": "AB12-CD34-EF56",
- "status": "PAID",
- "fee": "string",
- "cardValid": "04/28",
- "cardNumber": "string",
- "paymentErrorReason": "string"
}
Cancel of payment
The payment can be cancelled until 'closing' is triggered on terminal. The payment must be sucessfully finished (in the 'PAID' state.)
If 'closing' was already triggered on terminal, an error will be displayed and the 'refund' method must be used instead (if possible).
transId required | string Example: AAAA-BBBB-CCCC Unique alphanumeric identifier (code) of the transaction (transactionId) |
authorization required | string Authorization header is added in the form: 'Authorization: Basic [base64_encode(merchant:secret)]'. Merchant is the Login identifier in the ComGate system - you can find it in the Client Portal in the section Integration - Shop settings - Terminals. Secret is the password. |
code required | integer method return code and error description: |
message required | string |
# You can also use wget curl -X DELETE https://payments.comgate.cz/v2.0/terminalPayment/transId/{transId}.json \ -H 'Authorization: Basic MTIzNDU2Omd4NHE4T1YzVEp0Nm5vSm5maGpxSkt5WDNaNlljaDB5'
{- "code": 0,
- "message": "OK"
}
Check terminal status.
authorization required | string Authorization header is added in the form: 'Authorization: Basic [base64_encode(merchant:secret)]'. Merchant is the Login identifier in the ComGate system - you can find it in the Client Portal in the section Integration - Shop settings - Terminals. Secret is the password. |
status required | string Status of the connection test to the authorization server. |
# You can also use wget curl -X GET https://payments.comgate.cz/v2.0/terminal.json \ -H 'Authorization: Basic MTIzNDU2Omd4NHE4T1YzVEp0Nm5vSm5maGpxSkt5WDNaNlljaDB5'
{- "status": "ONLINE"
}
Performs a batch closing on the terminal. Closing will clear the transaction history in the terminal.
authorization required | string Authorization header is added in the form: 'Authorization: Basic [base64_encode(merchant:secret)]'. Merchant is the Login identifier in the ComGate system - you can find it in the Client Portal in the section Integration - Shop settings - Terminals. Secret is the password. |
code required | integer 0 - OK, otherwise see 'message' param for details |
message required | string OK or text description of the batch closing result |
batchNumber | integer Number of batch closing |
Array of objects List of batch totals per currency |
# You can also use wget curl -X POST https://payments.comgate.cz/v2.0/terminalClosing.json \ -H 'Authorization: Basic MTIzNDU2Omd4NHE4T1YzVEp0Nm5vSm5maGpxSkt5WDNaNlljaDB5' \ -H 'Content-Type: application/json'
{- "code": 0,
- "message": "OK",
- "batchNumber": 1,
- "batchData": [
- {
- "curr": "CZK",
- "creditsAmount": 100,
- "creditsCount": 3,
- "debitsAmount": 200,
- "debitsCount": 21
}
]
}