FlexyAPI documentation

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
  1. Invoice. You issue it as in step 2, with the card payment marked deferred and without payment details: the payment has not happened yet.
  2. 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.
  3. Payment. The card is charged on the terminal with the signature, and your payment provider returns the payment id.
  4. 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>"
    }
  ]
}
FieldValue
transaction_idYou: the payment id your payment provider returned.
signatureYou: signature.signature_hex from the response of section 2.
terminal_idThe ID of the POS terminal that charged the card (optional).
tip_amountThe tip, if any (optional); it is not part of amount.
type, amount7 (card) and the amount paid by card.

The rules:

  • exactly one card payment (type 7), with transaction_id and signature;
  • you may also send the other payment means of the invoice, for example cash for part of the amount; transaction_id, terminal_id and signature go 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 (type 5) reduced by the card amount: 124.00 on credit paid 50.00 by card is reported as card 50.00 and credit 74.00, and a later card payment of 74.00 as card 74.00 and credit 50.00;
  • a document whose card was marked deferred takes 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": []
  }
}
FieldMeaning
payment_method_markThe MARK AADE gave the payment.
invoice_markThe MARK of the invoice the payment belongs to.
submitted_atWhen 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

HTTPcodeCauseWhat to do
400required, invalidA field is missing or wrong; attr says which, e.g. payment_methods.0.transaction_id.Fix the field.
400card_payment_requiredThere is no card payment, or there is more than one.Send exactly one entry with type 7.
400total_mismatchThe amounts do not add up to the invoice's total.Send every payment means of the invoice.
400payment_methods_not_supportedThe document was not issued with provider: "flexy".Nothing: only Flexy documents report payments this way.
400no_deferred_card_paymentThe invoice has neither a card entry with deferred nor an entry on credit (type 5).Issue invoices paid later as in section 1.
400document_not_registeredThe document has no MARK yet.Report the payment once AADE has registered the document.
400aade_rejectedAADE refused the payment; detail carries its message.Fix what detail mentions and send again.
403onboarding_not_approvedYour registration has not been approved yet.Email us at [email protected].
403entity_not_declaredA step that lets Flexy transmit for the business is missing (contract, Taxisnet authorisation or commencement statement); detail names it.Email us at [email protected].
409payment_already_reportedThe invoice's card was marked deferred and its payment has already been reported.Nothing: the invoice already has its payment.
409card_payments_exceed_totalThe card payments of this invoice issued on credit would add up to more than its total.Report only what is still owed.
409transaction_id_in_useThis payment id was reported for another document.Check the transaction_id.
503aade_retry_laterAADE 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, 409payment_outcome_unknownThe 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.