PHP code example of elmmac / elmmac-paystack-sdk

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

    

elmmac / elmmac-paystack-sdk example snippets




use ElmMacPaystack\ElmMacPayStack;

$paystack = new ElmMacPayStack('YOUR_PAYSTACK_SECRET_KEY');

$payload = [
    'email'       => '[email protected]',
    'amount'      => 2500 * 100, // kobo
    'reference'   => uniqid('elmmac_', true),
    'callback_url'=> 'https://yourdomain.com/elmmacpaystack_callback.php',
    'metadata'    => ['user_id' => 123],
];

$response = $paystack->initialize($payload);

if ($response['status']) {
    header('Location: ' . $response['data']['authorization_url']);
    exit;
} else {
    // handle error
}

// verify reference and update elmmacpaystackpayments