square1/mobilebill

2Bill.ie PHP API Client.

v1.1.1 2014-03-26 16:45 UTC

This package is auto-updated.

Last update: 2024-12-23 16:18:13 UTC


README

Build Status

Api Docs

AllPoints API Specifications: http://bit.ly/1fTu6zb

Example

<?php
use Square1\MobileBill\Api;
use Square1\MobileBill\Exception\AuthenticationError;
use Square1\MobileBill\Exception\ConnectionError;
use Square1\MobileBill\Exception\InvalidNumber;
use Square1\MobileBill\Exception\InvalidRequest;
use Square1\MobileBill\Exception\TransactionError;

try {
    var_dump(
        Api::create('username', 'password')
            ->content('999999', 'The content description goes here')
            ->phone('35387123456')
            ->charge('100', 'This is a test transaction')
            ->send();
    );
} catch (AuthenticationError $e) {
    echo "Auth issue.. " . $e->getMessage() . " do something!";    
} catch (InvalidRequest $e) {
    echo "Invalid request.. " . $e->getMessage() . " do something!";
} catch (InvalidNumber $e) {
    echo "Number is invalid.. " . $e->getMessage() . " do something!";
} catch (ConnectionError $e) {
    echo "Connection issue.. " . $e->getMessage() . " do something!";
} catch (TransactionError $e) {
    echo "Transaction issue.. " . $e->getMessage() . " do something!";
} catch (\Exception $e) {
    echo "General exception.. " . $e->getMessage() . " do something!";
}