PHP code example of v1p3r75 / moov-money-api-sdk

1. Go to this page and download the library: Download v1p3r75/moov-money-api-sdk 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/ */

    

v1p3r75 / moov-money-api-sdk example snippets




use MoovMoney\MoovMoneyAPI;
use MoovMoney\MoovMoneyAPIConfig;

$config = new MoovMoneyAPIConfig();
$config->setUsername('your_username')
       ->setPassword('your_password')
       ->setRequestTimeout(30) // en secondes
       ->useSandbox(true); // Active le mode sandbox (désactivez pour production)

$moovApi = new MoovMoneyAPI($config);




$config = new MoovMoneyAPIConfig();

// Activer le mode production
$config->useSandbox(false);

// Vérifier l'environnement actif
if ($config->isSandbox()) {
    echo "Environnement actif : Sandbox";
} else {
    echo "Environnement actif : Production";
}



$response = $moovApi->pushTransaction(
    telephone: '22995901234',
    amount: 5000,
    message: 'Paiement de 5000 FCFA',
    data1: 'Order_1234', // facultatif
    data2: 'Additional info', // facultatif
    fee: 0 // frais facultatif
);



$response = $moovApi->pushWithPendingTransaction(
    telephone: '22995181010',
    amount: 5000,
    message: 'Paiement de 5000 FCFA',
    data1: 'Order_1234',
    data2: 'Additional info',
    fee: 0
);



$statusResponse = $moovApi->getTransactionStatus('72024103000000009');



$response = $moovApi->transferFlooz(
    destination: '22995181010',
    amount: 10000,
    referenceId: 'Ref_12345',
    walletId: '0', // ID du portefeuille, par défaut "0"
    data: 'Transfert vers partenaire' // facultatif
);

$response = $moovApi->getBalance('22995181010');



$response = $moovApi->getMobileStatus('22995181010');




$response = $moovApi->cashIn(
    "98239988",
    2000,
    "10000000",
    "other_data"
);




$response = $moovApi->airTime(
    "98239988",
    2000,
    "10000000",
    "other_data"
);