Cancel the commission on a cancelled or refunded order.
POST https://api.shopmy.us/api/Affiliates/cancel
Call this endpoint when an order is cancelled or fully refunded. ShopMy finds the commission created for the original order and cancels it so the creator is never paid on a cancelled sale.
Authentication
Authenticate with your brand's developer API key:
Authorization: Bearer <your developer key>
Your brand is identified from the key. If you don't know your key, reach out to your ShopMy account manager.
Body fields
| Field | Type | Description | |
|---|---|---|---|
order_id | string | required | The same order id you sent on the original order confirmation. |
domain | string | optional | The storefront domain the order belongs to, when you operate several. |
test | boolean | optional | Marks the event as a test — counted separately, never billed. |
Example
{
"order_id": "1001234"
}Responses
Every response is JSON and carries a success flag.
| Status | When | Body |
|---|---|---|
200 | The event was received and recorded — including cancellations for orders ShopMy never tracked. | { "success": true, "message": "..." } |
400 | The request could not be processed as sent — the error field says why, and the matching outcome below carries the fix. | { "success": false, "error": "..." } |
401 | The Authorization header is missing or carries an invalid key. | { "success": false, "error": "..." } |
Outcomes
Every request is recorded with an outcome code — the same codes shown on your Tracking Health page. Outcomes return HTTP 200 unless noted.
tracked
The commission was found and cancelled.
order_not_found
No ShopMy commission exists for this order_id — usually the original order had no ShopMy attribution. Returned as a success; nothing to do.
already_cancelled
The commission was already cancelled by an earlier request. Nothing to do.
invalid_params
Fix required. The order_id is missing or the wrong type. Send it as a string or number — not an object. Returns HTTP 400.
unresolved_domain
Fix required. Your brand could not be resolved from the request. Check that your Authorization header carries your developer key. Returns HTTP 400.
handler_error
The event hit a processing error on our side. No change is needed from your team.
