# woo-postnl/5.9.12/src/Rest_API/Legacy/Postcode_Check/Client.php

PostNL for WooCommerce, version 5.9.12. 57 lines.

- Page: https://pluginprobe.com/plugins/woo-postnl/5.9.12/code/src/Rest_API/Legacy/Postcode_Check/Client.php
- Raw: https://pluginprobe.com/plugins/woo-postnl/5.9.12/raw/src/Rest_API/Legacy/Postcode_Check/Client.php
- Modified: 2026-07-20T20:49:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woo-postnl/5.9.12/code/src/Rest_API/Legacy/Postcode_Check/Client.php#L10-L20`.

```php
<?php
/**
 * Class Rest_API\Postcode_Check\Client file.
 *
 * @package PostNLWooCommerce\Rest_API\Legacy\Postcode_Check
 */

namespace PostNLWooCommerce\Rest_API\Legacy\Postcode_Check;

use PostNLWooCommerce\Rest_API\Base;
use PostNLWooCommerce\Rest_API\Contracts\Postcode_Check_Service_Interface;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class Client
 *
 * @package PostNLWooCommerce\Rest_API\Legacy\Postcode_Check
 */
class Client extends Base implements Postcode_Check_Service_Interface {
	/**
	 * API Endpoint.
	 *
	 * @var string
	 */
	public $endpoint = '/shipment/checkout/v1/postalcodecheck';

	/**
	 * Function for composing API request.
	 */
	public function compose_body_request() {
		return array(
			'postalcode'          => $this->item_info->receiver['postcode'],
			'housenumber'         => $this->item_info->receiver['house_number'],
			'housenumberaddition' => $this->item_info->receiver['address_2'],
		);
	}

	/**
	 * Check the given postcode data.
	 *
	 * @param array $post_data Post data for postcode check.
	 *
	 * @return array
	 */
	public function check( array $post_data ): array {
		$item_info = new Item_Info( $post_data );
		$client    = new self( $item_info );

		// send_request() can return null on an empty/non-JSON 200; normalize to honor the array return type.
		$response = $client->send_request();
		return is_array( $response ) ? $response : array();
	}
}

```
