1. Go to this page and download the library: Download fire/business-api-sdk 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/ */
fire / business-api-sdk example snippets
// Set up the PHP Client and log in - keep your login credentials out of the code and out of Github!!
$client = new Fire\Business\Client();
$client->initialise($config);
$client = new Fire\Business\Client("https://api.fire.com/something");
# Get lists of Fire Account and Payees
print_r ($client->accounts->read());
print_r ($client->payees->read());
# Get details of individual accounts/payees and the transactions for them.
print_r ($client->account(2150)->read());
print_r ($client->payee(15996)->read());
# Get details of individual accounts/payees and the transactions for them.
print_r ($client->account(2150)->transactions());
print_r ($client->payee(15996)->transactions());
# Get items 10-35 of a list of transactions
print_r ($client->account(2150)->transactions(array("offset"=>10, "limit"=>25)));
# Perform an internal transfer between two of your Fire accounts
try {
$batch = $client->batches->create(array(
"type" => "INTERNAL_TRANSFER",
"currency" => "EUR",
"batchName" => "January 2018 Payroll",
"jobNumber" => "2018-01-PR",
"callbackUrl" => "https://myserver.com/callback"
));
$batchId = $batch["batchUuid"];
# retrieve batch details
print_r ($client->batch($batchId)->read());
# Add an internal transfer
$transaction = $client->batch($batchId)->addInternalTransfer(array(
"icanFrom" => "2150",
"icanTo" => "5532",
"amount" => "100",
"ref" => "Testing PHP Library"
));
print_r($transaction);
# List trasnfers in the batch
$internalTransfers = $client->batch($batchId)->internalTransfers->read();
print_r ($internalTransfers);
# remove a transfer if
# Perform a bank transfer to a payee
try {
// Bank Transfers - create a batch, add/remove transfers, submit
$batch = $client->batches->create(array(
"type" => "BANK_TRANSFER",
"currency" => "EUR",
"batchName" => "March 2019 Payroll",
"jobNumber" => "2019-03-PR",
"callbackUrl" => "https://myserver.com/callback"
));
$batchId = $batch["batchUuid"];
print_r ($client->batch($batchId)->read());
$transaction = $client->batch($batchId)->addBankTransfer(array(
"icanFrom" => "2150",
"payeeId" => "1304",
"payeeType" => "PAYEE_ID",
"amount" => "500",
"myRef" => "PHP Library Test",
"yourRef" => "PHP Library Test"
));
print_r($transaction);
# Add a bank transfer using account details instead:
$transaction = $client->batch($batchId)->addBankTransfer(array(
"icanFrom" => "2001",
"payeeType" => "ACCOUNT_DETAILS",
"destIban" => "IE00AIBK93123412341234",
"destAccountHolderName" => "John Smith",
"amount" => "500"
"myRef" => "Payment to John Smith for Consultancy in Dec.",
"yourRef" => "ACME LTD - INV 23434"
));
$bankTransfers = $client->batch($batchId)->bankTransfers->read();
print_r ($bankTransfers);
print_r ($client->batch($batchId)->bankTransfer($bankTransfers["items"][0]["batchItemUuid"])->delete());
# Submit the batch. This triggers a notification to be sent to the Firework for Business mobile app for approval.
# Transfers will not be processed until the batch is approved.
$client->batch($batchId)->submit();
# If
// you can either pull in the library using Fire/Starter if you've copied the library to your standard library location.
//include_once("Fire/Starter.php");
// Or using the Composer dependency manager
hook\Handler($keyId, $secret);
// $events is an array of Fire\Business\Model\Transactions
$events = $handler->parse($raw_post_data);
print $events[0];