This is the right section for you if you are acting as a buyer and looking to send sales reports to your suppliers. Throughout this guide you will learn how to send new sales reports to the Procuros API. PHP examples are included but you will likely also want to look at the relevant API calls in the API reference.

Authentication

You will need an API token to authenticate. We use a bearer token which has to be included in each request you send to the API. Please read the Authentication section of our API reference for a detailed description.

Error Handling

The API will return a 2xx status code for successful requests. Anything else indicates an error. Please read the Errors section of our API reference for a detailed description plus examples of how to handle them.

Send Sales Reports

The API call Send transaction is used to create transactions, including sales reports.
// 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,
]);