Purchase order receiving

A purchase order ends at physical reception. It can have several receptions and becomes received when all the merchandise has arrived. From there, the merchandise's progress inside the branch (quality control, release to sale, scrap) belongs to inventory: the order does not store it. Query it in Receipts and receiving tray.

When receiving, Fenicia records the reception on the order and then hands the merchandise to inventory, with the order's identifier as the source and the reception number as the sequence. Retrying the same reception does not duplicate the reception or the lots.

Receive merchandise

Records a reception of the order and hands the received merchandise to the branch's inventory.

{
  "items": [
    { "sku": "CAM-ROJO-M", "received": 40, "rejected": 0, "batchNumber": "L-2291", "expirationDate": "2027-03-31" },
    { "sku": "CAM-ROJO-M", "received": 20, "rejected": 2, "rejectionReason": "Empaque roto", "batchNumber": "L-2292", "expirationDate": "2027-04-30" }
  ],
  "fxRate": 20,
  "notes": "Primera entrega"
}
200Reception recorded. The response says where the merchandise went.
{
  "purchaseOrder": {
    "_id": "po_4471",
    "orderNumber": "PO-2026-0441",
    "status": "partial",
    "currency": "USD",
    "items": [
      { "sku": "CAM-ROJO-M", "name": "Camisa roja M", "itemType": "product", "quantity": 100, "unitCost": 40, "discount": 0, "receivedQuantity": 60, "rejectedQuantity": 2 }
    ]
  },
  "proratedItems": [
    { "sku": "CAM-ROJO-M", "qtyReceived": 60, "baseUnitCost": 800, "proratedLandedCostPerUnit": 0, "finalUnitCost": 800 }
  ],
  "receptionIndex": 0,
  "idempotent": false,
  "inventory": { "destination": "flow", "receiptId": "rcp_01J9A", "stageName": "Control de calidad" }
}
400The order is in another currency and the request has no fxRate, or batchNumber or expirationDate is missing for a variant that requires it.
{ "code": "validation-error", "message": "La orden está en USD: envía el tipo de cambio del día (fxRate)" }
404The order does not exist in your tenant.
{ "code": "not-found", "message": "Purchase order not found" }

Returns the updated order, the prorated cost per SKU in proratedItems (already in the tenant's currency) and the inventory field, which says where the merchandise went.

Required permission: suppliers:receive

Parameters

idstringrequired

Purchase order identifier.

itemsarrayrequired

Lines received. If the variant requires traceability, split the quantity into one line per manufacturer batch: repeat the sku with its batchNumber and expirationDate.

items.skustringrequired

SKU of the order line.

items.receivednumberrequired

Accepted pieces. They enter inventory.

items.rejectednumberrequired

Pieces rejected at the door (broken, wrong). They do not enter inventory or count as received: the order stays partial until the supplier replaces them as another reception. Scrap happens later, inside the receiving flow.

items.rejectionReasonstring

Reason for the rejection.

items.batchNumberstring

Manufacturer batch. Required if the variant has inventoryTracking.trackBatches.

items.expirationDatestring

Expiration date, ISO 8601. Required if the variant has inventoryTracking.trackExpiration.

fxRatenumber

Same-day exchange rate from the order's currency to the tenant's currency. Required if the order's currency is not the tenant's: without it the reception is rejected and never produces a cost. Each line has the line discount subtracted and the result is converted with this rate.

notesstring

Reception notes.

What Fenicia does with the cost

  • Subtracts the line discount before computing the cost.
  • Applies fxRate and hands over the cost in the tenant's currency.
  • Ignores service lines: only product, material and supply produce cost and merchandise.
  • Hands over the parent product's SKU as productSku, not the internal identifier.

Where the merchandise goes

inventory.destinationstring

Returned values: flow (the merchandise is in the first stage of the branch's flow, in process), stock (the branch has no flow and the merchandise raised sellable stock on reception) or erp (an ERP governs the stock: the reception does not change inventory).

If inventory fails, the error is propagated in the response: the reception is not silently treated as good.

Close with shortfall

Moves the order to received when the supplier will not replace what is missing, and records per line what did not arrive.

{ "reason": "El proveedor no repondrá las 8 piezas faltantes" }
200Order closed with a shortfall.
{
  "_id": "po_4471",
  "orderNumber": "PO-2026-0441",
  "status": "received",
  "shortfall": [
    { "sku": "CAM-ROJO-M", "ordered": 100, "received": 92, "rejected": 0, "missing": 8 }
  ]
}
400The order has no receptions, or it is already cancelled or received.
{ "code": "validation-error", "message": "La orden no tiene recepciones: cancélala en vez de cerrarla con faltante" }

Returns the order in received status with the shortfall per line in shortfall.

It is not a cancellation: the order did have receptions, and the receptions and lots that already entered are kept. What was received and rejected so far does not change.

Required permission: suppliers:receive

Parameters

idstringrequired

Purchase order identifier.

reasonstring

Reason for closing. It is kept in the order's history.

Return merchandise to the supplier

Removes merchandise from inventory and from a purchase order's lot to return it to the supplier.

{
  "locationId": "670a1b2c3d4e5f6a7b8c9d01",
  "items": [
    { "sku": "CAM-ROJO-M", "quantity": 5, "lotId": "lot_01J9C" }
  ],
  "reason": "Defecto de fábrica"
}
200Merchandise removed from inventory.
{
  "returned": [
    { "sku": "CAM-ROJO-M", "quantity": 5, "lotId": "lot_01J9C", "unitCost": 800, "currency": "MXN" }
  ],
  "purchaseOrderId": "po_4471"
}
400The quantity exceeds what is left in the lot or in the branch's stock.
{ "code": "validation-error", "message": "La cantidad excede la existencia del lote lot_01J9C" }

Returns the pieces removed with each one's lot and cost. The merchandise leaves stock and the lot, and stays linked to the purchase order.

A supplier return is not scrap: the cost is expected to be recovered. If the supplier replaces the merchandise, it enters as a new reception of the same order.

Required permission: suppliers:receive

Parameters

idstringrequired

Purchase order identifier.

locationIdstringrequired

Branch the merchandise leaves.

itemsarrayrequired

Merchandise to return. At least one element.

items.skustringrequired

SKU to return.

items.quantitynumberrequired

Pieces to return. Integer greater than 0.

items.lotIdstring

Lot the merchandise comes from. Without it, it comes from stock without a lot.

reasonstring

Reason for the return.

Examples

curl -X POST https://api.fenicia.io/suppliers/purchase-orders/po_4471/receive \
  -H "Authorization: Bearer fkapi_tu_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "items": [{ "sku": "CAM-ROJO-M", "received": 60, "rejected": 0 }], "fxRate": 20 }'

Next steps