Client::get_order( string $order_id )

Retrieves an order object for a given ID in PayPal.


Parameters #

$order_id

(string) (Required) Order ID to retrieve.


Top ↑

Return #

(array|null)


Top ↑

Source #

File: src/Tickets/Commerce/Gateways/PayPal/Client.php

	public function get_order( $order_id ) {
		$query_args = [];
		$body       = [];

		$args = [
			'headers' => [
				'PayPal-Partner-Attribution-Id' => Gateway::ATTRIBUTION_ID,
				'PayPal-Request-Id'             => tribe( Cart::class )->generate_cart_order_hash(),
				'Prefer'                        => 'return=representation',
			],
			'body'    => $body,
		];

		$order_id = urlencode( $order_id );
		$url        = '/v2/checkout/orders/{order_id}';
		$url        = str_replace( '{order_id}', $order_id, $url );
		$response   = $this->get( $url, $query_args, $args );

		return $response;
	}

Top ↑

Changelog #

Changelog
Version Description
5.4.0.2 Introduced.