PHP code example of korozcolt / payments-codeigniter4

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

    

korozcolt / payments-codeigniter4 example snippets


use Korbytes\Payments\DTOs\PaymentData;

$charge = service('payments')->driver('wompi')->charge(new PaymentData(
    referenceId: 'ORDER-1001',
    amount: 5000000,            // in cents
    customer: ['email' => '[email protected]'],
));
// $charge->reference, $charge->signature, $charge->widgetUrl ... feed the provider's checkout widget

// app/Config/Events.php
use CodeIgniter\Events\Events;

Events::on('payments.approved', static function (\Korbytes\Payments\Core\Events\PaymentApproved $event) {
    // $event->transaction->reference_id, $event->webhookResult ...
});
bash
composer grate -n "Korbytes\Payments\CodeIgniter"