Skip to content

Commit

Permalink
Fix Timestamp formats
Browse files Browse the repository at this point in the history
Hms -> His. Minute uses the parameter 'i'
  • Loading branch information
stevemosiori authored Nov 28, 2023
1 parent 34d740b commit cb0e6b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Mpesa.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
];

Expand Down Expand Up @@ -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,
];
Expand Down

0 comments on commit cb0e6b4

Please sign in to comment.