POST /purchase/{uid}/credit

Crée un avoir (note de crédit) lié à un achat existant.

Fonctionnement:

  • L'avoir reprend les informations de l'achat d'origine avec des montants négatifs
  • L'avoir est automatiquement lié à l'achat parent
  • Le solde de l'achat est recalculé

Utilisation:

  • Remboursement d'une facture fournisseur
  • Correction d'une erreur de facturation

Événement déclenché: CREATE_PURCHASE_CREDIT

Path parameters

  • uid string Required

    Identifiant unique de l'achat d'origine

Responses

  • 201 application/json

    Avoir créé avec succès

    Hide response attribute Show response attribute object
    • newPurchase object
      Hide newPurchase attributes Show newPurchase attributes object
      • _id string

        Unique identifier for the purchase

      • number string

        Purchase number

      • invoiceNumber string

        Supplier invoice number

      • date string(date-time)

        Purchase date

      • dateRecord string(date-time)

        Record date

      • company string

        Reference to the company

      • supplier string

        Reference to supplier (client)

      • supplier_name string

        Supplier name

      • supplier_code string

        Supplier code

      • supplierTvaNumber string

        Supplier VAT number

      • supplierReverseCharge boolean

        Reverse charge applicable

        Default value is false.

      • total_ht number

        Total without tax

      • total_ttc number

        Total with tax

      • total_tva number

        Total VAT amount

      • base_currency string

        Default value is EUR.

      • currency string

        Default value is EUR.

      • state string

        Values are draft, waiting, paid, to_pay, notpaid, or inactive. Default value is waiting.

      • type string

        Values are purchase_old, purchase, or purchase_credit. Default value is purchase.

      • lines array[object]
        Hide lines attributes Show lines attributes object
        • title string
        • totalHt number
        • totalTva number
        • totalTtc number
        • tvaRate number
        • tva string
        • type string

          Default value is product.

      • payments array[object]
        Hide payments attributes Show payments attributes object
        • mode string
        • method_name string
        • amount number
        • currency string
        • date string(date-time)
        • check_number string
      • payment_date string(date-time)
      • payment_expiry_date string(date-time)
      • payment_methods array[string]
      • categories array[string]

        Purchase category references

      • VatRates array[object]
        Hide VatRates attributes Show VatRates attributes object
        • amount number

          Amount of VAT

        • rate string

          VAT rate

        • total number

          Total amount with this VAT rate

      • url string

        Attached file URL

      • exported boolean

        Default value is false.

      • exportedFEC boolean

        Default value is false.

      • exportedPDF boolean

        Default value is false.

      • bank_reconciliations array[string]
      • bank_reconciliation_status string

        Values are unreconciliated, reconciliated, or partialreconciliated. Default value is unreconciliated.

      • bank_reconciliate_total number
      • creditForPurchase string

        Reference to original purchase for credit notes

      • analytical_code string
      • createdAt string(date-time)
      • updatedAt string(date-time)
  • 404

    Achat non trouvé

POST /purchase/{uid}/credit
curl \
 --request POST 'https://wuro.pro/api/v3.2/purchase/{uid}/credit' \
 --header "X-APP-ID: $API_KEY" \
 --header "X-APP-SECRET: $API_KEY"
Response examples (201)
{
  "newPurchase": {
    "_id": "string",
    "number": "string",
    "invoiceNumber": "string",
    "date": "2025-05-04T09:42:00Z",
    "dateRecord": "2025-05-04T09:42:00Z",
    "company": "string",
    "supplier": "string",
    "supplier_name": "string",
    "supplier_code": "string",
    "supplierTvaNumber": "string",
    "supplierReverseCharge": false,
    "total_ht": 42.0,
    "total_ttc": 42.0,
    "total_tva": 42.0,
    "base_currency": "EUR",
    "currency": "EUR",
    "state": "waiting",
    "type": "purchase",
    "lines": [
      {
        "title": "string",
        "totalHt": 42.0,
        "totalTva": 42.0,
        "totalTtc": 42.0,
        "tvaRate": 42.0,
        "tva": "string",
        "type": "product"
      }
    ],
    "payments": [
      {
        "mode": "string",
        "method_name": "string",
        "amount": 42.0,
        "currency": "string",
        "date": "2025-05-04T09:42:00Z",
        "check_number": "string"
      }
    ],
    "payment_date": "2025-05-04T09:42:00Z",
    "payment_expiry_date": "2025-05-04T09:42:00Z",
    "payment_methods": [
      "string"
    ],
    "categories": [
      "string"
    ],
    "VatRates": [
      {
        "amount": 42.0,
        "rate": "string",
        "total": 42.0
      }
    ],
    "url": "string",
    "exported": false,
    "exportedFEC": false,
    "exportedPDF": false,
    "bank_reconciliations": [
      "string"
    ],
    "bank_reconciliation_status": "unreconciliated",
    "bank_reconciliate_total": 42.0,
    "creditForPurchase": "string",
    "analytical_code": "string",
    "createdAt": "2025-05-04T09:42:00Z",
    "updatedAt": "2025-05-04T09:42:00Z"
  }
}