PHP code example of rohama / koin-idpay

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

    

rohama / koin-idpay example snippets


use Rohama\Koin\IDPay\IDPayGateway;
use Rohama\Koin\Support\PaymentStatus;

$gateway = new IDPayGateway('api-key-36-chars', 'https://example.com/callback');

$payment = $gateway->request(150000, 'ORDER-1', 'Subscription purchase');

if ($payment->isSuccessful()) {
    header('Location: ' . $payment->redirectUrl);
    exit;
}

// In the callback page — parseCallback runs verify() before reporting success
$callback = $gateway->parseCallback($_GET, $_POST);
if ($callback->status === PaymentStatus::SUCCESS) {
    // Verified
}