From 5bbcec42766075de62b43280c361205b74476dd8 Mon Sep 17 00:00:00 2001 From: DMollov Date: Wed, 11 Sep 2024 09:56:49 +0300 Subject: [PATCH] Add order tracking endpoint (#648) --- src/Traits/PayPalAPI/Orders.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Traits/PayPalAPI/Orders.php b/src/Traits/PayPalAPI/Orders.php index afcff5ec..bfeae441 100644 --- a/src/Traits/PayPalAPI/Orders.php +++ b/src/Traits/PayPalAPI/Orders.php @@ -137,4 +137,27 @@ public function capturePaymentOrder(string $order_id, array $data = []) return $this->doPayPalRequest(); } + + /** + * Add tracking information for an Order. + * + * @param string $order_id + * @param array $data + * + * @throws \Throwable + * + * @return array|\Psr\Http\Message\StreamInterface|string + * + * @see https://developer.paypal.com/docs/api/orders/v2/#orders_track_create + */ + public function addTrackingForOrder(string $order_id, array $data) + { + $this->apiEndPoint = "v2/checkout/orders/{$order_id}/track"; + + $this->options['json'] = $data; + + $this->verb = 'post'; + + return $this->doPayPalRequest(); + } }