POST
/
orders
/
{order_id}
/
cancel
curl --request POST \
  --url https://sandbox-api.violet.io/v1/orders/{order_id}/cancel \
  --header 'Content-Type: application/json' \
  --data '{
  "notify_customer": true,
  "reason_code": "CUSTOMER",
  "reason": "Customer requested refund."
}'
{
  "order_id": 10000,
  "app_id": 10000,
  "status": "CANCELED",
  "cancelled_bags": [
    {
      "order_id": 10000,
      "bag_id": 11111,
      "merchant_id": 22222,
      "external_order_id": "7438192837181",
      "status": "CANCELED",
      "originated_by": "VIOLET",
      "date_cancelled": "2024-10-24T14:00:39.000Z",
      "refund": {
        "id": 99999,
        "order_id": 10000,
        "bag_id": 11111,
        "merchant_id": 22222,
        "app_id": 10000,
        "transaction_id": 44444,
        "amount": 9900,
        "reason": "Order canceled",
        "refund_currency": "USD",
        "status": "COMPLETED",
        "skus": [
          {
            "id": 55555,
            "bag_id": 11111,
            "quantity_refunded": 1,
            "external_id": "41818918453315",
            "order_sku_id": 8014657
          },
          {
            "id": 55556,
            "bag_id": 77777,
            "quantity_refunded": 1,
            "external_id": "41832890171459",
            "order_sku_id": 77777
          }
        ],
        "date_created": "2024-10-24T14:00:35+0000",
        "date_last_modified": "2024-10-24T14:00:35+0000",
        "external_id": "943916482627",
        "errors": []
      }
    }
  ],
  "message": "All external orders were cancelled."
}

Order cancellation is in beta. Please report any errors to Violet.

Cancel a complete Order. This action will attempt to cancel the external order in the merchants system for every Bag in the Order. The total amount paid for each Bag will be refunded to the shopper upon successful cancellation.

All Bag’s must be in a cancellable state. If any Bag has a status of IN_PROGRESS, REFUNDED, or CANCELED the request will be rejected.

Headers

X-Violet-Token
string
X-Violet-App-Secret
string
X-Violet-App-Id
integer

Path Parameters

order_id
integer
required

Body

application/json
reason
string

Custom message describing the reason for the cancellation.

Maximum length: 255
reason_code
enum<string>
default:
OTHER

Code that best represents the reason for the cancellation.

Available options:
OTHER,
CUSTOMER,
INVENTORY,
FRAUD,
DECLINED
restock_items
boolean
default:
true

Should the items be restocked. In most cases this should be true since only unfulfilled orders can be cancelled.

notify_customer
boolean
default:
false

Should the customer be notified by the merchants system that a cancellation has occurred.

Response

200
application/json
success

Order Refund

order_id
integer
required

ID of the Order being refunded

merchant_id
integer
required

ID of the merchant making the refund

app_id
integer
required

ID of the App that created the Order

transaction_id
integer
required

ID of the Transaction being refunded

gateway_transaction_id
string
required

ID of the Transaction in the Payment Gateway

amount
integer
required

Amount being refunded. In Cents

id
integer
bag_id
integer

ID of the Bag being refunded

merchant_transfer_reversal_amount_usd
integer

Amount being taken back from the associated transfer to the merchant. In Cents

developer_transfer_reversal_amount_usd
integer

Amount being taken back from the associated transfer to the developer. In Cents

merchant_transfer_reversal_amount_platform_currency
integer

Amount in fractional currency unit (e.g. cents) being taken back from the associated transfer to the merchant, in platform currency.

developer_transfer_reversal_amount_platform_currency
integer

Amount in fractional currency unit (e.g. cents) being taken back from the associated transfer to the developer, in platform currency.

reason
string

Reason for refund

reason_code
enum<string>

Reason code for refund

Available options:
OTHER,
CUSTOMER,
INVENTORY,
FRAUD,
DECLINED
refund_currency
string

Currency set for this refund by the external ecom platform

platform_currency
string

Currency used by the platform account for the payment provider that processed this Refund

status
enum<string>

Status of the Refund

Available options:
PROCESSING,
COMPLETED,
CANCELED,
PARTIALLY_COMPLETED,
FAILED,
EXTERNAL
skus
object[]

SKUs the refund applies to

date_created
string

Date of creation

date_last_modified
string

Date of last update

external_id
string

ID of the refund on the external commerce platform. This value will only be populated if the external commerce platform supports refund ID's.

errors
object[]

List of errors associated to this refund during processing. This value will only be populated if there are errors during processing

shipping
object | null

Details of any refunded shipping amounts.

tax_amount
integer | null

Tax amount being refunded. In Cents.

Required range: x > 0