updatePaymentStatus
Update the payment status of an order. The order status is re-derived from the new payment status and the shipment rollup afterwards, and it never moves backwards.
Import
import { updatePaymentStatus } from "@evershop/evershop/oms/services";
Syntax
updatePaymentStatus(orderId: number, status: string, conn?: PoolClient): Promise<void>
Parameters
orderId
Type: number
Order ID (not UUID).
status
Type: string
New payment status.
conn (optional)
Type: PoolClient
Database connection. If you pass one, the function joins your transaction and leaves committing to you. If not provided, it opens and commits its own transaction.
Return Value
Returns Promise<void>.
Errors
Throws Invalid status when status is not a registered payment status.
Notes
updatePaymentStatusonly changes the status. It writes no payment transaction and emits no event. To capture or refund, use captureOrder, refundOrder or recordRefund, which call it for you.- It is hookable. React to a change with
hookAfter('changePaymentStatus', ...).
Examples
Basic Update
import { updatePaymentStatus } from "@evershop/evershop/oms/services";
await updatePaymentStatus(123, 'paid');
See Also
- cancelOrder - Cancel order
- updateShipmentStatus - Update shipment status