Purchase

The Purchase API lets you register, track, and manage access to purchased digital assets.

It is designed as a fully asynchronous workflow, allowing your integration to remain reliable in the presence of retries, delays, and external business events.

Use this API to convert catalog assets into completed purchases and control access throughout the asset lifecycle.


High-level flow

flowchart TD
    A[Customer wants to buy asset] --> B[POST /purchase/validate-purchase-before-payment]
    B --> C{Validation successful?}
    C -->|No| D[Display error to customer]
    C -->|Yes| E[Initiate payment on vendor side]
    E --> F[Payment successful]
    F --> G[POST /purchase/register]
    G --> H{Order status}

    H -->|PROCESSING| I[GET /purchase/info]
    I --> H

    H -->|COMPLETED| J[Access asset]
    H -->|FAILED| K[Handle failure]

Purchase model

Purchases follow an order-based model:

This model allows long-running processing while keeping your integration responsive.


Validate a purchase

Before initiating a payment, you should validate the purchase to ensure the asset is available and the customer is eligible to buy it (e.g., based on their region).

POST /purchase/validate-purchase-before-payment

What happens

If validation fails, the API returns a 400 Bad Request with a specific error code. If successful, you receive a token and its expiration timestamp (exp_date). The token must be provided during purchase registration.


Register a purchase

To start a purchase, register a new order for a catalog asset using the token obtained from the validation step.

POST /purchase/register

What happens

If an order already exists for the same parameters, the API returns a conflict response.


Track purchase status

Use the purchase info endpoint to retrieve the current state of an order.

GET /purchase/info

Depending on the processing state, the response may vary.

Possible outcomes

This allows you to implement polling and retry logic on your side.


Order statuses

Status Description
PROCESSING Order is being fulfilled
FAILED Order fulfillment failed
COMPLETED Order successfully fulfilled
CANCELED Order was canceled by the vendor

Status values are stable and safe to persist in your system.


Access purchased assets

Once an order is completed, assets can be accessed using secure URLs.

Download URL

GET /purchase/download-url

Returns a secure URL for downloading the asset file.

View URL

GET /purchase/view-url

Returns a secure URL for online viewing (for example, a sheet music viewer).


Cancel a purchase

Vendors may explicitly cancel a purchase at any time.

DELETE /purchase/cancel

Cancellation is a vendor-initiated action and represents an authoritative request to revoke access to the purchased asset.

What cancellation does

The API does not apply additional business validation to cancellation requests.


Error handling

The Purchase API uses standard HTTP status codes:

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