Description
The Local API for Nepting allows you to trigger in-store payments via the Nepting payment gateway simply by sending a payment request to a specific POS payment terminal located in the same LAN (Local Area Network).
It has been designed to deal with dead zone scenarios: situations where the POS payment terminal has no or bad Internet access, but a LAN connection shared by the payment initiator (a cash register system installed on a tablet or smartphone).
When the Local API receives a payment request, it then:
– awakes the payment terminal
– waits for the payment processing
– responds to the payment request initiator with the payment information
Please note this documentation introduces the Local API by presenting its requirements and how to implement it (endpoints, request parameters, response parameters, error codes, etc.)
If you are looking for a presentation overview, please check the dedicated page.
Requirements
Please find below the list of all prerequisites you need to fulfill to be able to use the Local API for Nepting:
REQUIREMENT | DESCRIPTION |
---|---|
POS payment terminal | An Android POS payment terminal (please consult this page to get the list of all the devices that are officially supported) with: – A working and stable Internet (Wi-Fi) connection – A fixed IP address – The last version of the Nepting Android app installed – The last version of the HiPay POS Android app installed – The Local API service enabled |
How does it work?
The communication between the request initiator and the POS payment terminal relies on a socket connection. Thus, the payment request initiator need to know the following information to be able to join the POS payment terminal:
– Its IP address
– Its listening port (set in the HiPay app preferences / the default value is 8888)
This API is based on a TLV (Type-Length-Value) notation.
It means all the request and response attributes are sent in the form of one text frame, describing these attributes thanks to:
DESCRIPTION | SIZE | FORMAT | |
---|---|---|---|
Type | The type (also called “tag”) of information composing the frame. ex. the amount, the operation type, the payment result, etc. |
2 bytes | Alphabetic (A..Z) |
Length | The number of characters used to define the information value. ex. “012” for an information value of 12 characters |
3 bytes | Numeric (0..9) |
Value | The value of the information. ex. “ORDER_123456” |
Variant | Alphanumeric |
Notes:
– The length must be > 0
– Except for the protocol information*, which must be the first one in a frame, a tag can be sent in any order
– An information (tag) should appear only once in a frame
* Please check the next sections to discover the available tags.
Payment request
Parameters
INFORMATION | DESCRIPTION | M/O | TAG | LENGTH | EXPECTED VALUE | EXAMPLES |
---|---|---|---|---|---|---|
Protocol |
Protocol version used to send the payment to the POS payment terminal. /!\ This tag must be the first one |
M | CZ | 4 | “CZ0040320” | N/A |
Cash register identifier | Identifier of the cash register. | M | CJ | 12 | “CJ012999999999999” | N/A |
Cash register number | Number of the cash register | M | CA | 2 | “CA00201” | N/A |
Amount | Amount of the transaction to be paid by the customer. The amount is expressed in the smallest unit of the currency (100 for 1). |
M | CB | 2-12 | N/A | – 0.01: “CB0011” – 1.50: “CB003150” – 235.70: “CB00523570” |
Operation |
Type of transaction to be performed. Possible values: * Debit reversal is not implemented yet |
M | CD | 1 | N/A | – Debit: “CD0010” – Credit: “CD0011” – Debit reversal*: “CD0012” |
Currency |
Base currency used for the transaction. Possible values: |
M | CE | 3 | N/A | – EUR: “CE003978” |
Force authorization request |
Whether the authorization request should be forced or not. Possible values: |
O | BB | 1 | N/A | – Do not force auth request: “BB0010” – Force auth request: “BB0011” |
Merchant transaction identifier | Merchant transaction identifier used to uniquely identify each transaction from every merchant transaction. | O | CF | 1-99 | N/A | – ORD_20221015_123: “CF019ORD_20221015_123456” |
Customer receipt |
Whether the customer receipt should be returned or not. Possible values: |
O | CK | 3 | N/A | – Returned by the POS payment terminal: “CK003100” – Not returned by the POS payment terminal: “CK003000” |
Phone number |
Customer’s phone number. This information can be used by the HiPay app to prefill the phone number to which the customer receipt will be sent. |
O | BH | 8-20 | N/A | – 0606060606: “BH0100606060606” |
Email address |
Customer’s email address. This information can be used by the HiPay app to prefill the email address to which the customer receipt will be sent. |
O | BI | 6-256 | N/A | – [email protected]: “[email protected]” |
Notes:
– M/O means “Mandatory / Optional”
– “Expected value” means this exact value must be sent
– If you want to send additional data, you can exploit the CF tag (Merchant transaction identifier), by using the “§” character as a value separator
For example, if you want to send “123456” in addition to “ORD_20221015_123” (the merchant transaction identifier), you should send: “CF026ORD_20221015_123456§123456”
Please make sure the merchant transaction identifier is always placed at the left part of the “§” separation character.
Be careful not exceeding the max length of the CF tag.
Examples
Payment request information
INFORMATION | VALUE |
---|---|
Operation | Debit |
Currency | EURO |
Amount | 123.45 |
Frame to send
CZ0040300CJ012247300123456CA00201CB00512345CD0010CE003978
Payment request information
INFORMATION | VALUE |
---|---|
Operation | Credit |
Currency | EURO |
Amount | 67.00 |
Force authorization request | YES |
merchant transaction identifier | 2023-05-04-010 |
Additional data | custom data |
Customer receipt | should be returned by the POS payment terminal |
Customer’s phone number | 0606060606 |
Customer’s email address | [email protected] |
Frame to send
CZ0040300CJ012247300123456CA00201CB0046700CD0011CE003978BB0011CF0262023-05-04-010§custom [email protected]
Payment response
Parameters
INFORMATION | DESCRIPTION | M/O | TAG | LENGTH | EXPECTED VALUE | EXAMPLES |
---|---|---|---|---|---|---|
Protocol |
Protocol version set in the payment request. This tag is the first sent by the POS payment terminal |
M | CZ | 4 | “CZ0040320” | N/A |
Cash register identifier | Identifier of the cash register set in the payment request. | M | CJ | 12 | “CJ012999999999999” | N/A |
Authorization number | Authorization number, in case an authorization was requested before performing the payment. | O | AC | 1-10 | N/A | – 123456: “AC006123456” |
Operation result |
Payment result after the processing of the operation by the POS payment terminal. Possible values: |
M | AE | 2 | N/A | – Success: “AE00210” – Failure: “AE00201” |
Operation result – Additional info |
Additional information to understand the operation result, only in case the operation was NOT performed. Possible values: For CB/EMV applications, this field can be supplemented with: |
O | AF | 2-50 | N/A | – Refused: “AF00207” |
Cash register number | Number of the cash register set in the payment request. | M | CA | 2 | “CA00201” | N/A |
Amount |
Amount really paid by the customer (authorized amount). The amount is expressed in the smallest unit of the currency (100 for 1). |
M | CB | 2-12 | N/A | – 0.01: “CB0011” – 1.50: “CB003150” – 235.70: “CB00523570” |
Application |
Payment application used to process the operation. Possible values: |
M | CC | 3 | N/A | – CB (VISA/MASTERCARD) with contact mode: “CC003001” – CB (VISA/MASTERCARD) contactless: “CC00300B” |
Operation |
Type of transaction set in the payment request. Possible values: * Debit reversal is not implemented yet |
M | CD | 1 | N/A | – Debit: “CD0010” – Credit: “CD0011” – Debit reversal*: “CD0012” |
Currency |
Base currency set in the payment request. Possible values: |
M | CE | 3 | N/A | – EUR: “CE003978” |
Merchant transaction identifier | Merchant transaction identifier set in the payment request. | O | CF | 1-32 | N/A | – ORD_20221015_123: “CF019ORD_20221015_123456” |
Merchant contract | Merchant contract used to process the payment request. | O | CG | 7 | N/A | – 1234567: “CG0071234567” |
Customer receipt |
The customer receipt, base64 encoded. It is sent only if both assertions are true: It is made up of: |
O | CK | 3 | N/A | – Returned by the POS payment terminal: “CK003100” – Not returned by the POS payment terminal: “CK003000” |
Notes:
– M/O means “Mandatory / Optional”.
– “Expected value” means this exact value will be sent.
– Except for the protocol information, which will be the first one sent in the response frame, the information can be sent in any order
– Additional tags could be sent by the POS payment terminal in the response frame
Response types
Response frame
CZ0040320CJ012999999999999CA00201CB00512345CC00300BCD0010CE003978AC006184117AE00210CF0262023-05-04-010§custom dataCG0071234567ZT374CK003100AK361ICBDQVJURSBCQU5DQUlSRQogICAgICBTQU5TIENPTlRBQ1QKQTAwMDAwMDAwNDEwMTAKTWFzdGVyQ2FyZApMZSAxOS8xMi8yMDIyIGEgMTM6NTc6MjIKSElQQVkKOTJMRVZBTExPSVMKMTIzNDU2NyAzOTAzMzQyMjUwMDA5NiAzMDAwNAojIyMjIyMjIyMjIyM2MzY4CkQ2QzY5MUUxMkI3MEFDNDAKMDA1IDAwMSAwMDAwMTAgQyBAIApOVU0gQVVUTyA6IDE4NDExNwpNT05UQU5UIDoKICAgICAgICAgMTIzLDQ1IEVVUgpERUJJVAoKVElDS0VUIENMSUVOVApBIENPTlNFUlZFUgo=
Description
FRAME ATTRIBUTE | INFORMATION | VALUE |
---|---|---|
CD0010 | Operation | Debit |
CE003978 | Currency | EURO |
CB00512345 | Amount | 123,45 |
AE00210 | Payment result | success |
CG0071234567 | Merchant contract | 1234567 |
CC00300B | Payment application | CB (VISA/MASTERCARD) contactless |
AC006184117 | Authorization number | 184117 |
CF0262023-05-04-010§custom data | Merchant transaction identifier | – Merchant transaction identifier: 2023-05-04-010 – Additional data: custom data |
AK361ICBDQVJURSBCQU5DQUlSRQogICAgICBTQU5TIENPTlRBQ1QKQTAwMDAwMDAwNDEwMTAKTWFzdGVyQ2FyZApMZSAxOS8xMi8yMDIyIGEgMTM6NTc6MjIKSElQQVkKOTJMRVZBTExPSVMKMTIzNDU2NyAzOTAzMzQyMjUwMDA5NiAzMDAwNAojIyMjIyMjIyMjIyM2MzY4CkQ2QzY5MUUxMkI3MEFDNDAKMDA1IDAwMSAwMDAwMTAgQyBAIApOVU0gQVVUTyA6IDE4NDExNwpNT05UQU5UIDoKICAgICAgICAgMTIzLDQ1IEVVUgpERUJJVAoKVElDS0VUIENMSUVOVApBIENPTlNFUlZFUgo= | Customer receipt |
CARTE BANCAIRE TICKET CLIENT |
Response frame
CZ0040320CJ012999999999999CA00201CB00512345CD0010CE003978AC006184118AE00201AF00204CF0262023-05-04-011§custom dataZT323CK003100AK309ICBDQVJURSBCQU5DQUlSRQpBMDAwMDAwMDAzMTAxMApWSVNBCkxlIDI2LzA1LzIwMjMgYSAxMjo0ODozMApISVBBWQo5MkxFVkFMTE9JUwpBQkFORE9OIERFQklUCjEyMzQ1NjggMzkwMzM0MjI1MDAwOTYgMzAwMDQKIyMjIyMjIyMjIyMjNjM2OAowMDUgMDAxIDAwMDAxOCBDIApOVU0gQVVUTyA6IDE4NDExOApNT05UQU5UIDoKICAgICAgICAxMjMsNDUgRVVSClRJQ0tFVCBDTElFTlQKQSBDT05TRVJWRVIK
Description
FRAME ATTRIBUTE | INFORMATION | VALUE |
---|---|---|
CD0010 | Operation | Debit |
CE003978 | Currency | EURO |
CB00512345 | Amount | 123,45 |
AE00201Payment resultfailure | ||
AF00204 | Failure reason | payment refused |
AC006184118 | Authorization number | 184118 |
CF0262023-05-04-011§custom data | Merchant transaction identifier | – Merchant transaction identifier: 2023-05-04-011 – Additional data: custom data |
AK309ICBDQVJURSBCQU5DQUlSRQpBMDAwMDAwMDAzMTAxMApWSVNBCkxlIDI2LzA1LzIwMjMgYSAxMjo0ODozMApISVBBWQo5MkxFVkFMTE9JUwpBQkFORE9OIERFQklUCjEyMzQ1NjggMzkwMzM0MjI1MDAwOTYgMzAwMDQKIyMjIyMjIyMjIyMjNjM2OAowMDUgMDAxIDAwMDAxOCBDIApOVU0gQVVUTyA6IDE4NDExOApNT05UQU5UIDoKICAgICAgICAxMjMsNDUgRVVSClRJQ0tFVCBDTElFTlQKQSBDT05TRVJWRVIK | Customer receipt |
CARTE BANCAIRE |
Response frame
CZ0040320CJ012999999999999AE00201AF00209CA00201CB00512345CD0010CE003978
Description
FRAME ATTRIBUTE | INFORMATION | VALUE |
---|---|---|
CD0010 | Operation | Debit |
CE003978 | Currency | EURO |
CB00512345 | Amount | 123,45 |
AE00201 | Payment result | failure |
AF00209 | Failure reason | operation not performed: bad message format |
Troubleshooting
Please make sure you are not waiting for any CR/LF data to be received
Please make sure CR/LF data are sent after the payment request