PHP code example of mpay24 / mpay24-php

1. Go to this page and download the library: Download mpay24/mpay24-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/ */

    

mpay24 / mpay24-php example snippets







use Mpay24\Mpay24;
use Mpay24\Mpay24Order; //if you are using paymentPage

$mpay24 = new Mpay24('9****', '*********', TRUE); //Testsystem
$mpay24 = new Mpay24('7****', '*********', FALSE); //Livesystem


$tokenizer = $mpay24->token("CC");
$tokenizerLocation = $tokenizer->getLocation();
$token = $tokenizer->getToken();

$payment = array(
  "amount" => "100",
  "currency" => "EUR",
  "token" => $_POST['token']
);
$result = $mpay24->payment("TOKEN", "123 TID", $payment);

$payment = array(
  "amount" => "100",
  "currency" => "EUR"
);
$result = $mpay24->payment("PAYPAL", "123 TID", $payment);

use Mpay24\Mpay24Order;

$mdxi = new Mpay24Order();
$mdxi->Order->Tid = "123";
$mdxi->Order->Price = "1.00";
$mdxi->Order->URL->Success      = 'http://yourpage.com/success';
$mdxi->Order->URL->Error        = 'http://yourpage.com/error';
$mdxi->Order->URL->Confirmation = 'http://yourpage.com/confirmation';

$paymentPageURL = $mpay24->paymentPage($mdxi)->getLocation(); // redirect location to the payment page

header('Location: '.$paymentPageURL);

$mpay24->paymentStatus("12345");

$mpay24->paymentStatusByTID("123 TID");
bash
composer