From cf7fc58d9635ace587a4dfaa423a49eac89e56a6 Mon Sep 17 00:00:00 2001 From: Dancan Kimani Date: Sat, 14 Mar 2026 23:47:45 +0300 Subject: [PATCH] Cast string to int before calling addSeconds --- src/Mpesa/Auth/Authenticator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mpesa/Auth/Authenticator.php b/src/Mpesa/Auth/Authenticator.php index 96cad4e..1c99314 100755 --- a/src/Mpesa/Auth/Authenticator.php +++ b/src/Mpesa/Auth/Authenticator.php @@ -116,7 +116,8 @@ private function makeRequest($key, $secret) */ private function saveCredentials($key, $credentials) { - $ttl = Carbon::now()->addSeconds($credentials->expires_in)->subMinute(); + $ttlSeconds = (int) $credentials->expires_in; + $ttl = Carbon::now()->addSeconds($ttlSeconds)->subMinute(); $this->core->cache()->put($key, $credentials->access_token, $ttl); }