Skip to main content

List Cancellation Reasons

Get a list of all active cancellation reasons for orders.

Authentication

Requires JWT authentication. Available to all authenticated roles: admin, manager, cashier.

Response

message
string
Success message
data
array
Array of cancellation reason objects
id
integer
Cancellation reason ID
reason
string
Short reason name
description
string
Optional detailed description of the cancellation reason
is_active
boolean
Whether this cancellation reason is currently active
created_at
string
Timestamp when the reason was created (ISO 8601 format)

Example Request

curl -X GET https://api-pos.agprastyo.me/api/v1/cancellation-reasons \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "message": "Cancellation reasons retrieved successfully",
  "data": [
    {
      "id": 1,
      "reason": "Customer Changed Mind",
      "description": "Customer decided not to proceed with the order",
      "is_active": true,
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": 2,
      "reason": "Out of Stock",
      "description": "One or more items in the order are out of stock",
      "is_active": true,
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": 3,
      "reason": "Payment Failed",
      "description": "Customer payment could not be processed",
      "is_active": true,
      "created_at": "2024-01-15T10:30:00Z"
    }
  ]
}

Use Cases

Order Cancellation Flow

When cancelling an order, cashiers can select from predefined cancellation reasons to maintain consistent data for reporting and analysis.
// Fetch available cancellation reasons
const response = await fetch('/api/v1/cancellation-reasons', {
  headers: {
    'Authorization': `Bearer ${token}`
  }
});

const { data: reasons } = await response.json();

// Display reasons to user for selection
// Then use selected reason ID when cancelling the order

Reporting & Analytics

Cancellation reasons are tracked with each cancelled order and can be used to:
  • Identify common reasons for order cancellations
  • Track cancellation trends over time
  • Improve operational processes based on cancellation data
Cancellation reasons are predefined in the system and are seeded during initial database setup. Only active reasons are returned by this endpoint.

Build docs developers (and LLMs) love