post https://api.cartgateway.com/payment/charge
Do a Charge Payment Request.
Using the PHP SDK
You can also use the PHP SDK to trigger a Request to Charge the Customer's Bank Account.
require '../vendor/autoload.php';
try {
$client = new CartGateway\CartGateway([
'account_id' => 1234,
'access_token' => 'access-token',
]);
$model = new CartGateway\Models\ChargePayment([
// 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->chargePayment($model);
} catch (CartGateway\Exceptions\ApiException $e) {
echo $e->message;
exit;
}
// successfully captured the amount
var_dump($response);
// the unique payment id
// use this value to do a void/refund/lookup
$paymentId = $response->id;