> ## Documentation Index
> Fetch the complete documentation index at: https://docs.procuros.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Receival Notices

This is the right section for you if you are acting as a customer and looking to send receival notices to your suppliers.

Throughout this guide you will learn how to send receival notices 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](/en/api/v2/overview).

## Process

These are usually the steps taken when sending a receival notice to Procuros:

1. Check, if this document should be sent via Procuros (see: [Enabled Trade Partners](/en/api/v2/features-enabled-trade-partners))
2. Verify this document has not already been sent (see: [Tracking Document Status](/en/api/v2/features-tracking-document-status))
3. Build the transaction payload to be sent via Procuros.
4. Send the transaction payload via the Procuros API

## 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](/en/api/v2/concept-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](/en/api/v2/concept-error-handling) section of our API reference for a detailed description plus examples of how to handle them.

## Send receival notices

The API call [Send transaction](/en/api/v2/outgoing-transactions/send-transaction) is used to create transactions, including receival notices.

The following fields are required:

* `type` (Transaction type. In this case `RECEIVAL_NOTICE`)
* `content` (The details of the receival notice.)

Inside the `content` you will need to build the header and transport units with items. All details can be found in the `RECEIVAL_NOTICE` schema as described in the [API reference](/en/api/v2/outgoing-transactions/send-transaction).

An example request would look like:

<CodeGroup>
  ```php php theme={null}
  // install dependency
  // $ composer require guzzlehttp/guzzle

  <?php
  require_once('vendor/autoload.php');

  $client = new \GuzzleHttp\Client();

  $transaction = [
  	"type" => "RECEIVAL_NOTICE",
  	"content" => [
  		"header" => [
  			"receivalAdviceNumber" => "RCV-2024-001",
  			"receivalDate" => "2024-06-15T10:30:00.000000Z",
  			"deliveryNoteNumber" => "DN-2024-456",
  			"customerOrderNumber" => "PO-2024-123",
  			"deliveryNoteDate" => "2024-06-14T14:00:00.000000Z",
  			"orderDate" => "2024-06-01T09:00:00.000000Z",
  			"comments" => "All items received in good condition",
  			"carrierId" => "DHL",
  			"carrierDomain" => "SCAC",
  			"trackingNumber" => "1234567890",
  			"trackingUrl" => "https://tracking.example.com/1234567890",
  			"shipFrom" => [
  				"name" => "Supplier Warehouse GmbH",
  				"identifiers" => [
  					[
  						"domain" => "GS1",
  						"identifier" => "4200000123456"
  					]
  				],
  				"postalAddress" => [
  					"name" => "Supplier Warehouse GmbH",
  					"street" => "Industriestraße 10",
  					"addressExtra" => "Building A",
  					"city" => "Munich",
  					"postalCode" => "80331",
  					"countryCode" => "DE"
  				]
  			],
  			"shipTo" => [
  				"name" => "Customer Warehouse GmbH",
  				"identifiers" => [
  					[
  						"domain" => "GS1",
  						"identifier" => "4200000654321"
  					]
  				],
  				"postalAddress" => [
  					"name" => "Customer Warehouse GmbH",
  					"street" => "Lagerstraße 25",
  					"addressExtra" => "Receiving Dock 3",
  					"city" => "Hamburg",
  					"postalCode" => "20095",
  					"countryCode" => "DE"
  				]
  			],
  			"customer" => [
  				"name" => "Customer Company GmbH",
  				"identifiers" => [
  					[
  						"domain" => "GS1",
  						"identifier" => "4200000654321"
  					]
  				],
  				"postalAddress" => [
  					"name" => "Customer Company GmbH",
  					"street" => "Hauptstraße 50",
  					"city" => "Hamburg",
  					"postalCode" => "20095",
  					"countryCode" => "DE"
  				]
  			],
  			"supplier" => [
  				"name" => "Supplier Company GmbH",
  				"identifiers" => [
  					[
  						"domain" => "GS1",
  						"identifier" => "4200000123456"
  					]
  				],
  				"postalAddress" => [
  					"name" => "Supplier Company GmbH",
  					"street" => "Lieferantenweg 15",
  					"city" => "Munich",
  					"postalCode" => "80331",
  					"countryCode" => "DE"
  				]
  			]
  		],
  		"transportUnits" => [
  			[
  				"unitIdentifier" => "342601560208144493",
  				"unitType" => "EURO_PALLET",
  				"containedTradeUnitCount" => 4,
  				"items" => [
  					[
  						"lineNumber" => 1,
  						"receivedQuantity" => 10,
  						"shippedQuantity" => 10,
  						"orderedQuantity" => 10,
  						"identifiers" => [
  							[
  								"domain" => "GS1",
  								"identifier" => "12345678901234"
  							],
  							[
  								"domain" => "BUYER",
  								"identifier" => "CUST-PROD-001"
  							]
  						],
  						"orderLineNumber" => 1,
  						"unitOfMeasure" => "EA",
  						"description" => "Premium Product A",
  						"unitPrice" => 24.50,
  						"currency" => "EUR",
  						"batches" => [
  							[
  								"batchIdentifier" => "BATCH-2024-06-001",
  								"expirationDate" => "2025-12-31",
  								"quantity" => 10
  							]
  						]
  					],
  					[
  						"lineNumber" => 2,
  						"receivedQuantity" => 18,
  						"shippedQuantity" => 20,
  						"orderedQuantity" => 20,
  						"rejectedQuantity" => 2,
  						"rejectReason" => "Damaged packaging",
  						"identifiers" => [
  							[
  								"domain" => "GS1",
  								"identifier" => "98765432109876"
  							]
  						],
  						"orderLineNumber" => 2,
  						"unitOfMeasure" => "EA",
  						"description" => "Standard Product B",
  						"unitPrice" => 12.75,
  						"currency" => "EUR"
  					]
  				]
  			]
  		]
  	]
  ];

  $response = $client->request('POST', 'https://api.procuros.io/v2/transactions', [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => 'Bearer <your-api-token>',
    ],
    'json' => $transaction,
  ]);
  ```
</CodeGroup>

## Mark Document Status

Finally, as per the instructions mentioned under [Tracking Document Status](/en/api/v2/features-tracking-document-status) you must now track the status of the document locally, based on the returned HTTP response.

The document should be marked with either status `TRANSMITTED` or `NO_ACTION`. If there is an error with the document and it is not accepted, do not mark it with a status so it may be retried. For more information on retrying failed documents, please see: [Retrying Documents](/en/api/v2/features-tracking-document-status#retrying-documents).

For example:

<CodeGroup>
  ```php php theme={null}
  $statusCode = $response->getStatusCode();

  if ($statusCode == 201) {
    $document->updateProcurosStatus("TRANSMITTED");
  } else if ($statusCode == 202) {
    $document->updateProcurosStatus("NO_ACTION");
  } else {
    // No need to do anything if it's not accepted, in an error case the document should be retried.
  }
  ```
</CodeGroup>
