PHP code example of assemien-dev / money-fusion-php

1. Go to this page and download the library: Download assemien-dev/money-fusion-php 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/ */

    

assemien-dev / money-fusion-php example snippets


use MoneyFusion\PaymentClient;

$client = new PaymentClient("YOUR_API_URL");

$payment = $client->createPayment(
    totalPrice: "10000",
    articles: [
        ["name" => "Article 1", "price" => "5000", "quantity" => 1]
    ],
    numeroSend: "0101010101",
    nomClient: "assemienDev",
    userId: 1,
    orderId: 123,
    returnUrl: "https://votre-domaine.com/callback",
    webhookUrl: "https://your-domain.com/my-webhook-url"
);

print_r($payment);

$paymentInfo = $client->getPayment("8L5teSc5TaIkP3ds9Dlx");
print_r($paymentInfo);



use MoneyFusion\PaymentClient;

$client = new PaymentClient("https://api.moneyfusion.net/api/create-payment");

try {
    $payment = $client->createPayment(
        totalPrice: "10000",
        articles: [
            ["name" => "Article 1", "price" => "5000", "quantity" => 1]
        ],
        numeroSend: "0101010101",
        nomClient: "assemienDev",
        userId: 1,
        orderId: 123,
        returnUrl: "https://votre-domaine.com/callback",
        webhookUrl: "https://votre-domaine.com/webhook"
    );

    print_r($payment);

    // Exemple : récupération du paiement après confirmation
    $paymentInfo = $client->getPayment($payment['token']);
    print_r($paymentInfo);

} catch (Exception $e) {
    echo "Erreur : " . $e->getMessage();
}