Refund or cancel a purchase
This guide explains how to revoke access to a digital asset after a business event on the vendor side, such as a refund, dispute, or manual cancellation.
HL Connector does not process customer payments. All payment handling, refunds, and disputes are fully managed by the vendor. HL Connector is only responsible for granting or revoking access to digital assets.
When to cancel a purchase
You should cancel a purchase in HL Connector when access to an asset must be revoked, for example:
- A customer refund was issued on the vendor side
- A payment dispute or chargeback occurred
- An order was canceled manually by the vendor
- Access needs to be revoked due to a business or legal reason
Canceling a purchase updates the order state and immediately revokes access to the associated assets.
Important behavior
- Only the vendor can initiate a cancellation
- Payments are never validated or reversed by HL Connector
- Cancellation affects access only, not financial records
- Canceled orders cannot be restored
Step 1 — Identify the order
To cancel a purchase, you need the vendor order identifier that was returned when the purchase was registered.
If you do not have the order details, retrieve them first using the order info endpoint.
This allows you to confirm the current order status before attempting cancellation.
Step 2 — Cancel the purchase
Once you have confirmed that the order should be canceled, call the cancellation endpoint.
This request notifies HL Connector that access to the asset must be revoked.
What happens
- The order state is updated to
CANCELED - All access URLs become invalid
- The asset can no longer be downloaded or viewed
If the order is not eligible for cancellation, the API returns a validation error.
Order state after cancellation
| Status | Description |
|---|---|
CANCELED |
Access was revoked by the vendor |
Once an order reaches CANCELED, it is considered a terminal state.
Common integration pattern
A typical cancellation flow looks like this:
sequenceDiagram
participant Vendor
participant HL as HL Connector
Vendor->>Vendor: Process refund or dispute
Vendor->>HL: DELETE /purchase/cancel
HL-->>Vendor: 201 OK
Error handling
The cancellation endpoint uses standard HTTP status codes:
401— missing or invalid access token404— order or asset not found422— order cannot be canceled in its current state5xx— internal processing error
Errors are returned in a structured JSON format and are safe to log or display.
Summary
- Handle refunds and disputes entirely on your side
- Use HL Connector only to manage access revocation
- Cancel purchases when access must be removed
- Treat
CANCELEDas a final order state
This separation of responsibilities keeps your payment flow independent while ensuring correct access control for digital assets.