Parcourir la documentation

Factures, solde et paiements

GET /invoices

Permissions : billing.invoices:read

ParamètreTypeRequisValeurs
limitentiernon, défaut 201 à 100
cursorstringnonpagination.nextCursor de la page précédente
statusstringnonUNPAID, PARTIALLY_PAID, PAID, OVERDUE, VOID, PARTIALLY_REFUNDED, REFUNDED

DRAFT est accepté mais ne renvoie jamais rien : les brouillons ne sortent pas du tableau de bord. Une valeur hors énumération répond 400 VALIDATION_ERROR:status.

La plus récente en premier. Une clé restreinte à certains services ne voit pas les factures des autres services ; une facture qui ne concerne aucun service reste visible.

curl -H "Authorization: Bearer $FRESHPERF_KEY" \
     "https://api.freshperf.fr/v1/invoices?status=UNPAID&limit=20"
{
  "data": [
    { "code": "INV-202608-0082", "kind": "RENEWAL", "status": "PAID",
      "issuedAt": 1787727600380, "dueAt": 1788300000000, "paidAt": 1787727605569,
      "currency": "EUR", "totalCents": 360, "amountPaidCents": 360,
      "balanceDueCents": 0, "serviceCode": "SRV-TISZG5-6000",
      "orderNumber": "ORD-20260727-0001" }
  ],
  "pagination": { "nextCursor": "MTg4", "limit": 20 }
}
ChampTypeNotes
codestringidentifiant de toutes les routes de facture
kindstring ou nullRENEWAL, UPGRADE, ONE_OFF, ADDON, REACTIVATION
statusstringvoir les valeurs du filtre ci-dessus
issuedAt, dueAtentiermillisecondes epoch
paidAtentier ou nullmillisecondes epoch
totalCents, amountPaidCents, balanceDueCentsentiercentimes, taxe comprise
serviceCodestring ou nullle service facturé, quand la facture en concerne un
orderNumberstring ou nullla commande d'origine

GET /invoices/{code}

Permissions : billing.invoices:read

Reprend les champs ci-dessus, ajoute subtotalCents (hors taxe), taxCents, discountCents, amountRefundedCents (entiers, centimes), et détaille :

Champ de lines[]TypeNotes
namestring
descriptionstring ou null
quantityentier
unitPriceCents, unitTaxCents, totalCentsentiercentimes
periodStart, periodEndentier ou nullmillisecondes epoch
recurrencestring ou null
Champ de payments[]TypeNotes
identier
statusstringPENDING, AUTHORIZED, CAPTURED, SETTLED, FAILED, CANCELLED, REFUNDED, NEEDS_REVIEW
amountCentsentiercentimes
currencystring ou null
providerstring ou nullle prestataire, ou BALANCE pour un paiement par solde
methodstring ou nullex. CARD
createdAtentiermillisecondes epoch

GET /invoices/{code}/pdf

Permissions : billing.invoices:read

Répond le fichier, pas du JSON.

En-têteValeur
Content-Typeapplication/pdf
Content-Dispositionattachment; filename="INV-202608-0082.pdf"
Cache-Controlprivate, no-store
curl -H "Authorization: Bearer $FRESHPERF_KEY" \
     -o facture.pdf \
     https://api.freshperf.fr/v1/invoices/INV-202608-0082/pdf
ErreurStatutQuand
INVOICE_NOT_FOUND404code inconnu, ou facture d'un autre compte
PDF_NOT_AVAILABLE503le document n'est pas encore rendu. Retry-After: 5

En erreur, le corps redevient l'enveloppe JSON habituelle.

POST /invoices/{code}/pay

Permissions : billing.invoices:pay, plus billing.saved_methods:charge avec saved_method. En-tête obligatoire : Idempotency-Key.

Paie ce qui reste dû.

ChampTypeRequisValeursD'où il vient
methodstringouibalance, saved_method-
paymentMethodIdentieroui si saved_method> 0GET /payment-methods → id

none n'est pas accepté ici : 400 VALIDATION_ERROR:method. Une autre valeur hors liste répond 400 VALIDATION_ERROR:payment.method.

curl -X POST -H "Authorization: Bearer $FRESHPERF_KEY" \
     -H "Content-Type: application/json" \
     -H "Idempotency-Key: pay-INV-202608-0082" \
     -d '{"method":"balance"}' \
     https://api.freshperf.fr/v1/invoices/INV-202608-0082/pay
{ "data": { "status": "CAPTURED", "paymentId": 244, "amountCents": 360,
            "invoiceCode": "INV-202608-0082", "balanceCents": 4640 } }
