PHP code example of devscast / maxicash

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

    

devscast / maxicash example snippets


use Devscast\Maxicash\Client as Maxicash;
use Devscast\Maxicash\Credential;
use Devscast\Maxicash\PaymentEntry;
use Devscast\Maxicash\Environment;

$maxicash = new Maxicash(
    credential: new Credential('marchand_id', 'marchand_password'),
    environment: Environment::SANDBOX // use `Environment::LIVE` for live
);

$entry = new PaymentEntry(
    credential: $maxicash->credential,
    amount: intval(47.50 * 100), // amount in cents
    reference: "this text will be shown on maxicash payment page",
    acceptUrl: "your_website_accept_url",
    declineUrl: "your_website_decline_url",
);

$url = $maxicash->queryStringURLPayment($entry);

$donationUrl = $maxicash->donationUrl()