Postman collection
Returns Write

pixiReturnCaseUpdate

Sets the return cost of a received return case, stored as net for B2B and gross for B2C, after checking it against the refundable amount.

Updates the return cost of one return case in pixi.Return.

Steps:

  1. UserName is trimmed. An empty value becomes API.

  2. Both ReturnId and ReturnCost must be provided.

  3. The return case must exist.

  4. The return case must be in status StatusId = 2 (Received).

  5. ReturnCost must not be negative. A value of 0 is accepted.

  6. The upper limit is computed from the return case and its invoice (Invoices.InvoiceKey = Return.InvoiceId). It is the returned items amount plus the shipping cost refund minus the voucher amount:

    • for B2B orders: TotalToRefundNet + ShippingCostRefundNet - VoucherAmountNet
    • for B2C orders: TotalToRefundGross + ShippingCostRefundGross - VoucherAmountGross

    If ReturnCost is above this limit, an error row is returned.

  7. The cost is written to the return case:

    • B2C: the value goes to ReturnCostGross.
    • any other order type: the value goes to ReturnCostNet.

    RecordModifiedByUserId and RecordModifiedOn are set as well.

The user ID is resolved from UserName. If that user does not exist, the user pixiAdministration is used.

The call returns exactly one row with Status and Message, both on success and on error.

Notes

  • Validation reads use NOLOCK; the update uses ROWLOCK. No explicit transaction is used.

  • Pitfall: the limit check is skipped in three cases:

    • no matching invoice is found in Invoices, so the order type stays NULL;
    • the order type is neither B2B nor B2C;
    • one of the amount columns is NULL.

    In the first two cases the value is written to ReturnCostNet without any limit check.

  • The error text 'must be greater than 0' is misleading: only negative values are rejected, so 0 is accepted.

  • On error the procedure also returns the return code 1. The status row is the relevant signal for SOAP clients.

Tables used

Return · Write Invoices · Read UCS_USERS · Read
SQL object:
dbo.pipiReturnCaseUpdate
Updated at 2026-10-30