PHP code example of dewbud / cardconnect
1. Go to this page and download the library: Download dewbud/cardconnect 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/ */
dewbud / cardconnect example snippets
$merchant_id = '123456123456';
$user = 'username';
$pass = 'password';
$server = 'https://sub.domain.tld:1111/';
$client = new CardPointe($merchant_id, $user, $pass, $server);
$boolean = $client->testAuth();
$boolean = $client->validateMerchantId();
$response = $client->inquire($retref);
$response->amount; // returns int
$response->toJSON(); // Returns JSON encoded string, accepts format codes (JSON_PRETTY_PRINT, etc)
$response->toArray(); // Returns array of attributes
$request = new AuthorizationRequest([
'account' => '4242424242424242',
'amount' => '100',
'expiry' => '0120',
]);
$authorization_response = $client->authorize($request);
$request = new AuthorizationRequest([
'account' => '4242424242424242',
'amount' => '100',
'expiry' => '0120',
'capture' => 'Y', // OR 'capture' => true,
'profile' => 'Y', // OR 'profile' => true,
]);
$capture_response = $client->authorize($request);
$request = new AuthorizationRequest([
'account' => '4242424242424242',
'amount' => '100',
'expiry' => '0120',
'capture' => 'Y', // OR 'capture' => true,
'profile' => "$profile_id/$account_id", // using a profile/account
]);
$capture_response = $client->authorize($request);
$auth_retref = '123456654321';
$params = []; // optional
$capture_response = $client->capture($auth_retref, $params);
$auth_retref = '123456654321';
$params = []; // optional
$void_response = $client->void($auth_retref, $params);
$capture_retref = '123456654321';
$params = []; // optional
$void_response = $client->refund($capture_retref, $params);
$retref = '123456654321';
$inquire_response = $client->inquire($retref);
$date = '0118';
$settlements = $client->settleStat($date);
$first_settlement = $settlements[0];
// update a profile by providing 'profile' => $profile_id in the request
$request = [
'defaultacct' => "Y",
'account' => "4444333322221111",
'expiry' => "0914",
'name' => "Test User",
'address' => "123 Test St",
'city' => "TestCity",
'region' => "TestState",
'country' => "US",
'postal' => "11111",
];
$res = $client->createProfile($request);
$profile_id = '1023456789';
$account_id = null; // optional
$profile = $client->profile($profile_id, $account_id);
$profile_id = '1023456789';
$account_id = null; // optional
$profile = $client->deleteProfile($profile_id, $account_id);
array