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 ─────▶ 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 and the payment id.
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": "S2WwpkPyI1rzAc/EelAwVZMeMJIYigB2nMt2/TtdMQwjqbyXWoRu70uy6VsG9d0Bkc9hTFvXFnDkArBLPC15BA==",
"signature_hex": "4b65b0a643f2235af301cfc47a503055…",
"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. |
signature_hex | The same signature, in hexadecimal. |
expires_at | When the signature expires: the charge must happen before then. For a 1.1 invoice the signature is valid for 60 hours. |
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.
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>" }
]
},
"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].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=…",
"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
}
}
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. |
For the errors AADE returns on the invoice see step 2, and for 401 errors
step 1.
For ready-to-send requests for every document type see the Examples.