Status zamówienia
Callback statusu pozwala na aktualizację statusu realizacji zamówienia w aplikacji użytkownika. Poprawia to doświadczenie zakupowe klienta i zmniejsza prawdopodobieństwo jego kontaktu z biurem obsługi sklepu. Patrz krok 12 na diagramie:
Poniżej znajduje się lista statusów zamówień dostępnych dla merchantów. Przejście do nowego statusu odbywa się przez wysłanie nowego statusu zamówienia.
- ORDERED oznacza status zamówienia skutecznie złożonego przez użytkownika i przyjętego przez backend merchanta,
- FULFILLED oznacza status zamówienia skompletowanego i przygotowanego do wysyłki,
- SHIPPED oznacza status zamówienia wysłanego do użytkownika - odebranego przez operatora lub wysłanego transportem własnym sklepu,
- READY_FOR_PICKUP oznacza status zamówienia dostarczonego do punktu odbioru - Paczkomatu lub własnego punktu odbioru sklepu,
- DELIVERED oznacza status zamówienia odebranego przez użytkownika lub dostarczonego pod wskazany adres,
- CANCELLED_MERCHANT oznacza status zamówienia anulowanego przez sklep (z dowolnego powodu). Status ten jest możliwy do momentu przejścia zamówienia w status DELIVERED (zmiana dokonana przez sklep lub OpenApp).
Logiczna sekwencja zmian statusów (każdy krok może zostać pominięty):
NEW -> ORDERED -> FULFILLED -> SHIPPED -> READY_FOR_PICKUP -> DELIVERED
NEW -> ORDERED -> FULFILLED -> SHIPPED -> IN_DELIVERY -> DELIVERED
Zamówienie wysyłane w jednej przesyłce
Żądanie
Aktualizacja statusu zamówienia jest wykonywana przez żądanie POST na następujący endpoint:
POST {{OpenAppUrl}}/merchant/v1/orders/fulfillment
Treść żądania zawiera informacje o statusie realizacji:
- Żądanie
- Schemat
{
"oaOrderId": "OA12345678901234",
"shopOrderId": "WS1213ASDZXC231A",
"status": "READY_FOR_PICKUP",
"notes": "free text description",
"shipping": {
"operator": "INPOST_APM",
"trackingCode": "z123",
"trackingUrl": "https://example.invalid/tracking?c=z123"
}
}
oaOrderIdstringWymaganeshopOrderIdstringWymaganestatusenumWymaganeMożliwe wartości: CANCELLED_MERCHANTDELIVEREDFULFILLEDIN_DELIVERYORDEREDREADY_FOR_PICKUPSHIPPED
notesstringWymaganeshippingobiektOpcjonalnePokaż parametry podrzędneUkryj parametry podrzędne3
operatorstringOpcjonalneThe operator of the shipment
maxLength: 64
trackingCodestringOpcjonalneThe tracking code.
maxLength: 64
trackingUrlstringOpcjonalneThe tracking URL.
maxLength: 255
Surowy schemat JSON
{
"additionalProperties": false,
"type": "object",
"properties": {
"oaOrderId": {
"type": "string",
"title": "oaOrderId"
},
"shopOrderId": {
"type": "string",
"title": "shopOrderId"
},
"status": {
"$ref": "#/definitions/StoreDeliveryStatus",
"title": "status"
},
"notes": {
"type": "string",
"title": "notes"
},
"shipping": {
"additionalProperties": false,
"$ref": "#/definitions/OrderShipment",
"title": "shipping"
}
},
"required": [
"notes",
"oaOrderId",
"shopOrderId",
"status"
],
"definitions": {
"StoreDeliveryStatus": {
"title": "StoreDeliveryStatus",
"enum": [
"CANCELLED_MERCHANT",
"DELIVERED",
"FULFILLED",
"IN_DELIVERY",
"ORDERED",
"READY_FOR_PICKUP",
"SHIPPED"
],
"type": "string"
},
"OrderShipment": {
"additionalProperties": false,
"title": "OrderShipment",
"type": "object",
"properties": {
"operator": {
"description": "The operator of the shipment",
"maxLength": 64,
"type": "string",
"title": "operator"
},
"trackingCode": {
"description": "The tracking code.",
"maxLength": 64,
"type": "string",
"title": "trackingCode"
},
"trackingUrl": {
"description": "The tracking URL.",
"maxLength": 255,
"type": "string",
"title": "trackingUrl"
}
}
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
Odpowiedź
W odpowiedzi OpenApp potwierdzi przyjęcie aktualizacji statusu.
Błędy
| Nazwa błędu | Kod |
|---|---|
IncorrectDeliveryStatusException | 400 |
OrderNotFoundException | 404 |
MerchantOrderOwnershipException | 404 |
Zamówienie rozdzielone na kilka przesyłek
Możliwe jest, że zamówienie zostanie wysłane w kilku przesyłkach. Aby poinformować o tym OpenApp i użytkownika, należy użyć endpointu multi-fulfillment opisanego poniżej.
Po rozdzieleniu zamówienia na wiele przesyłek nie można już korzystać z endpointu dla pojedynczej przesyłki. Ponadto każda stworzona przesyłka musi być obecna w każdym żądaniu do endpointu multi-fulfillment. Jeśli zamówienie zostało podzielone na 3 przesyłki, statusy należy aktualizować z 3 przesyłkami na liście. Jeśli następnie zostaną połączone w 2 przesyłki, nadal należy wysyłać 3 przesyłki (trzecia może mieć oczywiście status anulowany).
Żądanie
Aktualizacja statusu jest wykonywana przez żądanie POST na następujący endpoint:
POST {{OpenAppUrl}}/merchant/v1/orders/multiFulfillment
Treść żądania zawiera informacje o statusie realizacji:
- Żądanie
- Schemat
{
"oaOrderId": "OA12345678901234",
"shopOrderId": "WS1213ASDZXC231A",
"shipments": [
{
"shipmentId": "hkkdf378723_1",
"status": "READY_FOR_PICKUP",
"notes": "free text description",
"operator": "INPOST_APM",
"trackingCode": "z123",
"trackingUrl": "https://example.invalid/tracking?c=z123",
"products": [
{
"id": "productxyz",
"quantity": 5
}
],
"timing": "dec 1 - dec 2"
},
{
"shipmentId": "hkkdf378723_2",
"status": "FULFILLED"
}
]
}
oaOrderIdstringWymaganeshopOrderIdstringWymaganeshipmentstablica typu OrderShipmentMultiWymaganeThe shipments for the order
Pokaż parametry podrzędneUkryj parametry podrzędne8
shipmentIdstringWymaganeThe id of the shipment
maxLength: 64
statusenumWymaganeThe status of the shipment
Możliwe wartości: CANCELLED_MERCHANTDELIVEREDFULFILLEDIN_DELIVERYORDEREDREADY_FOR_PICKUPSHIPPED
notesstringOpcjonalneOptional merchant notes on the shipment
maxLength: 64
productstablica typu OrderShipmentProductOpcjonalneThe products which will be in this shipment
Pokaż parametry podrzędneUkryj parametry podrzędne2
idstringWymaganeThe unique ID of the product.
maxLength: 36
quantityintegerWymaganeThe number of items in the purchase.
minimum: 0
timingstringOpcjonalneThe estimation of the delivery time, i.e. 'next business day' or 'July 18th'.
maxLength: 40
operatorstringOpcjonalneThe operator of the shipment
maxLength: 64
trackingCodestringOpcjonalneThe tracking code.
maxLength: 64
trackingUrlstringOpcjonalneThe tracking URL.
maxLength: 255
Surowy schemat JSON
{
"additionalProperties": false,
"type": "object",
"properties": {
"oaOrderId": {
"type": "string",
"title": "oaOrderId"
},
"shopOrderId": {
"type": "string",
"title": "shopOrderId"
},
"shipments": {
"description": "The shipments for the order",
"type": "array",
"items": {
"$ref": "#/definitions/OrderShipmentMulti"
},
"title": "shipments"
}
},
"required": [
"oaOrderId",
"shipments",
"shopOrderId"
],
"definitions": {
"OrderShipmentMulti": {
"additionalProperties": false,
"title": "OrderShipmentMulti",
"type": "object",
"properties": {
"shipmentId": {
"description": "The id of the shipment",
"maxLength": 64,
"type": "string",
"title": "shipmentId"
},
"status": {
"$ref": "#/definitions/StoreDeliveryStatus",
"description": "The status of the shipment",
"title": "status"
},
"notes": {
"description": "Optional merchant notes on the shipment",
"maxLength": 64,
"type": "string",
"title": "notes"
},
"products": {
"description": "The products which will be in this shipment",
"type": "array",
"items": {
"$ref": "#/definitions/OrderShipmentProduct"
},
"title": "products"
},
"timing": {
"description": "The estimation of the delivery time, i.e. 'next business day' or 'July 18th'.",
"maxLength": 40,
"type": "string",
"title": "timing"
},
"operator": {
"description": "The operator of the shipment",
"maxLength": 64,
"type": "string",
"title": "operator"
},
"trackingCode": {
"description": "The tracking code.",
"maxLength": 64,
"type": "string",
"title": "trackingCode"
},
"trackingUrl": {
"description": "The tracking URL.",
"maxLength": 255,
"type": "string",
"title": "trackingUrl"
}
},
"required": [
"shipmentId",
"status"
]
},
"StoreDeliveryStatus": {
"title": "StoreDeliveryStatus",
"enum": [
"CANCELLED_MERCHANT",
"DELIVERED",
"FULFILLED",
"IN_DELIVERY",
"ORDERED",
"READY_FOR_PICKUP",
"SHIPPED"
],
"type": "string"
},
"OrderShipmentProduct": {
"additionalProperties": false,
"title": "OrderShipmentProduct",
"type": "object",
"properties": {
"id": {
"description": "The unique ID of the product.",
"maxLength": 36,
"type": "string",
"title": "id"
},
"quantity": {
"description": "The number of items in the purchase.",
"minimum": 0,
"type": "integer",
"title": "quantity"
}
},
"required": [
"id",
"quantity"
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
Odpowiedź
W odpowiedzi OpenApp potwierdzi status.
Błędy
| Nazwa błędu | Kod |
|---|---|
OrderNotFoundException | 404 |
MerchantOrderOwnershipException | 404 |