eriktelepovsky / billplz-api-php-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BillplzAPI

Initialization

<?php

require_once 'billplz-api-php-client/src/Billplz/autoload.php'; // or wherever autoload.php is located

// LiveMode
$billplzAPI = Billplz_API::factory('my-api-key', 'callbackurl'); 

// SandboxMode
$billplzAPI = Billplz_API::factory('my-api-key', 'callbackurl')->sandboxMode(); 

Create Bill

try
{
    $collection_id = 'ebdmqj6z';
    $optional = ['redirect_url' => 'http://my-site-redire.ct/url', 'deliver' => true, 'metadata' => ['orderId' => 1, 'customerID' => 1]];
    $result = $billplzAPI->createBill($collection_id, 'my-customer-email@gmail.com', 'Custo Mer', 1000, $optional);
    var_dump($result);
}
catch (Billplz_Exception $e)
{
    echo $e->getType().' | '.$e->getMessage().PHP_EOL;
}

Get Bill

try
{
    $bill_id = '6wIiIuho';
    $result = $billplzAPI->getBill($bill_id);
    var_dump($result);
}
catch (Billplz_Exception $e)
{
    echo $e->getType().' | '.$e->getMessage().PHP_EOL;
}

Delete Bill

try
{
    $bill_id = '6wIiIuho';
    $result = $billplzAPI->deleteBill($bill_id);
    var_dump($result);
}
catch (Billplz_Exception $e)
{
    echo $e->getType().' | '.$e->getMessage().PHP_EOL;
}

About

License:MIT License


Languages

Language:PHP 100.0%