// install dependency
// $ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$transaction = [
'type' => 'SALES_REPORT',
'content' => [
'header' => [
'salesReportIdentifier' => 'SR-20231206-001',
'salesReportDate' => '2023-12-06',
'salesPeriodStartDate' => '2023-12-01',
'salesPeriodEndDate' => '2023-12-06',
'currency' => 'EUR',
'buyer' => [
'identifiers' => [
['domain' => 'GS1', 'identifier' => '3220010000010']
]
],
'supplier' => [
'identifiers' => [
['domain' => 'GS1', 'identifier' => '3220010000003']
]
]
],
'locations' => [
[
'location' => [
'identifiers' => [
['domain' => 'BUYER', 'identifier' => 'STORE-001']
],
'name' => 'Main Store'
],
'items' => [
[
'salesReportLineIdentifier' => 'ITEM-001',
'identifiers' => [
['domain' => 'GS1', 'identifier' => '2330000000083']
],
'description' => 'Organic Milk 1L',
'unitOfMeasure' => 'EA',
'salesQuantity' => 120,
'returnedQuantity' => 3,
'inventoryQuantity' => 15
]
]
]
]
]
];
$response = $client->request('POST', 'https://api.procuros.io/v2/transactions', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer <your-api-token>',
],
'json' => $transaction,
]);