API documentation
Step 3 – Card payment
The same invoice as step 2, paid by card on a POS terminal.
In this step you issue the same Sales Invoice (1.1) of €12.40 as in step 2, this time paid by card on a POS terminal. In the example the payment provider is Viva.
How it works
A card payment is tied to the invoice through a payment signature that Flexy issues as the provider. The flow has three steps:
1. ERP ── invoice details ──────────────────▶ Flexy ⇒ payment signature
2. ERP ── charge + signature ───────────────▶ Viva (POS) ⇒ payment id
3. ERP ── invoice + payment id + signature ─▶ Flexy ──▶ AADE
- Payment signature. Before charging the card, you ask Flexy for the payment signature of the invoice you are about to issue. The signature contains the invoice UID (derived from VAT number, date, type, series and number), its amounts and the payment amount.
- Payment. You send the charge to your payment provider (e.g. Viva) together with the signature. Once approved, the provider returns the transaction's payment id (Unique Payment Identity).
- Invoice. You issue the invoice through Flexy, with card as the payment method, the payment id and the signature from step 1.
The VAT number, series, aa and date must be the same in the signature and in the invoice. The
page puts the same aa and date in both requests; for a new test, reload the page.
1. Issue the payment signature
Save the following as signature.json:
{
"signature": {
"provider": "flexy",
"nsp": "Viva",
"issuer_vat_number": "<VAT NUMBER>",
"branch_code": 0,
"invoice_type": "1.1",
"invoice_series": "A",
"invoice_number": "YYYYMMDDHHMMSS",
"invoice_issued_at": "YYYY-MM-DDTHH:MM:SS+HH:MM",
"invoice_net_amount": "10.00",
"invoice_vat_amount": "2.40",
"invoice_total_amount": "12.40",
"payment_amount": "12.40",
"duration": 1,
"terminal_id": "<TID>"
}
}| Field | Value |
|---|---|
issuer_vat_number | You: replace <VAT NUMBER> with the issuer's VAT number, the same one you will put on the invoice. |
terminal_id | You: replace <TID> with the ID of the POS terminal that will charge the card. |
invoice_number, invoice_issued_at | The page: the aa and the current date and time, the same as the invoice's below. |
provider | flexy: Flexy issues the signature. |
nsp | The payment provider that will run the charge; in the example Viva. Values: Viva, WebEcr, WorldLine, Edps, EpaySoftPos (or their number, 1–5). |
invoice_net_amount, invoice_vat_amount, invoice_total_amount | The invoice amounts: €10.00 + €2.40 VAT = €12.40. |
payment_amount | The amount to be charged to the card: €12.40. |
branch_code, duration | 0 for the head office; 1 (day). |
Send it:
curl https://provider-staging.flexy.gr/api/v1/signatures/ \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-binary @signature.json
The response (HTTP 201):
{
"signature": {
"id": "2f43ec5f-e511-4b2b-b818-9003ecf13f7b",
"status": "success",
"uid": "EF50AEE3A2C75459A308044547F252385F5CD83E",
"nsp_name": "Viva",
"nsp_value": 1,
"unsigned_text": "EF50AEE3A2C75459A308044547F252385F5CD83E;;20261004171639;1240;1000;240;1240;<TID>",
"signed_text": "MEUCIQC+IuinZ3Z9SrDIygUKF9vxG5HEgc4UMtrT4zHpkz8AkgIgZ3UyE+TBFz1N0ByOeEyLF2ikigmeBfMv3VZ6O5lK73U=",
"signature_hex": "3045022100be22e8a767767d4ab0c8ca…",
"timestamp": "20261004171639",
"expires_at": "2026-10-07T02:16:39.267373Z",
"seconds_until_expiration": 216000
// … and the details you sent
}
}
| Field | Meaning |
|---|---|
uid | The invoice UID. It is the same mydata_uid the invoice gets in step 3. |
unsigned_text | The details Flexy signed, separated by ;: UID, MARK (empty), signing time (Greek time), payment amount, net value, VAT, total (in cents) and TID. The order depends on nsp: for WebEcr and WorldLine the payment amount comes after the total; for EpaySoftPos the amounts are in euros (12.40) and the time is YYYY-MM-DDTHH:MM:SS.000. |
signed_text | The signature, in Base64: ECDSA on the P-256 curve over SHA-256, DER-encoded, like the signatures of the other ΥΠΑΗΕΣ providers. |
signature_hex | The same signature, in hexadecimal. |
expires_at | When the signature expires: the charge must happen before then. The signature is valid for 60 hours, or 2 hours when the issuer's main activity code (ΚΑΔ) is in food service (division 56). |
unissued_report_status | null while the signature is valid. If it expires and no invoice was issued with its UID, Flexy reports the invoice to AADE as «under issuance» (see «If the invoice is never issued» below): pending, sending, reported or failed. not_required means an invoice was issued with this UID, or another signature of the same invoice carries its report. |
Give your payment provider the signature details it asks for: usually unsigned_text together with
signed_text or signature_hex.
2. Charge the card through your payment provider
Send the €12.40 charge to your terminal through your payment provider (e.g. Viva), together with the signature from step 1, the way the provider defines. Once the customer pays, the provider returns the transaction's payment id.
If the payment is not approved, do not issue the invoice with card as the payment method.
Paying with more than one card
You can ask for one signature per card. All card payments for the same invoice together cannot be more than its total (A.1112/2025 Article 8 §9). Flexy checks it twice:
- when you ask for a signature,
payment_amountcannot be more thaninvoice_total_amount, minus the card payments of the same invoice that Flexy knows of: approved, in progress at a terminal, or left without an answer by the terminal; - when you issue the invoice, the
amountvalues of its card entries (type7), plus any payment approved under a Flexy signature of the same invoice that the invoice does not list, cannot add up to more thanpayable_amount.
For example, an invoice of €50.00 can be paid with €30.00 and €20.00 by card: the invoice carries two card
entries. With €30.00 and €25.00 the cards add up to €55.00, and the invoice is refused with
card_payments_exceed_total. Pay the rest in cash instead (e.g. €30.00 + €15.00 by card and €5.00 in cash).
Tips are not counted: tip_amount is separate from amount.
3. Issue the invoice with the payment id
The invoice is the same as in step 2; only the payment method changes. Save the following as
invoice.json:
{
"document": {
"provider": "flexy",
"document_type": "invoice",
"series": "A",
"aa": "YYYYMMDDHHMMSS",
"date": "YYYY-MM-DD",
"provider_details": {
"document_type": "1.1",
"payment_methods": [
{ "type": 7, "amount": "12.40", "transaction_id": "<PAYMENT ID>", "signature": "<SIGNATURE>" }
]
},
"issuer": {
"legal_name": "Δοκιμαστικός Εκδότης",
"legal_number": "<VAT NUMBER>",
"address": {
"address_line": "Πανεπιστημίου 123",
"city": "Αθήνα",
"zip": "10678",
"country": "GR"
}
},
"counterpart": {
"legal_name": "Δοκιμαστικός Πελάτης",
"legal_number": "801434350",
"address": {
"address_line": "Σταδίου 456",
"city": "Θεσσαλονίκη",
"zip": "54625",
"country": "GR"
}
},
"items": [
{
"title": "Προϊόν δοκιμής",
"description": "Γραμμή δοκιμής",
"quantity": "1",
"unit_measure": "ΤΕΜ",
"unit_value": "10.00",
"unit_total": "10.00",
"taxes": [
{
"title": "ΦΠΑ 24%",
"value_type": "percentage",
"value": "24.00",
"tax_sign": "+",
"on_vat": true,
"provider_details": { "provider_code": "1" }
}
],
"provider_details": {
"classification_category": "category1_1",
"classification_type": "E3_561_001",
"vat_classification_category": "1"
}
}
],
"totals": {
"line_extension_amount": "10.00",
"tax_exclusive_amount": "10.00",
"tax_amount": "2.40",
"tax_inclusive_amount": "12.40",
"payable_amount": "12.40"
},
"tax_breakdown": [
{
"tax_category_id": "S",
"tax_rate_percent": "24.00",
"taxable_amount": "10.00",
"tax_amount": "2.40"
}
]
}
}| Field | Value |
|---|---|
issuer.legal_number | You: replace <VAT NUMBER> with the issuer's VAT number, the same as the signature's. |
provider_details.payment_methods[0].transaction_id | You: replace <PAYMENT ID> with the payment id your payment provider returned. |
provider_details.payment_methods[0].signature | You: replace <SIGNATURE> with signature.signature_hex from the step 1 response. |
provider_details.payment_methods[0].type | 7: card payment on a POS (myDATA code). |
provider_details.payment_methods[0].amount | The amount paid by card: the whole payable amount, €12.40. |
Send it:
curl https://provider-staging.flexy.gr/api/v1/documents/ \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-binary @invoice.json
Once AADE registers the invoice, the API answers with HTTP 201, as in step 2:
{
"document": {
"aa": "20261004171639",
"issue_date": "2026-10-04",
"provider": "flexy",
"status": "success",
"mydata_mark": 400001972099593,
"mydata_uid": "EF50AEE3A2C75459A308044547F252385F5CD83E",
"qr_code_url": "https://mydataapidev.aade.gr/TimologioQR/QRInfo?q=…",
"aade_authentication_code": "…",
"provider_identity": { "name": "FLEXY Ι.Κ.Ε.", "website": "www.flexy.gr", "licence_number": null },
"verification_url": "https://provider-staging.flexy.gr/api/v1/public/verify/<public_key>?mark=400001972099593",
"issuer_vat_number": "<VAT NUMBER>",
"counterpart_vat_number": "801434350",
"total_gross_value": "12.40"
// … and document_data with the whole document, including the payment id
}
}
On the printed document, besides what step 2 lists, you print for the card
payment the payment signature (signature), the unique payment id (transaction_id), the amount
and the tip (tip_amount), if any.
If the invoice is never issued
If a signature expires (60 hours, 2 hours in food service) and no invoice was issued with its UID,
Flexy reports that invoice to AADE as «under issuance» (A.1112/2025 Article 8 §10, AADE method
SendUnsignedInvoices). You do not need to do anything. The signature's unissued_report_status shows the result,
and it becomes reported once AADE has registered it. This also happens when the card was charged but the invoice was never issued.
Something is wrong
| HTTP | code | Cause | What to do |
|---|---|---|---|
400 | required | A field is missing. attr says which, e.g. terminal_id. | Add the field. |
400 | invalid | In the signature, an unknown provider, e.g. viva instead of flexy. In the invoice, amounts or a date that do not add up. detail explains exactly what. | Fix what detail mentions. |
400 | required | payment_method_type 7 without payment_methods (except on type 11.4): a card payment is sent in payment_methods, with transaction_id and signature. attr is provider_details.payment_method_type. | Send the card in payment_methods. |
400 | invalid | In payment_methods, a type that is not an integer 1 to 8 written plainly ("07", "7.0", " 7", true), or a tip_amount that is negative or has more than 2 decimal places, on an entry of any payment type. | Send type as a plain integer and the tip in euros with up to 2 decimals. |
400 | max_length | A terminal_id over 200 characters. | Send the terminal's ID as the provider gives it. |
400 | card_payments_exceed_total | The card payments of the invoice would add up to more than its total. In the signature attr is payment_amount; in the invoice it is provider_details.payment_methods. detail gives the amounts. | Charge less by card and pay the rest in another way. |
For the errors AADE returns on the invoice see step 2, and for 401 errors
step 1.
If the card is paid after the invoice is issued, see step 5.
For ready-to-send requests for every document type see the Examples.