PHP code example of khipu / khipu-api-client

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

    

khipu / khipu-api-client example snippets



 new Khipu\Configuration();
$c->setSecret("abc123");
$c->setReceiverId(1234);
$c->setDebug(true);

$cl = new Khipu\ApiClient($c);

$exp = new DateTime();
$exp->setDate(2020, 11, 3);

$kh = new Khipu\Client\PaymentsApi($cl);

try {
    $opts = array(
    	"expires_date" => $exp,
    	"body" => "test body"
    );
    $resp = $kh->paymentsPost("Test de api", "CLP", 1570, $opts);
    print_r($resp);
    $r2 = $kh->paymentsIdGet($resp->getPaymentId());
    print_r($r2);
} catch(Exception $e) {
    echo $e->getMessage();
}