ChampTypeNotes
statusstringle statut du paiement créé, parmi les valeurs de payments[].status ci-dessus
paymentIdentier ou null
amountCentsentier ou nullcentimes débités
invoiceCodestring ou nullle document réglé
balanceCentsentier ou nullle solde après coup, seulement sur un paiement par solde
ErreurStatutQuand
INVOICE_NOT_FOUND404code inconnu
INVOICE_ALREADY_PAID400déjà réglée
INVOICE_VOID, INVOICE_REFUNDED, INVOICE_NOT_ISSUED, INVOICE_BALANCE_ZERO400rien à payer sur ce document
CURRENCY_UNSUPPORTED400devise non prise en charge
PAYMENT_METHOD_ID_REQUIRED400saved_method sans paymentMethodId
INSUFFICIENT_BALANCE402solde trop court
PAYMENT_DENIED, PAYMENT_DENIED_<motif>402la banque a refusé. Le motif, quand il est connu : USE_ANOTHER_CARD, CARD_EXPIRED, SECURITY_CODE, BILLING_ADDRESS, INSUFFICIENT_FUNDS, AUTHENTICATION, RETRY_LATER
PAYMENT_METHOD_NOT_FOUND404moyen inconnu du compte
PAYMENT_METHOD_NOT_ACTIVE400moyen expiré ou bloqué
API_KEY_SPENDING_CAP_EXCEEDED403le plafond de la clé ne couvre pas le montant
PAYMENT_IN_PROGRESS409un autre paiement du même document tourne
PAYMENT_RECORDED_MISMATCH409anomalie de rapprochement. Contactez le support

GET /credit-notes

Permissions : billing.credit_notes:read

ParamètreTypeRequisValeurs
limitentiernon, défaut 201 à 100
cursorstringnoncurseur à décalage
ChampTypeNotes
codestringAV-202608-0001
statusstringISSUED ou VOID
invoiceCodestring ou nullla facture corrigée
currencystring ou null
totalCentsentiercentimes
reasonstring ou null
issuedAtentiermillisecondes epoch

GET /credit-notes/{code}/pdf

Permissions : billing.credit_notes:read

Mêmes en-têtes et mêmes erreurs que le PDF de facture, avec CREDIT_NOTE_NOT_FOUND en 404.

GET /balance

Permissions : billing.balance:read

{ "data": { "enabled": true, "balanceCents": 4400,
            "currency": "EUR", "autoRenewFromBalance": false } }
ChampTypeNotes
enabledbooléenfalse quand le solde prépayé n'est pas ouvert sur la plateforme
balanceCentsentiercentimes disponibles
currencystring ou nullISO 4217
autoRenewFromBalancebooléenle compte a opté pour payer ses renouvellements par le solde

Le solde s'alimente depuis le tableau de bord. L'API le dépense, elle ne le recharge pas.

GET /balance/transactions

Permissions : billing.balance:read

ParamètreTypeRequisValeurs
limitentiernon, défaut 201 à 100
cursorstringnoncurseur à décalage
{ "data": [
  { "id": 62, "type": "RENEWAL_APPLIED", "amountCents": -300,
    "balanceAfterCents": 4400, "currency": "EUR",
    "reason": "Invoice INV-202608-0087", "relatedPaymentId": null,
    "createdAt": 1787907506000 }
],
  "pagination": { "nextCursor": null, "limit": 20 } }

Le plus récent en premier.

ChampTypeNotes
identier
typestring ou nullvoir le tableau ci-dessous
amountCentsentiersigné : positif au crédit, négatif au débit
balanceAfterCentsentierle solde juste après ce mouvement
currencystring ou nullISO 4217
reasonstring ou nulllibellé libre
relatedPaymentIdentier ou nullrenvoie à payments[].id d'une facture
createdAtentiermillisecondes epoch
typeSens
TOPUP, TOPUP_CARD, TOPUP_PAYPAL, TOPUP_SAVEDrechargement, selon le moyen employé
PAYMENT_APPLIEDle solde a payé une commande ou une facture
RENEWAL_APPLIEDle solde a payé un renouvellement
PAYMENT_REVERSEDun paiement par solde a été annulé
REFUND_TO_BALANCEun remboursement est revenu sur le solde
REFERRAL_CREDITgain de parrainage
ADMIN_CREDIT, ADMIN_DEBITgeste commercial ou correction

GET /payment-methods

Permissions : billing.payment_methods:read

Liste complète, sans pagination.

{ "data": [
  { "id": 14, "type": "CARD", "status": "ACTIVE",
    "displayName": "MASTERCARD ••••0011", "brand": "MASTERCARD",
    "last4": "0011", "expMonth": 9, "expYear": 2028, "isDefault": true }
] }
ChampTypeNotes
identierà repasser en paymentMethodId
typestringCARD, SEPA_DIRECT_DEBIT, BANK_TRANSFER, PAYPAL, APPLE_PAY, GOOGLE_PAY, OTHER
statusstringACTIVE, INACTIVE, PENDING_VERIFICATION, EXPIRED, BLOCKED
displayNamestring ou nulllibellé masqué. Une adresse PayPal y est partiellement cachée
brand, last4string ou nullcartes
expMonth, expYearentier ou nullcartes
isDefaultbooléenle moyen que account_default emploie

Seul un moyen en ACTIVE est débitable. Ajouter ou retirer un moyen se fait dans le tableau de bord.

Ce que la clé a dépensé

GET /me et GET /me/key rendent key.spendingCapCents et key.spendingRemainingCents : le plafond de la clé sur 30 jours glissants et ce qu'il en reste. Le détail des débits se lit dans l'onglet Appels de la clé, dans le tableau de bord.