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/json

Annule 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.

ChampTypeRequisDescription
reasonenumnonCUSTOMER_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

StatutCodeCause
400INVALID_REQUESTUUID invalide, reason inconnu ou champ supplémentaire.
401MISSING_PARTNER_IDIdentifiant partenaire absent.
404INVOICE_NOT_FOUNDFacture inexistante pour ce produit et ce partenaire.
409INVOICE_ALREADY_PAIDLa facture a déjà été payée.
409INVOICE_ALREADY_CANCELLEDLa 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.

On this page