// install dependency
// $ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$transaction = [
'type' => 'CREDIT_NOTE',
'content' => [
'header' => [
'buyer' => [
'identifiers' => [
[
'identifier' => '3220010000001',
'domain' => 'GS1',
],
],
],
'supplier' => [
'identifiers' => [
[
'identifier' => '3220010000004',
'domain' => 'GS1',
],
],
],
'type' => 'CORRECTION',
'creditNoteIdentifier' => 'valid-credit-note-identifier-1',
'creditNoteDate' => '2022-05-09',
'reason' => 'valid-credit-note-reason-1',
'invoiceIdentifier' => 'valid-invoice-identifier-1',
'invoiceDate' => '2022-05-09',
'shippingNoticeIdentifier' => 'valid-credit-note-shipment-identifier-1',
'shippingNoticeDate' => '2022-05-07',
'orderIdentifier' => 'valid-credit-note-order-identifier-1',
'orderDate' => '2022-05-01',
'paymentTerms' => [],
],
'items' => [
[
'lineNumber' => 1,
'identifiers' => [
[
'identifier' => 'valid-invoice-item-identifier-1',
'domain' => 'GS1',
],
],
'isDepositItem' => false,
'quantity' => 10,
'unitPrice' => 4.5,
'tax' => [
'amount' => 8.55,
'percentage' => 19,
],
],
[
'lineNumber' => 2,
'identifiers' => [
[
'identifier' => 'valid-invoice-item-identifier-2',
'domain' => 'GS1',
],
],
'isDepositItem' => true,
'quantity' => 10,
'unitPrice' => 4.5,
'tax' => [
'amount' => 0,
'percentage' => 0,
],
],
],
'summary' => [
'subtotalAmount' => 90,
'grossAmount' => 98.55,
'netAmount' => 98.55,
'dueAmount' => 98.55,
'totalAmountWithoutTax' => 90,
'totalCharges' => 8.55,
'totalAllowances' => 0,
'tax' => [
'total' => 1,
'items' => [
[
'percentage' => 19,
'taxableAmount' => 44.5,
'taxAmount' => 8.5,
'category' => 'Mwst.',
'description' => 'Mehrwertsteuer',
]
],
'description' => 'Tax Summary',
],
],
],
];
$response = $client->request('POST', 'https://api.procuros.io/v2/transactions', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer <your-api-token>',
],
'json' => $transaction,
]);