Crystallize

API Documentation

API documentation of the public Crystallize REST calls.

Product

GET

Product fetch

Fetches a product from the repository. The parameter can either be the internal ID or the product SKU.
ENDPOINT
ACCPETED HEADERS
Authorization
X-Crystallize-Tenant
X-Crystallize-Token
Response
{
"id": 152,
"sku": "SPS-243-369",
"name": "My Test Product",
"is_virtual": 1,
"is_subscription": 1,
"contenttype_id": null,
"current_version": 0,
"created": "2018-07-16 11:17:47",
"modified": "2018-07-16 11:17:48",
"main_image_id": 0,
"is_subscription_only": 0,
"is_giftable": 1,
"default_variation_id": 337,
"vat_type": [
{
"id": 1,
"name": "Norway tax",
"percentage": 67.78,
"product_id": 152,
"vattype_id": 1
}
],
"product_options": [],
"subscription_plans": [
{
"id": 1,
"initial_period": 2,
"initial_period_unit": "weeks",
"duration": 3,
"duration_unit": "months",
"renewal_term": "{ }",
"cancellation_term": "{ }",
"product_id": 152,
"name": "my first subscription plan"
}
],
"dimensions": [
{
"id": 115,
"product_id": 152,
"name": "Color",
"values": [
{
"id": 233,
"name": "Blue",
"variationdimension_id": 115,
"product_id": 152
},
{
"id": 234,
"name": "Orange",
"variationdimension_id": 115,
"product_id": 152
}
]
}
],
"variations": [
{
"id": 337,
"variation_sku": "SPS-243-369-Blue",
"price_ex_vat": 100,
"stock_count": 100,
"product_id": 152,
"is_restockable": 0,
"attributes": [
{
"id": 292,
"attribute_key": "Color",
"attribute_value": "Blue",
"productvariation_id": 337,
"product_id": 152
}
],
"variation_plans": []
},
{
"id": 338,
"variation_sku": "SPS-243-369-Orange",
"price_ex_vat": 200,
"stock_count": 100,
"product_id": 152,
"is_restockable": 0,
"attributes": [
{
"id": 293,
"attribute_key": "Color",
"attribute_value": "Orange",
"productvariation_id": 338,
"product_id": 152
}
],
"variation_plans": []
}
],
"images": []
}
GET

Product list

Retrieve a list of all available products
ENDPOINT
ACCPETED HEADERS
Authorization
X-Crystallize-Tenant
X-Crystallize-Token
Response
    {
"id": 152,
"sku": "SPS-243-369",
"name": "My Test Product",
"is_virtual": 1,
"is_subscription": 1,
"contenttype_id": null,
"current_version": 0,
"created": "2018-07-16 11:17:47",
"modified": "2018-07-16 11:17:48",
"main_image_id": 0,
"is_subscription_only": 0,
"is_giftable": 1,
"default_variation_id": 337,
"fields": [],
"link": "/",
"variations": [
{
"id": 337,
"variation_sku": "SPS-243-369-Blue",
"price_ex_vat": 100,
"stock_count": 100,
"image": [
"undefined"
],
"product_id": 152,
"is_restockable": 0,
"attributes": [
{
"id": 292,
"attribute_key": "Color",
"attribute_value": "Blue",
"productvariation_id": 337,
"product_id": 152
}
],
"variation_plans": []
},
{
"id": 338,
"variation_sku": "SPS-243-369-Orange",
"price_ex_vat": 200,
"stock_count": 100,
"image": [
"undefined"
],
"product_id": 152,
"is_restockable": 0,
"attributes": [
{
"id": 293,
"attribute_key": "Color",
"attribute_value": "Orange",
"productvariation_id": 338,
"product_id": 152
}
],
"variation_plans": []
}
]
}
]
POST

Validate Cart Items

