This data is encoded into either a JSON object or an XML object and submitted to the API. The examples below convert PHP arrays into these encoded objects.
In each case, the $response variable holds a PHP array derived from either a JSON or XML object that was returned by the API. The conversion from PHP Array to JSON for transport, then converting the response back to a PHP array, is handled by the HTTPClient class.
The examples below convert PHP arrays into these encoded objects.
If you receive a "chargeback found" response from the API and take adverse against your customer, you are required to display the following notice to that customer (or you can re-direct the customer to badcustomer.com using the custom URL generated for that specific transaction, where badcustomer.com will display the following adverse action for you):
Adverse Action Notice Under Section 615(a) of FCRA For Use in Non-Credit Situation
[Describe the adverse action taken.] This decision was based in whole or in part on information obtained in a consumer report we received from BadCustomer, Inc., 100 Wilshire Blvd., Suite 750, Santa Monica, CA 90401, (213) 221-4240. The agency played no part in our decision and is unable to supply specific reasons why we made this decision. You have a right under the Fair Credit Reporting Act to know the information contained in your credit file at the consumer reporting agency. You also have a right to a free copy of your report from the reporting agency, if you request it no later than 60 days after you receive this notice. In addition, if you find that any information contained in the report you receive is inaccurate or incomplete, you have the right to dispute the matter with the consumer reporting agency.
/*
* An example request call to the API.
*/
require_once 'HttpClient2real.php';
$ip=$_SERVER['REMOTE_ADDR'];
/*
* An object of the class HttpClient2real
*/
$service = new HttpClient2real("YOUR API KEY HERE");
/* Example 1
* An example query where card_number_hash is passed along with card_holder_name
* @param api_key
* @param card_number_hash
* @param card_holder_name
* @param json/xml
*/
$response = $service->call("index",array(
"api_key" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"card_number_hash" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"card_holder_name"=>"XXXXXXX XXXXXX"
),json);
/* Example 2
* An example query where card_number_hash is passed along with
* card_holder_name, address associated with the card number hash and zip code.
*
* @param api_key
* @param card_number_hash
* @param card_holder_name
* @param address
* @param zip
* @param json/xml
*/
$response = $service->call("index",array(
"api_key" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"card_number_hash" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"card_holder_name"=>"XXXXXX XXXXXX",
"address"=>"480 X. 300 X.","zip"=>"XXXXX"
),json);
/* Example 3
* An example query where card_holder_name is passed along with address and zip.
* @param api_key
* @param card_holder_name
* @param address
* @param zip
* @param json/xml
*/
$response = $service->call("index",array(
"api_key" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"card_holder_name"=>"XXXXXXX XXXXXX",
"address"=>"480 X 300 X","zip"=>"XXXXX"
),json);
/* Example 4
* An example query where card_number_hash is passed along with addresss and zip
* @param api_key
* @param card_number_hash
* @param address
* @param zip
* @param json/xml
*/
$response = $service->call("index",array(
"api_key" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"card_number_hash" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"address"=>"480 X. 300 X.","zip"=>"XXXXX"
),json);
/* Example 5
* An example query where card_number_hash is passed
* @param api_key
* @param card_number_hash
* @param json/xml
*/
$response = $service->call("index",array(
"api_key" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"card_number_hash" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
),json);
/* Example 6
* An example query where email_address is passed
* @param api_key
* @param email_address
* @param json/xml
*/
$response = $service->call("index",array(
"api_key" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"email_address" => "xxxxxxxxx@xxxxx.xxx"
),json);
/*
* This will print the response fromm the website, which can be json
* or xml depending upon the argument passed in the call.
*/
print_r($response);
/*
* Example API response in native JSON encoding. Chargebacks found on Card Number Hash
*
* {"transactionId":"YOUR-TRANSACTION-ID",
* "error":"0","found":"11",
* "result":"Chargeback found for Card Holder Name and Card Number Hash",
* "url":"https://www.badcustomer.com/blacklist.htm?transactionid=your-transaction-id"}
*
* By using the HttpClient class, we end up with a PHP array that looks like this:
*/
$response = array(
'transactionId' => 'YOUR-TRANSACTION-ID'
'error' => '0',
'found' => '11',
'result' => 'Chargeback found for Card Holder Name and Card Number Hash',
'url' => 'https://www.badcustomer.com/blacklist.htm?transactionid=your-transaction-id'
)
/*
*
* Example response for no Chargebacks found:
* After conversion to PHP Array.
*
*/
$response = array(
'transaction' => '9fdb2ae1-53c9-9869-56ed-4a11cb9ff833',
'error' => '0',
'found' => '0',
);
