From cb0e6b4dd71ef1173fea0fc3ef82747ef3f60d67 Mon Sep 17 00:00:00 2001 From: Steve Mosiori Date: Tue, 28 Nov 2023 19:11:56 +0300 Subject: [PATCH] Fix Timestamp formats Hms -> His. Minute uses the parameter 'i' --- src/Mpesa.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mpesa.php b/src/Mpesa.php index 26a40a3..a3aaa78 100644 --- a/src/Mpesa.php +++ b/src/Mpesa.php @@ -126,7 +126,7 @@ public function stkpush($phonenumber, $amount, $account_number, $callbackurl = n //Fill in the request parameters with valid values 'BusinessShortCode' => $this->shortcode, //Has to be a paybill and not a till number since it is not supported 'Password' => $this->lipaNaMpesaPassword(), - 'Timestamp' => Carbon::rawParse('now')->format('YmdHms'), + 'Timestamp' => Carbon::rawParse('now')->format('YmdHis'), 'TransactionType' => 'CustomerPayBillOnline', 'Amount' => (int) $amount, 'PartyA' => $this->phoneValidator($phonenumber), // replace this with your phone number @@ -172,7 +172,7 @@ public function stkquery($checkoutRequestId) $post_data = [ 'BusinessShortCode' => $this->shortcode, 'Password' => $this->lipaNaMpesaPassword(), - 'Timestamp' => Carbon::rawParse('now')->format('YmdHms'), + 'Timestamp' => Carbon::rawParse('now')->format('YmdHis'), 'CheckoutRequestID' => $checkoutRequestId, ]; @@ -264,7 +264,7 @@ public function validated_b2c($phonenumber, $command_id, $amount, $remarks, $id_ 'QueueTimeOutURL' => $this->b2ctimeout, 'ResultURL' => $this->b2cresult, 'Occassion' => '', //can be null - 'OriginatorConversationID' => Carbon::rawParse('now')->format('YmdHms'), //unique id for the transaction + 'OriginatorConversationID' => Carbon::rawParse('now')->format('YmdHis'), //unique id for the transaction 'IDType' => '01', //01 for national id 'IDNumber' => $id_number, ];