Check If a Customer Has Enough Credit Available
This code steps you through the process of validating a customer's credit card information and authorizing a potential charge against the card.
You can test for both outcomes:
Approved: When you pass odd dollar amounts, payment authorizations are returned with an 'Approved' status.
Declined: When you pass even dollar amounts, payment authorizations are returned with a 'Declined' status.
* BluePay PHP Sample Code
* This code sample runs a $3.00 Credit Card Auth transaction
* against a customer using test payment information.
* If using TEST mode, odd dollar amounts will return
* an approval and even dollar amounts will return a decline.
$accountID = "Merchant's Account ID Here";
$secretKey = "Merchant's Secret Key Here";
$mode = "TEST";
$payment = new BluePay(
'firstName' => 'Bob',
'lastName' => 'Tester',
'addr1' => '1234 Test St.',
'addr2' => 'Apt #500',
'city' => 'Testville',
'state' => 'IL',
'country' => 'USA',
'phone' => '1231231234',
'email' => [email protected]'
'cardNumber' => '4111111111111111', // Card Number: 4111111111111111
'cardExpire' => '1215', // Card Expire: 12/15
'cvv2' => '123' // Card CVV2: 123
$payment->auth('3.00'); // Card authorization amount: $3.00
// Makes the API Request for a credit card authorization
# Read response from BluePay
'Transaction Status: '. $payment->getStatus() . "\n" .
'Transaction Message: '. $payment->getMessage() . "\n" .
'Transaction ID: '. $payment->getTransID() . "\n" .
'AVS Response: ' . $payment->getAVSResponse() . "\n" .
'CVS Response: ' . $payment->getCVV2Response() . "\n" .
'Masked Account: ' . $payment->getMaskedAccount() . "\n" .
'Card Type: ' . $payment->getCardType() . "\n" .
'Authorization Code: ' . $payment->getAuthCode() . "\n";
echo $payment->getMessage() . "\n";