The Order Object
Orders are a core part of Crystallize. The order object has the following key components: Customer, Cart, Payment, Total, and other additional information. Let's take a look at each of these.
In order to perform these operations, ensure that you have the proper authentication (if necessary) and user permissions.
Customer Details
Once a customer places an order, the order is pushed to Crystallize. Here, we store the customer’s name, birthdate, contact details, and addresses (shipping and billing address). The example below shows what the Customer type looks like:
customer{
lastName
middleName
firstName
identifier
birthDate
addresses{
type
firstName
lastName
city
state
country
postalCode
street
street2
streetNumber
phone
email
}
}
Cart Information
Cart information includes details regarding the products purchased: name, variants, SKU, images, quantity, price-related information, subscription data, etc.
cart{
name
sku
productId
productVariantId
imageUrl
quantity
subscription{
name
period
end
}
price{
discounts{
percent
}
currency
tax{
name
percent
}
net
gross
}
}
Payment Information
The Crystallize Order API clearly defines major payment gateway providers and also supports any other implementation. You can read more details on the supported payment gateways or learn how to build your own custom solution. Shown below is an example when the payment provider is Stripe.
payment {
... on StripePayment {
paymentMethod
orderId
customerId
}
}
total {
gross
net
currency
tax {
name
percent
}
discounts {
percent
}
}
Metadata and Additional Information
An order can contain more information aside from the what is contained in the fields discussed above. Any meta information provided with the order can be accessed via the meta field. The same goes for any additional information as well.
meta {
key
value
}
additionalInformation