API documentation
Step 5 – Card payment after issuance
The invoice is issued first and the card is paid later; the payment is then reported to AADE on its own.
Sometimes the document is issued before the customer pays by card, for example a bill that is paid at the end. A.1155/2023, as amended by A.1160/2025, calls this a deferred transaction: the card payment is reported to AADE on its own, linked to the document's MARK, and AADE gives the payment a MARK of its own.
This works only with provider: "flexy".
A document issued on credit (type 5) is paid the same way: by card, in one payment or several,
each reported on its own (section 4).
How it works
1. ERP ── invoice, card marked "deferred" ──▶ Flexy ──▶ AADE ⇒ MARK
2. ERP ── invoice details + MARK ───────────▶ Flexy ⇒ payment signature
3. ERP ── charge + signature ───────────────▶ POS ⇒ payment id
4. ERP ── payment ──────────────────────────▶ Flexy ──▶ AADE ⇒ payment MARK
- Invoice. You issue it as in step 2, with the card payment marked
deferredand without payment details: the payment has not happened yet. - Payment signature. Once the invoice has its MARK, you ask for the payment signature as in step 3, this time with the invoice's MARK.
- Payment. The card is charged on the terminal with the signature, and your payment provider returns the payment id.
- Report. You send the payment to Flexy; Flexy reports it to AADE and returns the payment's MARK.
1. Issue the invoice
The request is the one of step 2. Only the payment method changes: in
provider_details.payment_methods the card entry carries "deferred": true, type and amount,
and optionally info:
"provider_details": {
"document_type": "1.1",
"payment_methods": [
{ "type": 7, "amount": "12.40", "deferred": true }
]
}
A deferred card entry must not carry transaction_id, signature, terminal_id or tip_amount
(otherwise 400 invalid): they belong to the payment, which you send in section 4. Only a card payment
(type 7) can be deferred. Keep the invoice's id and mydata_mark from the response.
A document issued on credit needs nothing extra: its entry is { "type": 5, "amount": "124.00" } as in
step 2, and you report each card payment of it as in section 4.
2. Ask for the payment signature
As in step 3, with one difference: mark is the invoice's MARK, because the
invoice is issued before the payment. The signature then carries the MARK in the second field of
unsigned_text:
"mark": "400001972876895"
3. Charge the card
As in step 3: send the charge to your terminal through your payment provider, together with the signature. Once the customer pays, the provider returns the payment id.
4. Report the payment
Save the following as payment.json:
{
"payment_methods": [
{
"type": 7,
"amount": "12.40",
"tip_amount": "1.00",
"transaction_id": "<PAYMENT ID>",
"terminal_id": "<TID>",
"signature": "<SIGNATURE>"
}
]
}
| Field | Value |
|---|---|
transaction_id | You: the payment id your payment provider returned. |
signature | You: signature.signature_hex from the response of section 2. |
terminal_id | The ID of the POS terminal that charged the card (optional). |
tip_amount | The tip, if any (optional); it is not part of amount. |
type, amount | 7 (card) and the amount paid by card. |
The rules:
- exactly one card payment (
type7), withtransaction_idandsignature; - you may also send the other payment means of the invoice, for example cash for part of the
amount;
transaction_id,terminal_idandsignaturego only on the card; - the amounts add up to the invoice's total (
totals.payable_amount); the tip is not counted; - for a document issued on credit, send the card payment with the document's own payment methods, its
credit (
type5) reduced by the card amount: 124.00 on credit paid 50.00 by card is reported as card50.00and credit74.00, and a later card payment of74.00as card74.00and credit50.00; - a document whose card was marked
deferredtakes one card payment; one issued on credit takes as many as you need, as long as their card amounts add up to no more than its total.
Send it to the invoice's id:
curl https://provider-staging.flexy.gr/api/v1/documents/<id>/payment-methods/ \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data-binary @payment.json
Once AADE registers the payment, the API answers with HTTP 201:
{
"payment_method_submission": {
"id": "6f1c2d5e-3a1b-4c8e-9d27-5b0e8f4a7c11",
"document_id": "969950c9-2bfa-48c8-ba15-ebe12d02b743",
"invoice_mark": 400001972876895,
"status": "accepted",
"payment_method_mark": 400001972876923,
"transaction_id": "<PAYMENT ID>",
"amount": "12.40",
"tip_amount": "1.00",
"terminal_id": "<TID>",
"signature": "<SIGNATURE>",
"payment_methods": [ /* … as you sent them */ ],
"submitted_at": "2026-10-14T07:05:12.481927Z",
"errors": []
}
}
| Field | Meaning |
|---|---|
payment_method_mark | The MARK AADE gave the payment. |
invoice_mark | The MARK of the invoice the payment belongs to. |
submitted_at | When AADE registered the payment. |
AADE registers the same payment as many times as it receives it, so Flexy sends each payment only
once: if you send the same transaction_id again, the API answers HTTP 200 with the payment
already registered, and AADE receives nothing.
What you print: a payment statement that refers to the invoice, with the payment signature
(signature), the payment id (transaction_id), the amount and the tip (tip_amount), if any.
Something is wrong
| HTTP | code | Cause | What to do |
|---|---|---|---|
400 | required, invalid | A field is missing or wrong; attr says which, e.g. payment_methods.0.transaction_id. | Fix the field. |
400 | card_payment_required | There is no card payment, or there is more than one. | Send exactly one entry with type 7. |
400 | total_mismatch | The amounts do not add up to the invoice's total. | Send every payment means of the invoice. |
400 | payment_methods_not_supported | The document was not issued with provider: "flexy". | Nothing: only Flexy documents report payments this way. |
400 | no_deferred_card_payment | The invoice has neither a card entry with deferred nor an entry on credit (type 5). | Issue invoices paid later as in section 1. |
400 | document_not_registered | The document has no MARK yet. | Report the payment once AADE has registered the document. |
400 | aade_rejected | AADE refused the payment; detail carries its message. | Fix what detail mentions and send again. |
403 | onboarding_not_approved | Your registration has not been approved yet. | Email us at [email protected]. |
403 | entity_not_declared | A step that lets Flexy transmit for the business is missing (contract, Taxisnet authorisation or commencement statement); detail names it. | Email us at [email protected]. |
409 | payment_already_reported | The invoice's card was marked deferred and its payment has already been reported. | Nothing: the invoice already has its payment. |
409 | card_payments_exceed_total | The card payments of this invoice issued on credit would add up to more than its total. | Report only what is still owed. |
409 | transaction_id_in_use | This payment id was reported for another document. | Check the transaction_id. |
503 | aade_retry_later | AADE cannot take the payment yet: for a few seconds after an invoice is registered, AADE does not find its MARK. | Send the same request again after the seconds in the Retry-After header. |
502, 409 | payment_outcome_unknown | The connection to AADE failed after the payment may have reached it. Flexy does not send it again, so that it is not registered twice. | Send the same request again later; Flexy establishes the outcome. |
For 401 errors see step 1.