GithubHelp home page GithubHelp logo

PHP CardConnect Adapter

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();

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

$authorization_response = $client->authorize([
    'account' => '4242424242424242',
    'amount'  => '100',
    'expiry'  => '0120',
]);

You can also authorize and capture in the same request like so

$capture_response = $client->authorize([
    'account' => '4242424242424242',
    'amount'  => '100',
    'expiry'  => '0120',
    'capture' => 'Y',
]);

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

composer test

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

CardConnect's Projects

CardConnect doesnโ€™t have any public repositories yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.