validates cart items by reference-price. On success sends back complete cart of items with tax percentages. On failure responds with items that have failed to pass validation. Also provides ability to validate a coupon, returning it as a cart item
ENDPOINT
ACCPETED HEADERS
Content-Type
X-Crystallize-Tenant
X-Crystallize-Token
BODY
{
"items": [
     {
        "discount_rate": 0,
        "name": "Blue",
        "quantity": 25,
        "reference": "BP-1-83-crystal",
        "tax_rate": 0,
        "type": "shipping_fee",
        "unit_price": 954
    },
    {
        "discount_rate": 0,
        "name": "Blue",
        "quantity": 25,
        "reference": "BP-1-454-44-molecule",
        "tax_rate": 0,
        "type": "shipping_fee",
        "unit_price": 800
    }
],
"coupon":{
  "code":"CRYSTALLIZE"
}
 
}
Response
[
{
"name": "Blue Crystal",
"quantity": 1,
"reference": "SPS-243-369-Blue",
"tax_rate": 0,
"type": "shipping_fee",
"unit_price": 100,
"vat": 25
}
]

Orders

Using the order Endpoint you can list or create orders from/in our system

POST

Create Order

Create an order with either Stripe or Klarna data
ENDPOINT
ACCPETED HEADERS
Content-Type
X-Crystallize-Tenant
X-Crystallize-Token
BODY
{  
  
   "recurring":false,
   "recurring_token":null,
   "klarna_id":null,
   "payment_method":"stripe",
   "stripe_token": "søldfldsfdskf",
   "stripe_token_type": "card",
   "stripe_customer_id": "dsohfølsdhfldsflkdshfløsh",
   "stripe_subscription_id":"ØLHØLHØFHLØHDF",
   "first_name":"Toby",
   "last_name":"the Molecule",
   "billing_address":{  
      "given_name":"Toby",
      "family_name":"the Molecule",
      "street_address":"Shiny Avenue 23",
      "postal_code":"3712",
      "city":"Moleculia",
      "country":"Crystallize Planet",
      "email":"hello@crystallize.digital",
      "phone":"11 11 11 11"
   },
   "shipping_address":{  
      "given_name":"Toby",
      "family_name":"the Molecule",
      "street_address":"Shiny Avenue 23",
      "postal_code":"3712",
      "city":"Moleculia",
      "country":"Crystallize Planet",
      "email":"hello@crystallize.digital",
      "phone":"11 11 11 11"
   },
   "cart":{  
      "items":[  
         {  
            "discount_rate":0,
            "name":"Premium Crystal",
            "quantity":30,
            "reference":"SPS-243-369-Blue",
            "tax_rate":0,
            "total_price_excluding_tax":100,
            "total_price_including_tax":100,
            "total_tax_amount":0,
            "type":"physical",
            "unit_price":100
         }
      ],
      "total_price_excluding_tax":100,
      "total_tax_amount":0,
      "total_price_including_tax":100
   }
}
Response
{
"recurring": false,
"recurring_token": null,
"klarna_id": null,
"payment_method": "stripe",
"stripe_token": "STRIPETOKEN",
"stripe_token_type": "card",
"stripe_customer_id": "STRIPECUSTOMERID",
"stripe_subscription_id": null,
"first_name": "Toby",
"last_name": "the Molecule",
"billing_address": {
"given_name": "Toby",
"family_name": "the Molecule",
"street_address": "Shiny Avenue 23",
"postal_code": "3712",
"city": "Moleculia",
"country": "Crystallize Planet",
"email": "hello@crystallize.digital",
"phone": "11 11 11 11"
},
"shipping_address": {
"given_name": "Toby",
"family_name": "the Molecule",
"street_address": "Shiny Avenue 23",
"postal_code": "3712",
"city": "Moleculia",
"country": "Crystallize Planet",
"email": "hello@crystallize.digital",
"phone": "11 11 11 11"
},
"cart": {
"items": [
{
"discount_rate": 0,
"name": "Premium Crystal",
"quantity": 30,
"reference": "SPS-243-369-Blue",
"tax_rate": 0,
"total_price_excluding_tax": 100,
"total_price_including_tax": 100,
"total_tax_amount": 0,
"type": "physical",
"unit_price": 100,
"id": 152,
"order_line_id": 845,
"variation_id": 337,
"variation_sku": "SPS-243-369-Blue",
"product_id": 152
}
],
"total_price_excluding_tax": 100,
"total_tax_amount": 0,
"total_price_including_tax": 100
},
"crystallize_customer_id": 78,
"id": 884
}
GET

Order list

