Orders

On this page, we'll dive into the different order endpoints you can use to get or sync order information between systems. We'll look at how to list, create and delete orders.

The order model

The order model contains all the information about an order, such as their id, status, and items. You can use this to get a single order or when you're creating an order.

Properties

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the order. You will use this in other endpoints. For instance, to get a single order or when you're deleting an order.

  • Name
    user_id
    Type
    integer
    Description

    The id of the user you got when authenticating.

  • Name
    order_placed_by_id
    Type
    integer
    Description

    Your user id. This is used to track where the order came from.

  • Name
    shipping_address
    Type
    array
    Description

    An address model with all its shipping information.

  • Name
    invoice_address
    Type
    array
    Description

    An address model with all its invoice information.

  • Name
    shipment_style
    Type
    string
    Description

    The style of shipment that needs to be used.

    Shipment style optionsdeliveryThe order should be delivered to the delivery address.pick_upThis indicates that the customer will pick up the order at VDH Solar.
  • Name
    reference
    Type
    string
    Description

    A reference that needs to be places on the order.

  • Name
    note
    Type
    string
    Description

    A note that needs to be places on the order.

  • Name
    items
    Type
    array
    Description

    A list of items that are part of the order.

  • Name
    unit_price_excl_vat
    Type
    integer
    Readonly
    readonly
    Description

    This is the unit price of the product excluding VAT in cents.

  • Name
    unit_price_incl_vat
    Type
    integer
    Readonly
    readonly
    Description

    This is the unit price of the product including VAT in cents.

  • Name
    total_price_excl_vat
    Type
    integer
    Readonly
    readonly
    Description

    This is the total price of the product excluding VAT in cents.

  • Name
    total_price_incl_vat
    Type
    integer
    Readonly
    readonly
    Description

    This is the total price of the product including VAT in cents.

  • Name
    vat_amount
    Type
    integer
    Readonly
    readonly
    Description

    This is the VAT amount of the product in cents.

  • Name
    payment
    Type
    array
    Readonly
    readonly
    Description

    A payment model with all its information.

  • Name
    shipment
    Type
    array
    Readonly
    readonly
    Description

    A shipment model with all its information.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the order was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the order was last updated.


POST/v1/orders

Create an order

This endpoint allows you to create an order on the behalf of VDH-Solar customer. To do this you will need to have the VDH-Solar customer authenticate using Oauth2. Refer to the list at the top of this page to see which properties are included with order objects.

Attributes

  • Name
    user_id
    Type
    integer
    Required
    required
    Description

    The id of the user you got when authenticating.

  • Name
    order_placed_by_id
    Type
    integer
    Required
    required
    Description

    Your user id. This is used to track where the order came from.

  • Name
    shipping_address
    Type
    array
    Required
    required
    Description

    An address model with all its shipping information.

  • Name
    invoice_address
    Type
    array
    Required
    required
    Description

    An address model with all its invoice information.

  • Name
    items
    Type
    array
    Required
    required
    Description

    A list of items that are part of the order.

  • Name
    reference
    Type
    string
    Description

    A reference that needs to be places on the order.

  • Name
    note
    Type
    string
    Description

    A note that needs to be places on the order.

Request

POST
/v1/orders
$client = new \VdhSolar\ApiClient('eyJ...');

$client->orders->create([
  'user_id' => 1,
  'order_placed_by_id' => 30001,
  'shipping_address' => [
    // ...
  ],
  'invoice_address' => [
    // ...
  ],
  'reference' => 'VDH Test Order',
  'note' => 'This is a test order',
  'items' => [
    [
      'product_id' => 12345,
      'quantity' => 1,
    ],
    // ...
  ],
]);

Response

{
  "data": {
    "id": 1,
    "user_id": 1,
    "order_placed_by_id": 30001,
    "shipping_address": [],
    "invoice_address": [],
    "reference": "VDH Test Order",
    "note": "This is a test order",
    "items": [{
      "product_id": 12345,
      "quantity": 1,
      "unit_price_excl_vat": 10000,
      "unit_price_incl_vat": 12100,
      "total_price_excl_vat": 10000,
      "total_price_incl_vat": 12100,
      "vat_amount": 2100,
    }],
    "unit_price_excl_vat": 10000,
    "unit_price_incl_vat": 12100,
    "total_price_excl_vat": 10000,
    "total_price_incl_vat": 12100,
    "status": "pending",
    "payment": {
      "status": "pending",
      "pay": "https://vdh-solar.nl/pay/order/1",
    },
    "shipment": {
      "style": "delivery",
      "requested_date": "2024-12-31",
      "shipped_date": "2024-12-31",
      "delivered_date": "2024-12-31",
      "track_and_trace": "https:://track-and-trace.com/123456",
    },
    "updated_at": "555931527",
    "created_at": "555931527",
  }
}

GET/v1/orders/:id

Retrieve an order

This endpoint allows you to retrieve a order by providing the order id. Refer to the list at the top of this page to see which properties are included with conversation objects. Please note that you can only retrieve orders that you have created.

Request

GET
/v1/orders/1
$client = new \VdhSolar\ApiClient('eyJ...');

$client->orders->get(1);

Response

{
  "data": {
    "id": 1,
    "user_id": 1,
    "order_placed_by_id": 30001,
    "shipping_address": [],
    "invoice_address": [],
    "reference": "VDH Test Order",
    "note": "This is a test order",
    "items": [{
      "product_id": 12345,
      "quantity": 1,
      "unit_price_excl_vat": 10000,
      "unit_price_incl_vat": 12100,
      "total_price_excl_vat": 10000,
      "total_price_incl_vat": 12100,
      "vat_amount": 2100,
    }],
    "unit_price_excl_vat": 10000,
    "unit_price_incl_vat": 12100,
    "total_price_excl_vat": 10000,
    "total_price_incl_vat": 12100,
    "status": "pending",
    "payment": {
      "status": "pending",
      "pay": "https://vdh-solar.nl/pay/order/1",
    },
    "shipment": {
      "style": "delivery",
      "requested_date": "2024-12-31",
      "shipped_date": "2024-12-31",
      "delivered_date": "2024-12-31",
      "track_and_trace": "https:://track-and-trace.com/123456",
    },
    "updated_at": "555931527",
    "created_at": "555931527",
  }
}

DELETE/v1/orders/:id

Delete an order

This endpoint allows you to delete orders in VDH-Solar. Note: You are only allowed to delete orders that you have created and that are in a pending state.

Request

DELETE
/v1/orders/1
$client = new \VdhSolar\ApiClient('eyJ...');

$client->orders->delete(1);

Response

{
  "data": {
    "success": true,
  }
}

Error response

{
  "type": "order_deletion_error",
  "message": "The order is in transit. You can't delete it.",
  "documentation_url": "https://docs.vdh-solar.nl/orders#delete-an-order"
}

Was this page helpful?