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:

Canceling a purchase updates the order state and immediately revokes access to the associated assets.


Important behavior



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

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:

Errors are returned in a structured JSON format and are safe to log or display.


Summary

This separation of responsibilities keeps your payment flow independent while ensuring correct access control for digital assets.