Provides a list of all orders in the system
ENDPOINT
ACCPETED HEADERS
Authorization
X-Crystallize-Tenant
Response
[{
"id": 884,
"klarna_id": null,
"creation_date": "2018-07-16 11:46:41",
"last_modified_date": "2018-07-16 11:46:41",
"stage": 1,
"status": "active",
"first_name": "Toby",
"last_name": "the Molecule",
"billing_address_id": 849,
"shipping_address_id": 849,
"total_price_excluding_tax": 1,
"total_tax_amount": 0,
"total_price_including_tax": 1,
"customer_id": 78,
"coupon_id": null,
"payment_method": "stripe",
"payment_gateway_id": "222"
}
]
GET

Order fetch

Fetches an order by id.
ENDPOINT
ACCPETED HEADERS
Authorization
X-Crystallize-Tenant
Response
{
"id": 884,
"crystallize_customer_id": 78,
"recurring": false,
"recurring_token": null,
"klarna_id": null,
"payment_method": "stripe",
"stripe_token": "STRIPETOKEN",
"stripe_token_type": "card",
"stripe_customer_id": "STRIPECUSTOMERID",
"stripe_subscription_id": null,
"first_name": "Toby",
"last_name": "the Molecule",
"billing_address": {
"given_name": "Toby",
"family_name": "the Molecule",
"street_address": "Shiny Avenue 23",
"postal_code": "3712",
"city": "Moleculia",
"country": "Crystallize Planet",
"email": "hello@crystallize.digital",
"phone": "11 11 11 11"
},
"shipping_address": {
"given_name": "Toby",
"family_name": "the Molecule",
"street_address": "Shiny Avenue 23",
"postal_code": "3712",
"city": "Moleculia",
"country": "Crystallize Planet",
"email": "hello@crystallize.digital",
"phone": "11 11 11 11"
},
"cart": {
"items": [
{
"discount_rate": 0,
"name": "Premium Crystal",
"quantity": 30,
"reference": "SPS-243-369-Blue",
"tax_rate": 0,
"total_price_excluding_tax": 100,
"total_price_including_tax": 100,
"total_tax_amount": 0,
"type": "physical",
"unit_price": 100,
"id": 152,
"order_line_id": 845,
"variation_id": 337,
"variation_sku": "SPS-243-369-Blue",
"product_id": 152
}
],
"total_price_excluding_tax": 100,
"total_tax_amount": 0,
"total_price_including_tax": 100
}
}

Customer

GET

Fetch Customer Inf

Fetches info about a customer, his subscriptions and orders
ENDPOINT
ACCPETED HEADERS
X-Crystallize-Tenant
Authorization
Response
{
"id": 78,
"first_name": "Toby",
"last_name": "the Molecule",
"email": "hello@crystallize.digital",
"phone": "11 11 11 11",
"facebook_id": null,
"created_at": "2018-07-16 11:46:41",
"updated_at": "2018-07-16 11:46:41",
"gender": null,
"date_of_birth": null,
"picture_url": "https://image.freepik.com/free-icon/user-image-with-black-background_318-34564.jpg",
"subscriptions": [],
"orders": [
{
"klarna_id": null,
"date": "2018-07-16 11:46:41",
"price": 1,
"items": [
{
"name": "Premium Crystal",
"sku": "SPS-243-369-Blue",
"price": "1"
}
]
}
],
"comments": [],
"billing_address": {
"type": "billing",
"id": 849,
"first_name": "Toby",
"last_name": "the Molecule",
"email": "hello@crystallize.digital",
"street_address": "Shiny Avenue 23",
"street_address2": null,
"postal_code": "3712",
"city": "Moleculia",
"region": null,
"phone": "11 11 11 11",
"country": "Crystallize Planet"
},
"shipping_address": {
"type": "shipping",
"id": 849,
"first_name": "Toby",
"last_name": "the Molecule",
"email": "hello@crystallize.digital",
"street_address": "Shiny Avenue 23",
"street_address2": null,
"postal_code": "3712",
"city": "Moleculia",
"region": null,
"phone": "11 11 11 11",
"country": "Crystallize Planet"
}
}
GET

Customer list

Fetches a list of all customers
ENDPOINT
ACCPETED HEADERS
Authorization
X-Crystallize-Tenant
Response
[
{
"id": 78,
"first_name": "Toby",
"last_name": "the Molecule",
"email": "hello@crystallize.digital",
"phone": "11 11 11 11",
"facebook_id": null,
"created_at": "2018-07-16 11:46:41",
"updated_at": "2018-07-16 11:46:41",
"gender": null,
"date_of_birth": null
}
]