// install dependency
// $ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$transaction = [
'type' => 'SHIPPING_NOTICE',
'content' => [
'header' => [
'buyer' => [
'name' => 'ACME Co. Ltd.',
'identifiers' => [
[
'identifier' => '3220010000005',
'domain' => 'GS1'
]
]
],
'supplier' => [
'name' => 'Testsupplier',
'identifiers' => [
[
'identifier' => '3220010000010',
'domain' => 'GS1'
]
]
],
'shipTo' => [
'identifiers' => [
[
'identifier' => '3220010000005',
'domain' => 'GS1'
]
]
],
'billTo' => [
'identifiers' => [
[
'identifier' => '3220010000006',
'domain' => 'GS1'
]
]
],
'shippingNoticeIdentifier' => 'SN9383-R45',
'shippingNoticeDate' => '2021-11-24',
'orderIdentifier' => 'PO9383-R45',
'orderDate' => '2021-11-20',
'despatchDate' => '2021-11-05',
'requestedDeliveryDate' => '2021-11-06',
'expectedDeliveryDate' => '2021-11-06'
],
'transportUnits' => [
[
'unitIdentifier' => '34000000000001',
'unitType' => 'EURO_PALLET',
'containedTradeUnitCount' => 10,
'items' => [
[
'lineNumber' => 1,
'orderLineNumber' => 1,
'identifiers' => [
[
'identifier' => '2330010000061',
'domain' => 'GS1'
],
[
'identifier' => 'filter-coffee',
'domain' => 'BUYER'
],
[
'identifier' => 'supplier-filter-coffee',
'domain' => 'SUPPLIER'
]
],
'isDepositItem' => false,
'orderedQuantity' => 20,
'shippedQuantity' => 20,
'description' => 'First product description.',
'batches' => [
[
'batchIdentifier' => 'BATCH_ID_1',
'expirationDate' => '2022-12-24',
'quantity' => 15
],
[
'batchIdentifier' => 'BATCH_ID_2',
'expirationDate' => '2022-12-31',
'quantity' => 5
]
]
],
[
'lineNumber' => 2,
'orderLineNumber' => 2,
'identifiers' => [
[
'identifier' => '2330010000019',
'domain' => 'GS1'
],
[
'identifier' => 'bread-crumbs-bulk',
'domain' => 'BUYER'
],
[
'identifier' => 'supplier-bread-crumbs-bulk',
'domain' => 'SUPPLIER'
]
],
'isDepositItem' => false,
'orderedQuantity' => 19,
'shippedQuantity' => 15,
'openQuantityAction' => 'DISCARDED',
'batches' => [
[
'batchIdentifier' => 'BATCH_ID_2',
'expirationDate' => '2022-05-01',
'quantity' => 15
]
],
'description' => 'Sparkling Water - Crate (6x0.75l).'
]
]
]
]
]
];
$response = $client->request('POST', 'https://api.procuros.io/v2/transactions', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer <your-api-token>',
],
'json' => $transaction,
]);