Downloading the list of orders
The article contains a description of the method which returns any information regarding orders created in the InPost app together with an example implementation of the method in PHP.
On this page:
Description of the method
The method returns any information regarding orders created in the InPost Pay App. The method not used in the process of binding and handling baskets/orders by a customer.
Parameters
Field name | Description | Type | Requirement status | Additional remarks |
| Page index | string | O |
|
| Page size | string | O |
|
| Order ID | string | O |
|
Request – none
Response
Field name | Description | Type | Requirement status | Additional remarks |
| Page size | integer | O |
|
| Total number of items | integer | O |
|
| Page index | integer | O |
|
| An object which returns the list of orders | object | O |
|
| Order details | object | Y |
|
| Comments to an order | string | O |
|
| An order ID assigned by the Merchant | string | Y |
|
| Order ID presented to customer and used for payment. In case of lack of customer_order_id order_id will be used. | string | O |
|
| POS id | string | Y |
|
| The date of creating an order | string($date-time) | Y |
|
| The date of an order's last update | string($date-time) | O |
|
| An object which returns any information regarding the payment | object | O |
|
| Selected payment type. Enum: [ CARD, CARD_TOKEN, GOOGLE_PAY, APPLE_PAY, BLIK_CODE, BLIK_TOKEN, PAY_BY_LINK, SHOPPING_LIMIT, DEFERRED_PAYMENT, CASH_ON_DELIVERY ] | string | Y |
|
| Payment status Enum:[ UNPAID, STARTED, PENDING, AUTHORIZED, DECLINED, CANCELLED, ERROR, COD ] | string | Y |
|
| Payment types available for a given order. List with available values: [CARD, CARD_TOKEN, GOOGLE_PAY, APPLE_PAY, BLIK_CODE, BLIK_TOKEN, PAY_BY_LINK, SHOPPING_LIMIT, DEFERRED_PAYMENT, CASH_ON_DELIVERY]
| array | O |
|
| Payment details | object | O |
|
| Reference number | string | Y |
|
| Payment Id | string | O |
|
| Security token used | string | O |
|
| Payment type | string | Y |
|
| Card token | string | O |
|
| Card Information | object | O |
|
| Card's last 4 digits | string | O |
|
| Scheme in which the card operates | string | O |
|
| Typ kart [ DEBIT, CREDIT, PREPAID, CHARGE, DEFERRED_DEBIT ] | string | O |
|
| Payment status | string | O |
|
| Payment code | string | O |
|
| Additional payment information | string | O |
|
| Error code | string | O |
|
| Payment message (code) | string | O |
|
| Transaction date | string($date-time) | O |
|
| Technical status - used to specify the authorizations that the customer may exercise for the order in the InPost Pay app. We can distinguish 3 technical statuses:
| string | Y |
|
| A descriptive status presented to the customer in the InPost Pay app - each Merchant may provide the status so that the statuses presented in InPost Mobile are compliant with the status presented to the clients in the Merchant's store. | string | Y |
|
| Order price without the delivery costs | object | Y |
|
| Net | number ($decimal) | Y |
|
| Gross | number ($decimal) | Y | |
| VAT | number ($decimal) | Y | |
| Order price with the delivery costs | object | Y |
|
| Net | number ($decimal) | Y |
|
| Gross | number ($decimal) | Y | |
| VAT | number ($decimal) | Y | |
| Value used discount coupons on order | number($decimal) | Y |
|
| Order's currency (currently, PLN only) | string | Y |
|
| List of the numbers assigned to an order's shipments | array | O |
|
| Information about the account used | object | Y |
|
| First name | string | Y |
|
| Last name | string | Y | |
| Telephone number | object | Y | |
| Prefix | string | Y | |
| User's phone number | string | Y | |
| string | Y |
| |
| User's address | object | Y |
|
| Country code | string | Y |
|
| Address | string | Y | |
| City | string | Y | |
| Postal code | string | Y | |
| Invoice data | object | O |
|
| Legal Form [PERSON, COMPANY] | string | O |
|
| Country code | string | O | |
| Id prefix | string | O | |
| tax identifier | string | O | |
| Company name | string | O | |
| First name | string | O | |
| Last name | string | O | |
| City | string | O | |
| Street | string | O | |
| Building number | string | O | |
| Apartment number | string | O | |
| Postal code | string | O | |
| string | O | ||
| Registration date | string | O | |
| Additional information | string | O | |
| Delivery Information | object | Y |
|
| Delivery method. Enum: [ APM, COURIER ] | string | Y |
|
| Delivery date | string($date-time) | Y |
|
| The options selected for a delivery | array | O |
|
| Name | string | Y |
|
| Option code | string | Y | |
| Delivery option amount | object | Y | |
| Net | number ($decimal) | Y | |
| Gross | number ($decimal) | Y | |
| VAT | number ($decimal) | Y | |
| string | O |
| |
| Phone number | object | O |
|
| Prefix | string | Y |
|
| Number | string | Y | |
| Automatic parcel locker delivery site | string | O |
|
| Delivery address | object | O |
|
| Name | string | Y |
|
| Country code | string | Y | |
| Address | string | Y | |
| City | string | Y | |
| Postal code | string | Y | |
| Object intended to transfer information related to the cost of delivery | object | Y |
|
| Net price | number ($decimal) (10,2) | Y |
|
| Gross Price (net + VAT) | number ($decimal) (10,2) | Y | |
| VAT | number ($decimal) (10,2) | Y | |
| Notes for the courier | string | O |
|
| List of the products in an order | array | Y |
|
| Product ID assigned by the Merchant | string | Y |
|
| Product category assigned by the Merchant | string | O |
|
| Ean | string | O |
|
| Product name | string | Y |
|
| Product description | string | O |
|
| Link to the product on the Merchant's website | string | O |
|
| Link to a photograph of the product. Formats preferable: png, jpg (recommendation: png without background)
| string | O |
|
| Additional product images. | object | O |
|
| Product image. Preferred size 360 x 352 | string | Y |
|
| Product image. Preferred size 360 x 504 | string | Y |
|
| Product's base price | object | Y |
|
| Net price | number ($decimal) (10,2)
| Y |
|
| Gross Price (net + VAT) | number ($decimal) (10,2) | Y | |
| VAT | number ($decimal) (10,2) | Y | |
| Object intended to transfer the lowest price of the product over the previous 30 days. Required to handle the Omibus directive | object | O |
|
| Net price | number ($decimal) (10,2)
| Y |
|
| Gross Price (net + VAT) | number ($decimal) (10,2)
| Y | |
| VAT | number ($decimal) (10,2)
| Y | |
| Object for reporting the product quantity | object | Y |
|
| product quantity | number ($decimal) | Y |
|
| Field type quantity. Available values: [DECIMAL, INTEGER]
| string | Y |
|
| Quantity unit of the product | string | O |
|
| Object intended to determine the product's attributes | array | O |
|
| Attribute name | string | Y |
|
| Attribute value | string | Y |
|
| Object intended to transfer products' variants. Object currently not used. The functionality shall be implemented in the app's subsequent versions. | object | O |
|
| Version's Id | string | Y |
|
| Version's name | string | Y |
|
| Version's detailed description | string | O |
|
| Version's type | string | O |
|
| Version's value | string | O |
|
| An object intended to transfer information related to the consents expressed by the customer for a given order | array | Y |
|
| Consent Id | string | Y |
|
| Consent version | string | O |
|
| Information whether the consent has been expressed or not | boolean | Y |
|
GET /v1/izi/orders
Example response
{
"orders": [
{
"order_details": {
"order_id": "c5bea8ea-4444-4aaa-9ccf-12345678",
"pos_id": "V123",
"order_creation_date": "2023-10-19T07:18:27.000Z",
"order_update_date": "2023-10-19T08:37:23.313Z",
"payment": {
"payment_type": "BLIK_CODE",
"payment_status": "AUTHORIZED",
"payment_details": {
"payment_reference": "1234_6e8d5ee2-26eb-4953-bb68-12344567",
"payment_type": "BLIK_CODE",
"payment_status": "AUTHORIZED",
"sdk_payment_status": "PENDING",
"payment_id": "1234567-3894-2222-3333-d9cad00781b4",
"payment_code": "00",
"payment_description": "APPROVED",
"payment_date": "2023-10-19T05:18:42.202Z",
"base_transaction_amount": {
"amount": 35.9,
"currency": "PLN"
}
},
"available_payment_types": [
"CARD",
"BLIK_CODE",
"BLIK_TOKEN",
"PAY_BY_LINK",
"SHOPPING_LIMIT",
"DEFERRED_PAYMENT"
]
},
"order_status": "ORDER_REJECTED",
"order_merchant_status_description": "Anulowano",
"order_base_price": {
"net": 19.52,
"gross": 24.01,
"vat": 4.49
},
"order_final_price": {
"net": 29.19,
"gross": 35.9,
"vat": 6.71
},
"currency": "PLN",
"delivery_references_list": []
},
"account_info": {
"name": "<secret>",
"surname": "<secret>",
"phone_number": {
"country_prefix": "+48",
"phone": "600000000"
},
"mail": "jan.kowalski@o...l",
"client_address": {
"country_code": "pl",
"city": "Warszawa",
"address": "Warszawska 3,4",
"postal_code": "00-000"
}
},
"delivery": {
"delivery_type": "APM",
"delivery_date": "2023-10-21T07:18:27.000Z",
"mail": "<secret>",
"phone_number": {
"country_prefix": "+48",
"phone": "600000000"
},
"delivery_point": "WAW73M",
"delivery_price": {
"net": 9.67,
"gross": 11.89,
"vat": 2.22
}
},
"products": [
{
"product_id": "12345",
"ean": "1234567890",
"product_name": "Zestaw balonów",
"product_link": "https://zestaw-balonow-urodzinowych",
"product_image": "https://zestaw-balonow-urodzinowych-granatowo-czarny.jpg",
"base_price": {
"net": 19.52,
"gross": 31.01,
"vat": 4.49
},
"quantity": {
"quantity": 1,
"quantity_type": "INTEGER",
"quantity_unit": "szt."
}
}
],
"consents": [
{
"consent_id": "7",
"consent_version": "2023-06-06",
"is_accepted": true
},
{
"consent_id": "3",
"consent_version": "2018-06-07",
"is_accepted": true
},
{
"consent_id": "2",
"consent_version": "2018-06-07",
"is_accepted": true
},
{
"consent_id": "4",
"consent_version": "2018-06-07",
"is_accepted": false
}
]
},
{
"order_details": {
"order_id": "123456-36ca-4731-a945-1234567890",
"pos_id": "V123456789",
"order_creation_date": "2023-10-19T07:30:46.000Z",
"order_update_date": "2023-10-19T07:56:45.748Z",
"payment": {
"payment_type": "CASH_ON_DELIVERY",
"payment_status": "COD"
},
"order_status": "ORDER_REJECTED",
"order_merchant_status_description": "Anulowano",
"order_base_price": {
"net": 1.45,
"gross": 1.78,
"vat": 0.33
},
"order_final_price": {
"net": 13.08,
"gross": 16.08,
"vat": 3
},
"currency": "PLN",
"delivery_references_list": []
},
"account_info": {
"name": "Jan",
"surname": "Kwiatkowski",
"phone_number": {
"country_prefix": "+48",
"phone": "000000000"
},
"mail": "j.kwiat@o...l",
"client_address": {
"country_code": "pl",
"city": "Warszawa",
"address": "Jana Pawła 33",
"postal_code": "00-001"
}
},
"delivery": {
"delivery_type": "APM",
"delivery_date": "2023-10-21T07:30:46.000Z",
"mail": "<secret>",
"phone_number": {
"country_prefix": "+48",
"phone": "000000000"
},
"delivery_point": "BPO02A",
"delivery_price": {
"net": 9.67,
"gross": 11.89,
"vat": 2.22
}
},
"products": [
{
"product_id": "3456",
"ean": "12345678986",
"product_name": "Magiczna gąbka",
"product_link": "https://magiczna-gabka",
"product_image": "https://magiczna-gabka.png",
"base_price": {
"net": 1.45,
"gross": 1.78,
"vat": 0.33
},
"quantity": {
"quantity": 1,
"quantity_type": "INTEGER",
"quantity_unit": "szt."
}
}
],
"consents": [
{
"consent_id": "7",
"consent_version": "2023-06-06",
"is_accepted": true
},
{
"consent_id": "3",
"consent_version": "2018-06-07",
"is_accepted": true
},
{
"consent_id": "2",
"consent_version": "2018-06-07",
"is_accepted": true
},
{
"consent_id": "4",
"consent_version": "2018-06-07",
"is_accepted": false
}
]
}
],
"page_size": 10,
"total_items": 2,
"page_index": 0
}
Example implementation in PHP
Entering the code -
Only the getOrders function has been added in the implementacjaKlienta.txt file.
/**
* Client symfony implementation used for communication between Merchant and InPost Pay application.
*
* @param InpostPayBearerServiceInterface $inpostPayBearerService <p> Bearer service interface,
* with contains creating bearer token which is required for communication with Inpost Pay </p>
*
*/
final class InpostPayClient implements InpostPayClientInterface
{
private ClientInterface $client;
private InpostPayURLCreatorInterface $URLCreator;
private InpostPayBearerServiceInterface $bearerService;
public function __construct(
ClientInterface $client,
InpostPayURLCreatorInterface $URLCreator,
InpostPayBearerServiceInterface $bearerService
) {
$this->client = $client;
$this->URLCreator = $URLCreator;
$this->bearerService = $bearerService;
}
public function getBaskets(int $pageIndex = null, int $pageSize = null): BasketsResponse
{
$path = 'baskets';
$uri = (new Uri($this->buildUri($path)))
->withQuery(Psr7\Query::build(['page_index' => $pageIndex, 'page_size' => $pageSize]));
$request = new Request(
'GET',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$content = $response->getBody()->getContents();
/**
* @var BasketsResponseArray $data
*/
$data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return BasketsResponse::fromArray($data);
} catch (\Throwable $throwable) {
throw InpostPayGetBasketsException::createResponseException($throwable);
}
}
public function getBasketBinding(string $basketId, string $browserId = null): BindingBasket
{
$path = sprintf('basket/%s/binding', $basketId);
$uri = (new Uri($this->buildUri($path)))
->withQuery(Psr7\Query::build(['browser_id' => $browserId]));
$request = new Request(
'GET',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$content = $response->getBody()->getContents();
/**
* @var BindingBasketArray $data
*/
$data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return BindingBasket::fromArray($data);
} catch (\Throwable $throwable) {
throw InpostPayGetBasketBindingException::createResponseException($throwable);
}
}
public function postBasketBinding(string $basketId, BasketBindingRequest $requestBody): ?QrCodeData
{
if (BindingMethod::PHONE()->equals($requestBody->getBindingMethod()) && !$requestBody->getPhoneNumber()) {
throw InpostPayPostBasketBindingException::createNoPhoneForPhoneBindingMethodException();
}
$path = sprintf('basket/%s/binding', $basketId);
$uri = new Uri($this->buildUri($path));
/** @var string $body */
$body = json_encode($requestBody);
$request = new Request(
'POST',
$uri,
$this->provideDefaultClientHeaders(),
$body
);
try {
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
if (HttpResponseStatus::ACCEPTED()->getValue() === $statusCode) {
return null;
}
if (HttpResponseStatus::OK()->getValue() === $statusCode) {
/**
* @var QrCodeDataArray $data
*/
$data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return QrCodeData::fromArray($data);
}
} catch (\Throwable $throwable) {
throw InpostPayPostBasketBindingException::createResponseException($throwable);
}
throw InpostPayPostBasketBindingException::createBadStatusCodeException($statusCode, $content);
}
public function putBasket(string $basketId, Basket $basket): InpostBasketId
{
$path = sprintf('basket/%s', $basketId);
$uri = new Uri($this->buildUri($path));
/** @var string $body */
$body = json_encode($basket);
$request = new Request(
'PUT',
$uri,
$this->provideDefaultClientHeaders(),
$body
);
try {
$response = $this->client->sendRequest($request);
$content = $response->getBody()->getContents();
/**
* @var array{inpost_basket_id: string} $responseData
*/
$responseData = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return InpostBasketId::fromArray($responseData);
} catch (\Throwable $throwable) {
throw InpostPayPutBasketException::createResponseException($throwable);
}
}
public function deleteBasketBinding(string $basketId, bool $ifBasketRealized = null): void
{
$path = sprintf('basket/%s/binding', $basketId);
$uri = (new Uri($this->buildUri($path)))
->withQuery(Psr7\Query::build(['if_basket_realized' => $ifBasketRealized]));
$request = new Request(
'DELETE',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
} catch (\Throwable $throwable) {
throw InpostPayDeleteBasketBindingException::createResponseException($throwable);
}
if (HttpResponseStatus::NO_CONTENT()->getValue() === $statusCode) {
return;
}
throw InpostPayDeleteBasketBindingException::createBadStatusCodeException($statusCode, $content);
}
public function deleteBrowserBinding(string $browserId): void
{
$path = sprintf('browser/%s/binding', $browserId);
$uri = new Uri($this->buildUri($path));
$request = new Request(
'DELETE',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
} catch (\Throwable $throwable) {
throw InpostPayDeleteBrowserBindingException::createResponseException($throwable);
}
if (HttpResponseStatus::NO_CONTENT()->getValue() === $statusCode) {
return;
}
throw InpostPayDeleteBrowserBindingException::createBadStatusCodeException($statusCode, $content);
}
public function getSigningKey(string $version): SigningKeyResponse
{
$path = sprintf('signing-keys/public/%s', $version);
$uri = new Uri($this->buildUri($path));
$request = new Request(
'GET',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
if (HttpResponseStatus::OK()->getValue() === $statusCode) {
/**
* @var SigningKeyResponseArray $data
*/
$data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return SigningKeyResponse::fromArray($data);
}
} catch (\Throwable $throwable) {
throw InpostPayGetSigningKeyException::createResponseException($throwable);
}
throw InpostPayGetSigningKeyException::createBadStatusCodeException($statusCode, $content);
}
public function getSigningKeys(): SigningKeysResponse
{
$path = 'signing-keys/public';
$uri = new Uri($this->buildUri($path));
$request = new Request(
'GET',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
if (HttpResponseStatus::OK()->getValue() === $statusCode) {
/**
* @var SigningKeysResponseArray $data
*/
$data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return SigningKeysResponse::fromArray($data);
}
} catch (\Throwable $throwable) {
throw InpostPayGetSigningKeysException::createResponseException($throwable);
}
throw InpostPayGetSigningKeysException::createBadStatusCodeException($statusCode, $content);
}
/**
* @return array{
* Authorization: string,
* Content-Type: string
* }
*
* @throws InpostPayEndpointException
*/
private function provideDefaultClientHeaders(): array
{
return [
'Authorization' => sprintf('Bearer %s', $this->bearerService->getBearerToken()),
'Content-Type' => 'application/json',
];
}
private function buildUri(string $path): string
{
return sprintf(
'%s%s',
$this->URLCreator->create()->getUrl(),
$path
);
}
public function postOrderEvent(string $orderId, OrderEventRequest $orderEventRequest): void
{
$path = sprintf('order/%s/event', $orderId);
$uri = new Uri($this->buildUri($path));
/** @var string $body */
$body = json_encode($orderEventRequest);
$request = new Request(
'POST',
$uri,
$this->provideDefaultClientHeaders(),
$body
);
try {
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
} catch (\Throwable $throwable) {
throw InpostPayPostOrderEventException::createResponseException($throwable);
}
if (HttpResponseStatus::CREATED()->getValue() === $statusCode) {
return;
}
throw InpostPayPostOrderEventException::createBadStatusCodeException($statusCode, $content);
}
public function getOrders(int $pageIndex = null, int $pageSize = null): OrdersResponse
{
$path = 'orders';
$uri = (new Uri($this->buildUri($path)))
->withQuery(Psr7\Query::build(['page_index' => $pageIndex, 'page_size' => $pageSize]));
$request = new Request(
'GET',
$uri,
$this->provideDefaultClientHeaders()
);
try {
$response = $this->client->sendRequest($request);
$content = $response->getBody()->getContents();
/**
* @var OrdersResponseArray $data
*/
$data = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
return OrdersResponse::fromArray($data);
} catch (\Throwable $throwable) {
throw InpostPayGetOrdersException::createResponseException($throwable);
}
}
}
SDK.zip contains a code which includes the object of the request and of the endpoint response.