Facture
Annuler une facture
POST /v3/products/{productId}/invoices/{invoiceId}/cancel — annuler une facture non payée.
POST /v3/products/{productId}/invoices/{invoiceId}/cancel
Authorization: Bearer <token>
Content-Type: application/jsonAnnule une facture OPEN. L'annulation est atomique : la facture passe au statut CANCELLED, elle
est retirée du panier du client et son QR code ne permet plus de payer.
Requête
Le corps est optionnel.
| Champ | Type | Requis | Description |
|---|---|---|---|
reason | enum | non | CUSTOMER_REQUEST, MERCHANT_ERROR, DUPLICATE, FRAUD_SUSPECTED ou OTHER. |
curl -X POST $API_BASE_URL/v3/products/$PRODUCT_ID/invoices/$INVOICE_ID/cancel \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "reason": "CUSTOMER_REQUEST" }'Réponse 200
La facture annulée :
{
"id": "0f8b7a3e-6c2d-4b1a-9e8f-5d4c3b2a1f0e",
"productId": "2f8a9d1e-1c4b-4f37-9a55-6c0a9d3f1b02",
"partnerInvoiceReference": "INV-2025-0001",
"status": "CANCELLED",
"amount": { "value": 2500, "currency": "EUR" },
"customer": { "externalId": "CUST-987" },
"createdAt": "2025-03-01T10:15:00.000Z",
"paidAt": null,
"cancelledAt": "2025-03-01T10:42:11.000Z"
}Le motif d'annulation est enregistré mais n'est pas renvoyé dans la réponse.
Erreurs
| Statut | Code | Cause |
|---|---|---|
400 | INVALID_REQUEST | UUID invalide, reason inconnu ou champ supplémentaire. |
401 | MISSING_PARTNER_ID | Identifiant partenaire absent. |
404 | INVOICE_NOT_FOUND | Facture inexistante pour ce produit et ce partenaire. |
409 | INVOICE_ALREADY_PAID | La facture a déjà été payée. |
409 | INVOICE_ALREADY_CANCELLED | La facture a déjà été annulée. |
Une annulation n'est pas idempotente : un second appel renvoie 409 INVOICE_ALREADY_CANCELLED,
que vous pouvez traiter comme un succès.