Documentation Index
Fetch the complete documentation index at: https://docs.laravelshopper.dev/llms.txt
Use this file to discover all available pages before exploring further.
Order
The Order interface represents a customer order with three independent statuses tracking order progress, payment, and shipping.
import type { Order } from '@shopperlabs/shopper-types'
Definition
interface Order extends Entity {
number: string
price_amount: number
notes: string | null
currency_code: string
total_amount?: number
status: OrderStatus
payment_status: PaymentStatus
shipping_status: ShippingStatus
cancelled_at: DateEntity | null
archived_at: DateEntity | null
zone_id: number | null
shipping_address_id: number | null
billing_address_id: number | null
payment_method_id: number | null
customer_id: number | null
channel_id: number | null
parent_order_id: number | null
shipping_option_id?: number | null
metadata: Metadata
// Relationships
shippingOption?: CarrierOption
shippingAddress?: OrderAddress | null
billingAddress?: OrderAddress | null
paymentMethod?: PaymentMethod | null
zone?: Zone | null
channel?: Channel | null
parent?: Order | null
customer?: Customer
items?: OrderItem[]
shippings?: OrderShipping[]
children?: Order[]
refund?: OrderRefund
}
OrderStatus Enum
Tracks the overall lifecycle of the order.
enum OrderStatus {
NEW = 'new',
PROCESSING = 'processing',
COMPLETED = 'completed',
CANCELLED = 'cancelled',
ARCHIVED = 'archived',
}
PaymentStatus Enum
Tracks whether payment has been collected.
enum PaymentStatus {
PENDING = 'pending',
AUTHORIZED = 'authorized',
PAID = 'paid',
PARTIALLY_REFUNDED = 'partially_refunded',
REFUNDED = 'refunded',
VOIDED = 'voided',
}
ShippingStatus Enum
Tracks the overall shipping state at the order level.
enum ShippingStatus {
UNFULFILLED = 'unfulfilled',
PARTIALLY_SHIPPED = 'partially_shipped',
SHIPPED = 'shipped',
PARTIALLY_DELIVERED = 'partially_delivered',
DELIVERED = 'delivered',
PARTIALLY_RETURNED = 'partially_returned',
RETURNED = 'returned',
}
Usage Examples
import type { Order } from '@shopperlabs/shopper-types'
import { OrderStatus, PaymentStatus, ShippingStatus } from '@shopperlabs/shopper-types'
function canCancel(order: Order): boolean {
return (
order.status !== OrderStatus.CANCELLED &&
order.status !== OrderStatus.ARCHIVED &&
order.shipping_status === ShippingStatus.UNFULFILLED
)
}
function canCapture(order: Order): boolean {
return order.payment_status === PaymentStatus.AUTHORIZED
}
function getStatusColor(status: OrderStatus): string {
const colors: Record<OrderStatus, string> = {
[OrderStatus.NEW]: '#3b82f6',
[OrderStatus.PROCESSING]: '#2563eb',
[OrderStatus.COMPLETED]: '#059669',
[OrderStatus.CANCELLED]: '#ef4444',
[OrderStatus.ARCHIVED]: '#6b7280',
}
return colors[status]
}
function calculateTotal(order: Order): number {
return order.items?.reduce((sum, item) => sum + item.total, 0) ?? 0
}
OrderItem
The OrderItem interface represents a line item in an order. Each item tracks its own fulfillment status independently.
import type { OrderItem } from '@shopperlabs/shopper-types'
Definition
interface OrderItem extends Entity {
name: string
quantity: number
unit_price_amount: number | null
total: number
sku: string | null
product_id: number
product_type: string
order_id: number
order_shipping_id: number | null
fulfillment_status: FulfillmentStatus | null
// Relationships
order?: Order
shipment?: OrderShipping
}
FulfillmentStatus Enum
Tracks item-level fulfillment, enabling partial shipments and multi-carrier delivery.
enum FulfillmentStatus {
PENDING = 'pending',
FORWARDED_TO_SUPPLIER = 'forwarded_to_supplier',
PROCESSING = 'processing',
SHIPPED = 'shipped',
DELIVERED = 'delivered',
CANCELLED = 'cancelled',
}
OrderAddress
The OrderAddress interface represents a shipping or billing address for an order.
import type { OrderAddress } from '@shopperlabs/shopper-types'
Definition
interface OrderAddress extends Entity {
first_name: string
last_name: string
full_name: string
street_address: string
street_address_plus: string | null
postal_code: string
city: string
state: string | null
company: string | null
phone: string | null
country_name: string | null
customer_id?: number | null
customer?: Customer
}
OrderShipping
The OrderShipping interface represents a shipment, a physical package sent to the customer. Each shipment tracks its own delivery progress and has a timeline of tracking events.
import type { OrderShipping } from '@shopperlabs/shopper-types'
Definition
interface OrderShipping extends Entity {
status: ShipmentStatus | null
shipped_at: DateEntity | null
received_at: DateEntity | null
returned_at: DateEntity | null
tracking_number: string | null
tracking_url: string | null
voucher: Record<string, unknown> | null
order_id: number
carrier_id: number | null
// Relationships
order?: Order
carrier?: Carrier
items?: OrderItem[]
events?: OrderShippingEvent[]
}
ShipmentStatus Enum
Tracks the delivery progress of a single package.
enum ShipmentStatus {
PENDING = 'pending',
PICKED_UP = 'picked_up',
IN_TRANSIT = 'in_transit',
AT_SORTING_CENTER = 'at_sorting_center',
OUT_FOR_DELIVERY = 'out_for_delivery',
DELIVERED = 'delivered',
DELIVERY_FAILED = 'delivery_failed',
RETURNED = 'returned',
}
OrderShippingEvent
The OrderShippingEvent interface represents a tracking event in a shipment’s timeline.
import type { OrderShippingEvent } from '@shopperlabs/shopper-types'
Definition
interface OrderShippingEvent extends Entity {
status: ShipmentStatus
description: string | null
location: string | null
latitude: number | null
longitude: number | null
occurred_at: DateEntity | null
metadata: Record<string, unknown> | null
order_shipping_id: number
// Relationships
shipment?: OrderShipping
}
OrderRefund
The OrderRefund interface represents a refund for an order.
import type { OrderRefund } from '@shopperlabs/shopper-types'
Definition
interface OrderRefund extends Entity {
refund_reason: string | null
refund_amount: number | null
status: OrderRefundStatus
notes: string | null
currency: string
order_id: number
user_id: number | null
metadata: Metadata
order?: Order
}
OrderRefundStatus Enum
enum OrderRefundStatus {
PENDING = 'pending',
AWAITING = 'awaiting',
TREATMENT = 'treatment',
PARTIAL_REFUND = 'partial_refund',
REFUNDED = 'refunded',
CANCELLED = 'cancelled',
REJECTED = 'rejected',
}