Order API - Complete Order

Complete order

Endpoint: POST *base*/order/*orderId*
Authentication: API Key

If Create Order was used with createOnly set as true, the order will only be prepared but not finalized. By using the Complete Order-endpoint you can finalize the order to be placed properly as a second step from creating the order. This might be necessary if you first need to make sure the order can be placed (Create Order) and then finalize it after you've verified the payment (Complete Order).

You can use this endpoint multiple times for the same order, for example to save details on payment auth and capture at different times.

The Create Order call is the one validating that the products exists in stock, so if the Complete Order-call is made much later than the Create Order-call, there might be products back ordered inside the finalized order.

Parameters

The following parameters are explained in the Create Order-call, but are also supported when completing the order.

payment
object
optional
b2b b2c

Will contain information that should be inserted in regards to how the payment was handled outside of Centra.

id
int
required

The ID of the payment plugin used from Centra. If not used, the order will not be marked with a payment type at all.

auth capture
object
optional

Information about the authorization and capture of the order. Authorization was the reservation of the order, capture is when the value also has been charged.

response
string
optional

The response string from the payment type. Will be shown verbose inside Centra.

status
int
required

If the authorization/capture went through or not. 0 means pending, 1 means success, 2 means failed.

transaction
string
optional

The transaction ID of the authorization/capture.

method
string
optional

Will be shown on reports to summarize what payment method was used.

amount
decimal2 (0.00)
required

The amount that was authorized.

external_url
string
optional

If an external invoice was created, insert the URL to the invoice here.

buyerName
string
optional
b2b

Name of the buyer that placed the order.

internalComment
string
optional

Text for the "Internal comment"-field. Will only be shown internally in Centra.

poNumber
string
optional
b2b

PO number used when placing the order. Will be visible on delivery notes and invoices.

orderDate
date/datetime
optional

The time when the order was placed. Timezone is based on the location of the organization's Centra settings.

deliveryDate
date/datetime
optional

Expected time of delivery.

cancelDate
date/datetime
optional

Date when order should be cancelled if not confirmed.

warehouseGroup
string
optional

Used to define which allocation rule (previously known as "warehouse group") it should use. Default will use the one set for the market.

xml
boolean
optional

Response in xml format instead of json.

Request example

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

{
  "comment": "Completed order, here is a comment"
}

Response

200 Content-type: application/json

status
string
required

ok if success, else no.

orders
array of string
optional

List of order numbers created. An order might split up in multiple orders after completing it, this is why you might get multiple orders back.

msg
string
optional

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

Response example

{
  "orders": [
    "44"
  ],
  "status": "ok"
}

Error example

{
  "status": "no",
  "msg": "Message about why the order failed to be completed."
}