Electronic Payment
Payment Session
A payment session is created each time a payment session is started.
Attention
It is possible for a terminal to handle mutiple open payment sessions, however this is not yet supported by the RestApi.
A payment session can have the following states:
Created = 0 : (temporary state) initial state after a payment session is started.
WaitForCard = 10 : (temporary state) state after a payment request is sent to the payterminal. the terminal waits for a card to be presented.
WaitForAuthorization = 20 : (temporary state) a card is presented and the terminal requests authorization at the acquirer.
Authorized = 21 : (temporary state) payment is authorized by acquirer.
WaitForCommit = 30 : (temporary state) waiting to commit authorized payment.
Cancelled = 40 : (end state) payment has been cancelled by the user or through an api call. See cancel a payment session.
Success = 50 : (end state) payment is successfull.
Failed = 60 : (end state) payment has failed, no money is withdrawn from the customer account.
Uncertain = 70 : (end state) payment has failed and outcome is uncertain (result should be verified manually in the webportal)
Terminal states
Initializing : 0,
Ready = 1
Note
A new payment session can only be started if the terminal state = ‘Ready’.
Get the terminal and pending payment sessions state
Returns the terminal state and pending sessions. Currently only one pending session is allowed.
URL parameters
hostIp: ip address of the API host.
deviceId: id of the device.
- GET https://{hostIp}:7081/hal/devices/{deviceId}/electronicpayment
Example request:
GET /hal/devices/payter1/electronicpayment HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS...
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "state": 1 "sessions":[ { "id": "85354418-0446-45fa-9c64-0efbfb2e37b4", "state":10, "startedUtc": "2025-02-26T12:33:20.4325251Z" }, ... { "id": "6e3e10e2-5074-41d3-9e4c-623899f75785", "state": 20 "startedUtc": "2025-02-25T12:33:20.4325251Z" }] }
- Status Codes:
200 OK – OK
400 Bad Request – Bad Request. A descriptive error comes along with this error.
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
- Response Headers:
Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)
- Response JSON Object:
state (int) – see terminal states
sessions (array) –
array of pending session. currently only one session is allowed.
id (guid): session id
state (int): see payment session states.
startedUtc (datetime): session creation time (utc)
Get the detailed session state
Returns the details of a pending or ended session. The last 20 ended sessions can be retrieved. Older ended sessions can be consulted in the webportal.
URL parameters
hostIp: ip address of the API host.
deviceId: id of the device.
sessionId: payment session id (guid).
- GET https://{hostIp}:7081/hal/devices/{deviceId}/electronicpayment/sessions/{sessionId}
Example request:
GET /hal/devices/payter1/electronicpayment/sessions/6e3e10e2-5074-41d3-9e4c-623899f75785 HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS...
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "id": "6e3e10e2-5074-41d3-9e4c-623899f75785", "state": 50, "startedUtc": "2025-02-26T11:15:46.0543259Z" "endedUtc": "2025-02-26T11:16:30.9289079Z" "toPay": 100, "payed": 100, "reference":30000, "error": { "id":0, "message":"" }, "receipt":"Receipt\r\nAID A0000000043060\r\nBrand Maestro\r\nCard 581322xxxxxxx7135\r\nPAN Seq No 50\r\nInterface Contactless\r\nTransaction Type Pre-Auth\r\nAuthorized Amount 0.02 EUR\r\nFinal Amount 0.02 EUR\r\nPre-auth Amount 0.02 EUR\r\nOutcome Approved\r\nState Final\r\nAuth Code 51065192\r\nReference 1841185189347032301\r\nUser Reference 30000\r\nTerminal ID \r\nTime 04/03/2025 11:46:27 (CET)\r\n\u0000", "cardInfo":{ "cardUid": "hex string", "cardHash": "hex string", "maskedPan": "string" } }
- Status Codes:
200 OK – OK
400 Bad Request – Bad Request. A descriptive error comes along with this error.
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
- Response Headers:
Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)
- Response JSON Object:
id (guid) – session id
state (int) – see payment session states
startedUtc (datetime) – session creation time (utc)
endedUtc (datetime) – session ended time (utc)
toPay (uint) – to pay value in cents
payed (uint) – payed value in cents
reference (uint) – reference number passed when starting is payment session.
error (Error) –
(optional) null if no error.
id (int): error id
NotStarted = 1,
NotAuthorized = 2,
NotFullyAuthorized = 3,
NotCommitted = 4
message (string)
receipt (string) – ticket receipt (pre-formatted by the terminal). Only available in case of a successfull payment
cardInfo (CardInfo) –
only available after presenting a card
cardUID (string)
cardHash (string)
maskedPan (string)
Start a new payment session
Initiates a new payment session. The result is ‘200 OK’ if a new payment session is started.
The payment session state can be followed by:
Processing the payment session state websocket messages
Requesting the terminal and payment session states
URL parameters
hostIp: ip address of the API host.
deviceId: id of the device.
- POST https://{hostIp}:7081/hal/devices/{deviceId}/electronicpayment/sessions/start
Example request:
POST /hal/devices/payter1/electronicpayment/sessions/start HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... Content-Type: application/json { "toPay": 5, "reference": 10, "autoCommit": true, "language": "en" }
- JSON Parameters:
toPay (uint) – (4bytes) payment amount in Cent (Euro).
reference (uint) – (4bytes) reference for the payment.
autoCommit (bool) – (optional) allows payment reservation sessions (toPay is not displayed on payterminal screen when autoCommit=false)
language (bool) – language during payment. Possible values: “en”, “de”, “fr”, “nl” (language support depends on the payment terminal type)
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "sessionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
- Status Codes:
200 OK – OK
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
- Response JSON Object:
id (guid) – session id
Cancel a payment session
Cancels a pending payment session. The result is ‘200 OK’ if a new payment session is cancelled.
Note
Note that cancellation is only possible in the session state WaitForCard
The payment session state can be evaluated by:
Processing the payment session state websocket messages
Requesting the terminal and payment session states
URL parameters
hostIp: ip address of the API host.
deviceId: id of the device.
sessionId: payment session id (guid).
- POST https://{hostIp}:7081/hal/devices/{deviceId}/electronicpayment/sessions/{sessionId}/cancel
Example request:
POST /hal/devices/payter1/electronicpayment/sessions/6e3e10e2-5074-41d3-9e4c-623899f75785/cancel HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... Content-Type: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
- Status Codes:
200 OK – OK
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
Commit a reserved payment session
Attention
This feature is not supported in the current version.
Commits a pending payment reservation session.
The result is ‘200 OK’ if the payment reservation session is committed. The payment session state can be evaluated by:
Processing the payment session state websocket messages
Requesting the terminal and payment session states
URL parameters
hostIp: ip address of the API host.
deviceId: id of the device.
sessionId : payment session id (guid).
- POST https://{hostIp}:7081/hal/devices/{deviceId}/electronicpayment/sessions/{sessionId}/commit
Example request:
POST /hal/devices/payter1/electronicpayment/sessions/6e3e10e2-5074-41d3-9e4c-623899f75785/commit HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... Content-Type: application/json { "toPay": 100, }
- JSON Parameters:
toPay (string) – final payment amount in Cent (Euro). Must be equal or lower than the reserved amount.
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
- Status Codes:
200 OK – OK
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
Events
Payment session state changed
The websocket server will send ‘payment session state change’ websocket messages to a registered client.
The websocket - method name will be “receivePaymentSession”.
Example of an event after an payment session state change
"messageType": 1,
"data":
{
"methodName": "receivePaymentSession",
"arguments": [
{
"sessions": [
{
"id": "6e3e10e2-5074-41d3-9e4c-623899f75785",
"state": 50,
"startedUtc": "2025-02-26T11:15:46.0543259Z"
}],
"deviceId": "payter1",
"version": "1.0"
}
]}