<?php

namespace Notimatica\ApiExceptions;

use Exception;

class TooManyRequestsApiException extends ApiException
{
    /**
     * @var int|null
     */
    protected $retryAfter = null;

    /**
     * @param int|null $retryAfter
     * @param array $headers
     * @param string $message
     * @param Exception $previous
     */
    public function __construct($retryAfter = null, $headers = [],  $message = '', Exception $previous = null)
    {
        $this->retryAfter = $retryAfter;

        if (empty($message)) {
            $message = 'Rate limit exceed.';
        }

        if ($retryAfter) {
            $headers['Retry-After'] = $retryAfter;
        }

        parent::__construct(429, 'too_many_requests', $message, $previous, $headers);
    }

    /**
     * Add extra info to the output.
     *
     * @return mixed
     */
    public function getMeta()
    {
        if ($this->retryAfter) {
            return [
                'retry_after' => $this->retryAfter
            ];
        }
    }
}

<?php

namespace Notimatica\ApiExceptions;

use Exception;

class TooManyRequestsApiException extends ApiException
{
    /**
     * @param int|null $retryAfter
     * @param array $headers
     * @param string $message
     * @param Exception $previous
     */
    public function __construct($retryAfter = null, $headers = [],  $message = '', Exception $previous = null)
    {
        if (empty($message)) {
            $message = 'Rate limit exceed.';
        }

        if ($retryAfter) {
            $headers['Retry-After'] = $retryAfter;
        }

        parent::__construct(429, 'too_many_requests', $message, $previous, $headers);
    }
}

--- 
+++ 
@@ -7,6 +7,11 @@
 class TooManyRequestsApiException extends ApiException
 {
     /**
+     * @var int|null
+     */
+    protected $retryAfter = null;
+
+    /**
      * @param int|null $retryAfter
      * @param array $headers
      * @param string $message
@@ -14,6 +19,8 @@
      */
     public function __construct($retryAfter = null, $headers = [],  $message = '', Exception $previous = null)
     {
+        $this->retryAfter = $retryAfter;
+
         if (empty($message)) {
             $message = 'Rate limit exceed.';
         }
@@ -24,4 +31,18 @@
 
         parent::__construct(429, 'too_many_requests', $message, $previous, $headers);
     }
+
+    /**
+     * Add extra info to the output.
+     *
+     * @return mixed
+     */
+    public function getMeta()
+    {
+        if ($this->retryAfter) {
+            return [
+                'retry_after' => $this->retryAfter
+            ];
+        }
+    }
 }
Add retry_after to meta of too many requests exception
