1. Go to this page and download the library: Download chipdeals/momo-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chipdeals / momo-api example snippets
=
$momo = new \Chipdeals\MomoApi\Momo();
$momo->setApiKey("test_FOdigzgSopV8GZggZa89");
//Collect 500 XOF from the +22951010200 Mobile Money wallet.
$collection = $momo
->collect()
->amount(500)
->currency("XOF")
->from('22951010200')
->create();
print_r($collection->getArray());
//Send 2000 XOF to the +22951010200 Mobile Money wallet.
$deposit = $momo
->deposit()
->amount(2000)
->currency("XOF")
->to('22951010200')
->create();
print_r($deposit->getArray());
=
$momo = new \Chipdeals\MomoApi\Momo();
$momo->setApiKey("test_FOdigzgSopV8GZggZa89");
$collection = $momo
->collect()
->amount(2000) //Amount of the transaction
->currency("XOF") // Any valid currency
->from("22951010200") // Sender phone number with country code préfix
->isWaveAccount(false) //optional. Required only for wave operator
->useOtp(123456) //Required only for Orange Money Burkina. Get it from user after they generate it for your amount by doing: *144*4*6*montant#
->firstName("Iyam") // First name of the sender
->lastName("EVERICH") // Last name of the sender
->merchantOrderId("collection-test00001") //optional. If added we will check if it is uniq for your account
->create();
print_r($collection->getArray());
echo "<br/>" . $collection->getReference();
=4
$collection = $momo
->collect()
->amount(2000) //Amount of the transaction
->currency("XOF") // Any valid currency
->from("22951010200") // Sender phone number with country code préfix
->firstName("Iyam") // First name of the sender
->lastName("EVERICH") // Last name of the sender
->webhook("https:// mydomain/payment-status") // Url where we will send you transaction data on progress
->create();
print_r($collection->getArray());
echo "<br/>" . $collection->getReference();
=
$momo = new \Chipdeals\MomoApi\Momo();
$momo->setApiKey("test_FOdigzgSopV8GZggZa89");
$deposit = $momo
->deposit()
->amount(2000) //Amount of the transaction
->currency("XOF") // Any valid currency
->to('22951010200') // Recipient phone number with country code préfix
->isWaveAccount(false) //optional. Required only for CI wave operator
->merchantOrderId("deposit-test00001") //optional. If added we will check if it is uniq for your account
->create();
print_r($deposit->getArray());
echo "<br/>" . $deposit->getReference();
=4
$deposit = $momo
->deposit()
->amount(2000) //Amount of the transaction
->currency("XOF") // Any valid currency
->to('22951010200') // Recipient phone number with country code préfix
->webhook("https:// mydomain/payment-status") // Url where we will send you transaction data on progress
->create();
print_r($deposit->getArray());
echo "<br/>" . $deposit->getReference();