Typescript types
The following types are the response types
type ID = number | string;
type Order = {
id: ID;
reference: string;
type: "customer" | "admin" | "api";
status: string;
currency: string;
customer: Customer;
shipping_address: Address;
billing_address?: Address; // if no billing address is present shipping is used
total: string | number;
note: string;
line_items: LineItem[];
// tax // shipping coupon ect
created_at: Date | string;
updated_at: Date | string;
tags?: string;
device_metadata?: any;
metadata?: any;
};
type Customer = {
id: ID;
email: string;
phone: string;
first_name: string;
last_name: string;
created_at: Date | string;
updated_at: Date | string;
addresses?: Address[];
metadata: any;
};
type Address = {
id: ID;
type: "default" | "shipping" | "billing";
customer_id: string;
customer: Customer;
line1: string;
line2?: string;
housenumber?: string;
street?: string;
city: string;
postal_code: string;
state?: string;
country: string;
name?: string; // fallback: customer name
email?: string; // fallback: customer email
created_at: Date | string;
updated_at: Date | string;
metadata: any;
};
type LineItem = {
id: ID;
product_id?: ID;
variant_id?: ID;
sku: string;
name: string;
price: string;
quantity: number;
};