Authorize Payment

Do an Authorize Payment Request.

Using the PHP SDK

You can also use the the PHP SDK to trigger an authorize Payment Request to authorize the given amount on the customer's credit card.

require '../vendor/autoload.php';

try {
    $client = new CartGateway\CartGateway([
        'account_id' => 1234,
        'access_token' => 'access-token',
    ]);

    $model = new CartGateway\Models\AuthorizePayment([
        // user information
        'firstname' => 'Firstname',
        'lastname' => 'Lastname',
        'email' => '[email protected]',
        'address' => '6 Pheasant Run',
        'zip' => '07733',

      	// amount and credit card
        'amount' => 2000, // in cents
        'card_number' => 6011111111111117,
        'card_cvv' => 123,
        'card_expiry_month' => 10,
        'card_expiry_year' => 2025,

        // unique reference
        'order_id' => '123456789', 

        // optional
        'phone' => '',
        'city' => 'Holmdel',
        'state' => 'NJ',
        'country' => 'US',
    ]);
    $response = $client->authorizePayment($model);
} catch (CartGateway\Exceptions\ApiException $e) {
    echo $e->message;
    exit;
}

// successfully authorized the amount
var_dump($response);

// the unique payment id
// use this value to capture this authorized payment
$paymentId = $response->id;
Language
Credentials
Header
Click Try It! to start a request and see the response here!