khipu/khipu-api-client

2.9.1 2019-05-27 14:21 UTC

This package is auto-updated.

Last update: 2024-04-08 18:00:12 UTC


README

Add the dependency khipu/khipu-api-client to composer.json and run

composer install

Usage

Basic usage

<?php
require __DIR__ . '/vendor/autoload.php';

$c = 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();
}
?>