1. Orders
  2. Cancel Orders
POST
/order_cancel_requests
curl --request POST \
     --url https://sandbox.masonhub.co/dragonfly-cosmetics-demo/api/v1/order_cancel_requests \
     --header 'Authorization: Bearer <token>' \
     --header 'Content-Type: application/json' \
     --data '{
  "customer_identifier": "<string>",
  "reason": "<string>",
  "notes": "<string>",
  "requested_by": "<string>",
  "priority": 123
}'

Cancel orders asynchronously by submitting cancellation requests. The system processes cancellations in the background and provides status updates through polling or webhooks.

Important: Use this dedicated endpoint for cancellations. Do NOT use the /order_update_requests endpoint to cancel orders - that endpoint is exclusively for editing orders.

​
Request Body

The request body accepts an array of cancellation request objects:

​
Required Fields

customer_identifier
required
string

Your unique order identifier for the order to cancel.

reason
required
string

Cancellation reason. Common values:

  • customer_request - Customer initiated cancellation
  • inventory_unavailable - Out of stock
  • payment_failed - Payment processing issue
  • duplicate_order - Accidental duplicate
  • fraud_suspected - Security concern
  • other - Other reason (provide details in notes)
notes
string

Additional context or details about the cancellation.

requested_by
string

Email or identifier of the person requesting cancellation.

priority
integer

Cancellation priority (1-999). Higher values processed first.

curl -X POST "https://app.masonhub.co/{account}/api/v1/order_cancel_requests" \
  -H "Authorization: Bearer your_jwt_token" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "customer_identifier": "129374",
      "reason": "customer_request",
      "notes": "Customer changed their mind before shipment",
      "requested_by": "customer.service@example.com"
    }
  ]'
{
  "records_submitted": 1,
  "records_processed": 1,
  "records_failed": 0,
  "records_succeeded": 1,
  "results": [
    {
      "system_id": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
      "customer_identifier": "129374",
      "status": "pending",
      "submitted_at": "2024-01-17T10:30:00Z"
    }
  ]
}

​
Cancellation Process Flow

1

Submit Request

Send cancellation request to this endpoint with order identifier and reason

2

Receive Confirmation

API returns immediately with a system_id for tracking the request

3

Asynchronous Processing

MasonHub processes the cancellation in the background:

  • Verifies order exists and can be canceled
  • Stops fulfillment processes if in progress
  • Releases allocated inventory
  • Updates order status
4

Monitor Status

Check cancellation status via polling or webhook callbacks

5

Final Resolution

Receive final status: success, failed, or partial

​
Monitoring Cancellation Status

Track your cancellation request status using these methods:

  • Polling

  • Webhooks (Recommended)

Query the Get Order Cancels endpoint:

GET /order_cancel_requests?id=7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d

Poll every 30-60 seconds until status changes from pending to final state.

​
Cancellation Eligibility

Orders can be canceled based on their current status:

Orders in these statuses can be canceled:

  • pending - Not yet started processing
  • on_hold - Temporarily paused
  • processing - Being picked (may incur fees if picking started)

​
Cancellation Reasons

Standard cancellation reasons and their typical use cases:

​
Handling Partial Cancellations

When only part of an order can be canceled:

{
  "cancel_request_id": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
  "customer_identifier": "129374",
  "status": "partial",
  "details": {
    "requested_items": 5,
    "canceled_items": 3,
    "shipped_items": 2,
    "reason": "2 items already shipped in shipment SHIP-001"
  }
}

Partial cancellations occur when some items have already been shipped. You’ll need to handle returns for shipped items separately.

​
Fees and Charges

Cancellation fees may apply depending on fulfillment stage:

  • No fee: Orders canceled before picking starts
  • Picking fee: Orders canceled after picking begins
  • Full charge: Orders canceled after packing complete

Contact your MasonHub representative for your specific fee structure.

​
Best Practices

​
Error Handling

Common error scenarios and recommended actions:

Error CodeScenarioRecommended Action
ORDER_NOT_FOUNDOrder doesn’t existVerify customer_identifier
CANCELLATION_NOT_ALLOWEDOrder already shippedInitiate return process
DUPLICATE_REQUESTCancellation already submittedCheck existing request status
INVALID_REASONUnknown reason codeUse valid reason from list

Store the returned system_id for each cancellation request. You’ll need it to track the cancellation status and handle any follow-up actions.

​
Sources