jalr / laravelcardconnect
PHP adapter for CardConnect CardPointe API
Requires
- php: ^7.3|^8.0
- ext-json: *
- illuminate/support: ~5|~6|~7|~8|~9
Requires (Dev)
- phpunit/phpunit: ~9.5
This package is auto-updated.
Last update: 2024-10-26 12:15:45 UTC
README
Initializing
$merchant_id = '123456123456';
$user = 'username';
$pass = 'password';
$server = 'https://sub.domain.tld:1111/';
$client = new CardPointe($merchant_id, $user, $pass, $server);
Testing Credentials
$boolean = $client->testAuth();
Validate Merchant ID
$boolean = $client->validateMerchantId();
Tweaks
Responses are parsed and their amount fields are returned in cents `
int`
.
The client stores the last request made as an `
array`
`
$client->last_request`
which can be used to debug requests
Response Objects
Responses are returned as objects and can be accessed as arrays.
$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
Authorizing Transactions
$request = new AuthorizationRequest([
'account' => '4242424242424242',
'amount' => '100',
'expiry' => '0120',
]);
$authorization_response = $client->authorize($request);
You can also authorize and capture in the same request like so
$request = new AuthorizationRequest([
'account' => '4242424242424242',
'amount' => '100',
'expiry' => '0120',
'capture' => 'Y', // OR 'capture' => true,
'profile' => 'Y', // OR 'profile' => true,
]);
$capture_response = $client->authorize($request);
You can also authorize and capture in the same request using a saved card with PROFILE_ID/ACCOUNT_ID like so
$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);
To view all available fields see Authorization Request
All returned fields see Authorization Response
Capturing Transactions
$auth_retref = '123456654321';
$params = []; // optional
$capture_response = $client->capture($auth_retref, $params);
To view all available fields see Capture Request
All returned fields see Capture Response
Voiding Transactions
$auth_retref = '123456654321';
$params = []; // optional
$void_response = $client->void($auth_retref, $params);
To view all available fields see Void Request
All returned fields see Void Response
Refunding Transactions
$capture_retref = '123456654321';
$params = []; // optional
$void_response = $client->refund($capture_retref, $params);
To view all available fields see Refund Request
All returned fields see Refund Response
Transaction Status
$retref = '123456654321';
$inquire_response = $client->inquire($retref);
All returned fields see Inquire Response
Settlement Status
$date = '0118';
$settlements = $client->settleStat($date);
$first_settlement = $settlements[0];
All returned fields see Settlement Response
Create/Update Profile
// 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);
All returned fields see Create/Update Profile Request
Get Profile
$profile_id = '1023456789';
$account_id = null; // optional
$profile = $client->profile($profile_id, $account_id);
All returned fields see Profile Response
Delete Profile
$profile_id = '1023456789';
$account_id = null; // optional
$profile = $client->deleteProfile($profile_id, $account_id);
All returned fields see Delete Profile Response
Tests
Note: small or large authorization/capture amounts don't seem to work with the test merchant credentials.
## Future stuff
Implement remains service endpoints
- Funding Service
- Signature Capture Service (probably never)
- Open Batch Service
- Close Batch Service
- BIN Service