First of all, make sure if API access passcode under “administration -> account settings -> order settings” is generated and obtainable.
Payment reports are retrieved by transaction dates. So, it should be cross checked with local DB transaction data in order to get one transaction information out of order number, customer’s name or other information after retrieving in date ranges.
Bambora’s Payment APIs are the RESTful interface to the payment gateway. cURL is used to get payment report on PHP as below.
[code language=”PHP”]
$BAM_API_PASSCODE = "Authorization: Passcode "."your Bambora passcode"
$reportURL = "https://api.na.bambora.com/v1/reports";
$from_date = date("Y-m-d", strtotime("-1 days"));
$to_date = date("Y-m-d", strtotime("+1 days"));
$crl = curl_init();
$postData = array(
"name" => "Search",
"start_date" => $from_date."T00:00:00",
"end_date" => $to_date."T23:59:59",
"start_row" => "1",
"end_row" => "1000"
);
$postData = json_encode($postData);
$header = array();
$header[] = ‘Content-length: ‘.strlen($postData);
$header[] = ‘Content-type: application/json’;
$header[] = $BAM_API_PASSCODE;
curl_setopt($crl, CURLOPT_HTTPHEADER,$header);
curl_setopt($crl, CURLOPT_URL, $reportURL);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_POST,true);
curl_setopt($crl, CURLOPT_POSTFIELDS, $postData);
$output = curl_exec($crl);
curl_close($crl);
$output = json_decode($output, true);
$trns = $output[‘records’];
foreach( $trns as $trn){
echo print_r($trn)."<br /><br />";
}
[/code]