Order API - Create Shipment

Create shipment

Endpoint: POST *base*/shipments
Authentication: API Key

This will create a shipment and per default try to capture from the payment provider, shipment will not be created if the capture fails.

You have the ability to turn off capture to make it possible to edit the shipment after it has been created. However, if you explicitly turn off capture using "capture": false, we will not capture the money for the order automatically, and the Complete shipment call MUST be made and verified that it was successful until you can ship any products.

Parameters

order
int
required

Order ID to create shipment on.

products
object
required

Key is lineID from the Get orders response and value is the quantity. Example: {"products":{"1441":2}} will create a shipment of 2 products from item 1441.

key in object
string
required

lineID from the Get orders response referring to a specific product item in the order.

value in object
int
required

Quantity of the item that should be shipped.

gtg
boolean
optional

Default: false. Mark the shipment as good to go.

capture
boolean
optional

Default: true. If Centra should capture the shipment amount from the payment provider.

Should not be turned off unless you are capturing the money somewhere else.

shipped
boolean
optional

Mark the shipment as sent. Default: false.

carrier
string
optional

Carrier used for shipping. Only used if shipped is true.

service
string
optional

Service level used for shipping. Only used if shipped is true.

packages
int
optional

Number of packages in shipment. Only used if shipped is true.

tracking
string
optional

Tracking number for shipment. Only used if shipped is true.

returnSlipTracking
string
optional

Return slip tracking number for shipment. Only used if shipped is true.

sendEmail
boolean
optional

Decide if Shipping Confirmation e-mail should be sent. If not defined, Store setting "Send Shipping Confirmation" will be used instead. Only used if shipped is true.

deductPreviousCosts
boolean
optional

Used together with the capture param, necessary when your order is split into multiple shipments. If the first shipment you created and captured contained the shipping cost, you can use this param to skip it in the subsequent shipments. This is necessary, since the payment providers will not allow you to capture more than was authorised, so you can only charge the shipping cost once.

xml
boolean
optional

Response in xml format instead of json.

Request example

POST <base>/shipments HTTP/1.1
Content-type: application/json

{
  "order": 83651,
  "products": {
    "43243": 1,
    "43244": 2
  }
}

Response

200 Content-type: application/json

status
string
required

ok if success, else no.

order
int
optional

Order ID that the shipment was created on.

shipment
string
optional

The shipment ID for the create shipment.

deliveryNote
string
optional

URL to a PDF delivery note for the shipment.

proforma
string
optional

URL to a PDF proforma for the shipment.

invoice
string
optional

URL to a PDF invoice for the shipment. Will only be set if an invoice exists.

msg
string
optional

If status returns no, this value should send back a message why it failed.

Response example

HTTP/1.1 200 OK
Content-type: application/json

{
  "status": "ok",
  "order": 83651,
  "shipment": "83651-1",
  "deliveryNote": "http://.../delivery-note.pdf",
  "proforma": "http://.../proforma.pdf",
  "invoice": "http://.../invoice.pdf"
}

Error examples

{
  "status": "no",
  "msg": "order does not exist",
  "order": "1337"
}
{
  "msg": "can not capture order",
  "status": "no",
  "order": "5"
}

Previous article: Order API - Update order