Sale Request
An overview of the Sale Request message.
Overview
Please see below for information on configuring the Sale Request, as well as the expected Sale Response.
- txSaleRequest - originating from the application to initiate a request for a new sale transaction
- txSaleResponse - originating from the card terminal to return the response of a sale request
txSaleRequest
For a typical sale request the client must provide the following information:
Field | Type | Length (chars) | Description | Example | Required | Card terminal support |
---|---|---|---|---|---|---|
msgLength | String | 4 | A 4-digit number padded with leading zeros indicating message length minus 4 (including any separators). The request will be rejected if the correct message length is not provided. | 0063 | ||
sessionId | String | 6 | A unique number to control integrity of session sequence. | 002690 | ||
msgType | String | 3 | 200 | 200 | ||
msgCode | String | 2 | 00 | 00 | ||
uniqueTxnId | String | 32 | A unique transaction ID transmitted to the host for storage with the transaction. Note that this value will be provided in the MerchantTrns field provided in the sales export response. | 12345678901234567890123456789012 | ||
amount | String | variable up to 13 | Amount always including 2 decimal digits following the decimal point. A dot must always be used as a decimal point. | 124.00 | ||
msgOptions | String | 4 | 0000 | 0000 | ||
Reserved | String | 0 | Empty | null | ||
Reserved | String | 0 | Empty | null | ||
Reserved | String | 0 | Empty | null | ||
Reserved | String | 0 | Empty | null | ||
ISV_amount | String | Variable up to 13 | ISV fee amount always including 2 decimal digits following the decimal point. A dot must always be used as a decimal point. | 123.00 | ||
ISV_clientId | String | 200 | The id of the ISV client.Refer to note below. |
qwerty123456 | ||
ISV_clientSecret | String | 200 | The secret of the ISV client.Refer to note below. |
qwerty123456 | ||
ISV_sourceCode | String | 20 | The source code of the ISV. Refer to note below. |
[A payment source (physical store) that is associated with a terminal] How to create a payment source for ISV |
||
Receipt_UID | String | 200 | The unique identifier (UID) is a numeric or alphanumeric string that is associated with a single entity within the cashier system. | 193302323D532594AD14B669BCCC60C74FCA8BB6 | 👉 Applicable only in Greece |
|
MARK | String | 0 | Unique ID provided by AADE. Commonly is null as this provided at the end of each successful transaction. | null | 👉 Applicable only in Greece |
|
SignatureDateTime | String | 200 | The Date and time of the Provider's Digital Signature. | 20240513134504 | 👉 Applicable only in Greece |
|
PaidAmount | String | 200 | The amount to be paid. This value should be the same as the amount parameter and should be specified without any special character, such as comma (,) or point (.) |
12400 | 👉 Applicable only in Greece |
|
AmountWithoutTax | String | 200 | The amount without TAX to be paid. This value should be specified without any special character, such as comma (,) or point (.) |
10000 | 👉 Applicable only in Greece |
|
VAT | String | 200 | The value of VAT percentage that applied to the total amount. This value should be specified without any special character, such as comma (,) or point (.) If different value of TAX applied to the items of the transaction, then should be specified in this parameter, the highest value of TAX. |
24 | 👉 Applicable only in Greece |
|
AmountWithTax | String | 200 | The amount with TAX to be paid. This value should be specified without any special character, such as comma (,) or point (.) |
12400 | 👉 Applicable only in Greece |
|
POSTerminalID | String | 200 | The POS ID through which the transaction will be handled. The value of POS ID is NOT be the Device Serial Number, and can be found through the Viva Softpos Application Settings. |
16000198 | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
ProviderID | String | 200 | The ID of the ΥΠΑΗΕΣ Provider that generates the Digital Signature for this transaction. |
999 | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
aadeProviderSignature | String | 200 | The fields of providerSignatureFields encrypted using a public key and the Elliptic Curve Digital Signature Algorithm (ECDSA): The signature should be sent to POS in base64 format. |
MEUCIQDHGhz2KQ+gddCsryDxcF69wW3o7C5WpuULHJ8DPeuLBgIgVxgCbh+OFtuZCwAOp7O8kJ+ShPlcpw84RG2jLBAWp2c= | 👉 Applicable only in Greece |
|
protocol | String | 20 | The protocol used (for internal use only) | 'ecr_default' |
ISV parameter info:
- ISV_clientId can be found under Settings > API access in the viva banking app
- ISV_clientSecret as above.
- ISV_sourceCode is the payment source for ISV set up under Sales > Physical Payments > Stores.
The above information elements must be joined into one single string using ‘|’ as a separator.
If the resulting string gets appropriately transmitted to the terminal, the terminal will respond with a txResponse message (200).
A sale request for a successful sale transaction (without using AADE parameters) looks as follows:
0107|002690|200|00|12345678901234567890123456789012|123.50|0000|||||0.10|qwerty123456|qwerty123456|qwerty123456
A sale request for a successful sale transaction using AADE parameters looks as follows:
0242|004986|200|00|7685000101R011531500000167|1.67||||||||||193302323D532594AD14B669BCCC60C74FCA8BB6||20240513134504|167|147|20|167|16000198|||101|||MEUCIQDHGhz2KQ+gddCsryDxcF69wW3o7C5WpuULHJ8DPeuLBgIgVxgCbh+OFtuZCwAOp7O8kJ+ShPlcpw84RG2jLBAWp2c=|
Notes
msgLength
– indicates the length of the message starting from the first separator. Since msgLength has always a length of 4, the value stored in msgLength is the total message length minus 4. The request will be rejected if the correct message length is not provided.uniqueTxnId
– must be exactly 32 characters, so padding (even with space characters) is required.||
– for each reserved parameter, the position should be empty.protocol
- this is for internal use only and can therefore be excluded from your requests
txSaleResponse
After executing a Sale transaction the terminal responds with a txSaleResponse
to indicate if the transaction has been approved or not.
The table below summarises the contents of the response.
Linux Card Terminals:
A txSaleResponse
for an approved transaction (without using AADE parameters) looks as follows:
0213|000032|210|00|00|CHIP/PIN~RRN:123456833121|VISA|479275******9999|833121|690882|000001|123.00|1010|00|00|00|00|00|00| 16016684||||629914XXXXXXXXX6770|629914XXXXXXXXX6770|qwerty123456|qwerty123456|my name|2212|1010
A txSaleResponse
for an approved transaction (with AADE parameters) looks as follows:
0319|005010|210|00|00|Contactless/None~RRN:413607959451|VISA|479273******1768|959451|959451|000001|1.67|1010|00||00|00|00|00|16000198|4136103558000198||||||/|2209|1111|8050b086-bd36-4c8a-94d6-d29c611e6d25|2024-05-15T10:13:17.6483505+03:00|1|||||116413607959451959451|167|2024-05-15T10:13:17.6483505+03:00|
Android Card Terminals:
0247|000024|210|00|00|Contactless/None~RRN:204814800749|MASTERCARD|537535******9228|800749|008120|000001|1.11|00|00|00|00|00|00|00|16000281|2048160108000202|2048160108||||||||0950f16c-1f52-4060-ac22-cb6b59c8990c|2022-02-17T16:15:15.1824947+02:00|1
It is expected that certain transactions will fail for various reasons. A txSaleResponse for a failed transaction looks as follows:
0218|000026|210|00|51|Declined|MASTERCARD|537535******9228|800750||000001|1.01|1010|00|00|00|00|00|00| 16000281|2048160109000202|2048160109||||||||692676f4-7f9e-478c-b3fe-901dfa7b9bc8|2022-02-17T16:16:44.2677975+02:00|1
The structure of the message is the same as in the case of an approved transaction.
Differences are limited to two specific fields.
respCodeResp
field where a response code is returned indicating the reason the transaction failed.respMessageResp
where a string is returned providing a textual description of the reason.
Obviously refNumResp
and authCodeResp
contain zeros since there is no STAN code available, nor an authorisation code.
Failure reasons and ISO codes
The table below summarises the failure reasons that can be provided by the terminal.
Code | Description | Event |
---|---|---|
51 | Declined By Host | Declined by the issuer |
UD | Unsupported Card | Card is not supported |
UC | User Cancelled | User pressed cancel or the user failed to present card in due time |
LC | Lost Carrier (Communication Error) | No network |
TO | Time Out (Communication Error) | Time out with host |
CE | Communication Error (Other) | No connectivity |
ND | Communication Error (Other) | Request failed |
NA | Host Not Available | Host is not unreachable |
IM | Invalid MAC received from host | - |
UN | Error – Wrong Transaction | - |
EC | Expired Card | Expired Card |
XC | Transaction approved. EMV fail. Autoreversal | Transaction approved but automatically canceled |
RC | Error during card reading | An error occurred while reading the card. |
NO | Error after void request | No transactions found. |
IP | Invalid Parameters | A parameter in request is wrong. |
ED | Declined by ECR/ERP | - |
ID | Invalid Reversal Data | - |
19 | Try another card | - |
LRNF | Last receipt not found | - |
IB | Batch Error | - |
PF | Parameters failed | - |
01 | Printing failed | Out of paper |
02 | Printing failed | Low battery |
03 | Printing failed | Other |
- | An Error Occurred | No other error code applicable to issue |
Notes
The list of codes may differ slightly between different versions of the software. Therefore, it is strongly suggested to use the response code (as well as any informational text provided), merely for display or troubleshooting purposes, i.e. when reporting the issue to the customer service.
In cases where the transaction gets declined by the Host (51), the terminal provides extra text on screen as well as a special code indicating the exact reason the transaction was declined by the host. The full list is described in the table below:
IsoCode | Description |
---|---|
10001 | ReferToCardIssuer |
10003 | InvalidMerchant |
10004 | PickupCard |
10005 | DoNotHonor |
10006 | GeneralError |
10012 | InvalidTransaction |
10013 | InvalidAmount |
10014 | InvalidAccountNumber |
10030 | FormatError |
10041 | LostCard |
10043 | StolenCard |
10051 | InsufficientFunds |
10054 | ExpiredCard |
10055 | IncorrectPin |
10057 | TransactionNotPermittedToCardHolder |
10058 | TransactionNotPermittedToAcquirerOrTerminal |
10061 | ActivityAmountLimitExceeded |
10062 | RestrictedCard |
10063 | SecurityViolation |
10065 | ActivityCountLimitExceeded |
10068 | LateResponse |
10070 | CallIssuer |
10075 | PinEntryTriesExceeded |
10086 | PinValidationNotPossible |
10087 | PurchaseAmountOnlyNoCashBackAllowed |
10090 | CutOffInProgress |
10094 | DuplicateTransmissionDetected |
10096 | SystemMalfunction |
10199 | Empty |
10200 | Unmapped |
* | Anyother |
Transaction Types Table
Transaction type | Id |
---|---|
PREPARE_SALE | 0 |
SALE | 1 |
CANCEL | 2 |
PREAUTH | 3 |
CAPTURE | 4 |
CANCEL_PREAUTH | 5 |
SALE_ENGINE | 6 |
EXECUTE_SALE | 7 |
SCA_SALE | 8 |
SCA_PREAUTH | 9 |
REFUND | 11 |
Get Support
If you would like to integrate with Viva, or if you have any queries about our products and solutions, please see our Contact & Support page to see how we can help!