Skip to main content

Sales API

The Sales API provides read access to your sales transaction history. Use it to sync Newclear sales data to external systems, accounting software, or analytics platforms.

Base path: /api/sales


Endpoints

MethodEndpointDescription
GET/api/salesList sales (paginated)
GET/api/sales/{id}Get a single sale by ID

GET /api/sales

Returns a paginated list of sales transactions.

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 25, max: 100)
fromstringStart date — ISO 8601 (e.g., 2024-01-01)
tostringEnd date — ISO 8601 (e.g., 2024-01-31)
sourcestringFilter by source: pos, shopify, ebay, amazon, woocommerce, walmart
statusstringcompleted, refunded, partially_refunded, voided
customer_idintegerFilter by customer ID
payment_methodstringcash, card, credit, split
sortstringcreated_at, total, customer
directionstringasc or desc

Example: Get Today's POS Sales

curl -X GET "https://prod.newclear.io/api/sales?source=pos&from=2024-06-10&to=2024-06-10" \
-H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
"success": true,
"data": [
{
"id": 8821,
"order_number": "POS-20240610-8821",
"source": "pos",
"status": "completed",
"customer": {
"id": 445,
"name": "Jane Smith",
"email": "jane@example.com"
},
"items": [
{
"product_id": 1234,
"sku": "FURN-SOFA-001",
"name": "Modern Grey Sectional Sofa",
"quantity": 1,
"unit_price": "899.00",
"discount": "0.00",
"line_total": "899.00"
}
],
"subtotal": "899.00",
"discount_total": "0.00",
"tax": "74.18",
"total": "973.18",
"payment_method": "card",
"payment_reference": "pi_3NqGhJDSFKL23abc",
"affiliate_code": null,
"affiliate_commission": null,
"staff_user_id": 7,
"created_at": "2024-06-10T14:35:22Z",
"updated_at": "2024-06-10T14:35:22Z"
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 47,
"total_pages": 2
}
}

GET /api/sales/{id}

Returns the full detail of a single sale.

Example Request

curl -X GET "https://prod.newclear.io/api/sales/8821" \
-H "Authorization: Bearer YOUR_API_KEY"

Response Fields

FieldTypeDescription
idintegerInternal sale ID
order_numberstringHuman-readable order number
sourcestringWhere the sale originated
statusstringTransaction status
customerobjectCustomer name, email, phone
itemsarrayLine items with SKU, qty, price
subtotalstringPre-discount, pre-tax total
discount_totalstringTotal discounts applied
taxstringTax amount collected
totalstringFinal amount charged
payment_methodstringHow payment was made
payment_referencestringStripe Payment Intent ID (for card payments)
affiliate_codestringReferral code used (if any)
affiliate_commissionstringCommission earned (if any)
refundsarrayRefund records (if any)
staff_user_idintegerWhich staff member processed the sale
created_atstringSale timestamp (ISO 8601)

Common Use Cases

Sync to Accounting Software

# Get all completed sales from last month
curl -X GET "https://prod.newclear.io/api/sales?from=2024-05-01&to=2024-05-31&status=completed&per_page=100" \
-H "Authorization: Bearer YOUR_API_KEY"

Get Shopify Channel Sales

curl -X GET "https://prod.newclear.io/api/sales?source=shopify&from=2024-06-01" \
-H "Authorization: Bearer YOUR_API_KEY"

Sales by Customer

curl -X GET "https://prod.newclear.io/api/sales?customer_id=445" \
-H "Authorization: Bearer YOUR_API_KEY"

Notes on Sales Data

  • Refunded sales still appear with status: refunded. Check the refunds array for refund details.
  • Amounts are returned as strings to preserve decimal precision — parse as float/decimal in your application
  • created_at timestamps are in UTC. Convert to local timezone as needed.
  • The payment_reference for Stripe card payments is the Stripe payment_intent_id — use this to cross-reference in your Stripe Dashboard.