Skip to main content

Report Orders

Report orders assign content access and create payment records in Publica.la's financial system. Use for marketplace content sales (requires support enablement) or when you need financial tracking for externally processed sales.

Creating a Report Order

Endpoint

POST /integration-api/v1/orders

Required Fields

FieldTypeDescriptionRequired
typestringMust be "report"Yes
return_urlstringURL for redirection (informational)Yes
unit_pricefloatTotal order priceYes
currency_idstringOrder currency (ISO 4217 code: USD, ARS, etc.)Yes
userobjectUser informationYes
user.idstringUser unique ID (max 64 chars)Yes (or email)
user.emailstringUser's email addressYes (or id)
productsarrayArray of products in the orderYes
products.*.idstringProduct unique ID (max 64 chars)Yes
products.*.typestringProduct type: content or subscriptionYes
products.*.unit_pricefloatIndividual product priceYes
products.*.currency_idstringProduct currency (ISO 4217 code)Yes

Optional Fields

FieldTypeDescription
external_referencestringYour unique order identifier (max 64 chars)
products.*.namestringProduct name (required for auto-creation)
products.*.urlstringProduct URL (required for auto-creation)
products.*.expiration_datestringAccess expiration date (YYYY-MM-DD)

Request Examples

Basic Report Order

Selling marketplace content through external POS:

{
"type": "report",
"external_reference": "POS-MARKETPLACE-12345",
"return_url": "https://yourstore.publica.la/order/receipt/12345",
"unit_price": 25.00,
"currency_id": "USD",
"user": {
"id": "customer-789",
"email": "[email protected]"
},
"products": [
{
"id": "MARKETPLACE-EBOOK",
"type": "content",
"name": "Third-Party Content",
"url": "https://example.com/products/marketplace-content",
"unit_price": 25.00,
"currency_id": "USD"
}
]
}

Result:

  • Payment recorded: $25.00
  • Content access granted immediately
  • Financial records created for accounting

Report Order with Multiple Products

{
"type": "report",
"external_reference": "PARTNER-BUNDLE-456",
"return_url": "https://partner.com/sales/456",
"unit_price": 45.00,
"currency_id": "USD",
"user": {
"id": "partner-customer-123",
"email": "[email protected]"
},
"products": [
{
"id": "EBOOK-001",
"type": "content",
"name": "Book Volume 1",
"unit_price": 15.00,
"currency_id": "USD"
},
{
"id": "EBOOK-002",
"type": "content",
"name": "Book Volume 2",
"unit_price": 15.00,
"currency_id": "USD"
},
{
"id": "EBOOK-003",
"type": "content",
"name": "Book Volume 3",
"unit_price": 15.00,
"currency_id": "USD"
}
]
}

Report Order with Subscription

{
"type": "report",
"external_reference": "PARTNER-SUB-789",
"return_url": "https://partner.com/subscription/confirmation",
"unit_price": 120.00,
"currency_id": "EUR",
"user": {
"id": "corporate-client-456",
"email": "[email protected]"
},
"products": [
{
"id": "ANNUAL-ENTERPRISE",
"type": "subscription",
"unit_price": 120.00,
"currency_id": "EUR",
"expiration_date": "2025-12-31"
}
]
}
Email Notifications

When a report order is created, an email notification is automatically sent to the user confirming their purchase and providing access details. If you want to disable these automatic emails, you can turn them off in your dashboard at /dashboard/settings#notifications.

Response

Success Response (201 Created)

{
"data": {
"id": "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6",
"external_reference": "BOOKSHOP-POS-12345",
"type": "report",
"unit_price": 25.00,
"currency_id": "USD",
"status": "approved",
"created_at": "2024-11-24",
"user": {
"id": "customer-789",
"email": "[email protected]"
},
"products": [
{
"id": "EBOOK-BESTSELLER",
"type": "content",
"name": "Digital Marketing Guide",
"status": "approved",
"expiration_date": null,
"cover": "https://cdn.publica.la/content/marketing-guide.jpg",
"reader_url": "https://yourstore.publica.la/reader/digital-marketing-guide",
"description": "Complete guide to digital marketing strategies",
"pages_quantity": 320,
"file_type": "pdf",
"unit_price": 25.00,
"currency_id": "USD"
}
]
}
}

Response Fields

FieldTypeDescription
idstringPublica.la's unique order ID (UUID)
external_referencestringYour unique ID for this order
typestringAlways "report"
statusstringAlways "approved" (immediate access)
unit_pricefloatTotal order amount
currency_idstringOrder currency code
userobjectUser information
productsarrayProducts with full details

Managing Report Orders

Retrieving Orders

Get a specific report order:

GET /integration-api/v1/orders/{order_id}?id_type=internal

Get by external reference:

GET /integration-api/v1/orders/{external_ref}?id_type=external

List all report orders:

GET /integration-api/v1/orders

Updating Orders

Update the expiration date for all products in a report order.

Endpoint:

PUT /integration-api/v1/orders/{order_id}

Path Parameters:

ParameterDescription
order_idThe order's UUID (from id field) or external reference (from external_reference field)

Query Parameters:

ParameterTypeDefaultDescription
id_typestringinternalUse internal when order_id is a UUID, or external when it's an external reference

Request Body:

FieldTypeDescriptionRequired
expiration_datestringNew expiration date (YYYY-MM-DD format)Yes

Example - Update using UUID:

PUT /integration-api/v1/orders/a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6?id_type=internal

{
"expiration_date": "2025-12-31"
}

Example - Update using external reference:

PUT /integration-api/v1/orders/BOOKSHOP-POS-12345?id_type=external

{
"expiration_date": "2025-12-31"
}

Response (200 OK): Returns the updated order with modified expiration date applied to all products.

Note: This endpoint updates the expiration date for ALL products in the order.

Canceling Orders

Cancel a report order and revoke user access.

Endpoint:

DELETE /integration-api/v1/orders/{order_id}

Request Fields:

FieldTypeDescriptionRequired
reasonstringCancellation reason (min: 3, max: 150 chars)No
expiration_datestringEffective cancellation date (YYYY-MM-DD). Defaults to immediate if not provided.No

Example Request:

{
"reason": "Customer requested refund",
"expiration_date": "2024-11-24"
}

Response (200 OK): Returns the cancelled order with updated status.

Error Handling

Common Errors

Status CodeErrorCause
400Invalid currencyCurrency code not supported
401UnauthorizedInvalid or missing API token
422Validation errorMissing required fields
422Invalid productProduct doesn't exist (when auto-creation fails)
422Currency mismatchProducts have different currencies than order

Error Response Example

{
"status": 422,
"errors": [
{
"title": "The unit_price field is required",
"details": [
"Report orders must include a unit_price"
]
},
{
"title": "The products.0.currency_id field is required",
"details": [
"Each product must specify a currency_id"
]
}
]
}
X

Graph View