Skip to content

Commit

Permalink
Merge pull request #10 from stevemosiori/main
Browse files Browse the repository at this point in the history
Fix Timestamp formats
  • Loading branch information
Iankumu authored Nov 29, 2023
2 parents 34d740b + cb0e6b4 commit bce5a90
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 bce5a90

Please sign in to comment.