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.
Will contain information that should be inserted in regards to how the payment was handled outside of Centra.
The ID of the payment plugin used from Centra. If not used, the order will not be marked with a payment type at all.
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.
The response string from the payment type. Will be shown verbose inside Centra.
If the authorization/capture went through or not. 0
means pending, 1
means success, 2
means failed.
The transaction ID of the authorization/capture.
Will be shown on reports to summarize what payment method was used.
The amount that was authorized.
If an external invoice was created, insert the URL to the invoice here.
Name of the buyer that placed the order.
Text for the "Internal comment"-field. Will only be shown internally in Centra.
PO number used when placing the order. Will be visible on delivery notes and invoices.
The time when the order was placed. Timezone is based on the location of the organization's Centra settings.
Expected time of delivery.
Date when order should be cancelled if not confirmed.
Used to define which allocation rule (previously known as "warehouse group") it should use. Default will use the one set for the market.
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
ok
if success, else no
.
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.
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."
}