HSBC Payment CLASS with payer authentication service

Friends! We already suffered enough with HSBC payment and also for PASS implementation.

Finally I have made the total implementation in a single class. Before going with the source code let me explain how the PASS and API works together. We have two separate processes to complete the payment.
1. Send Credit Card information to HSBC PASS server for validation. It will return some PASS parameters.
2. Construct API XML based on PASS response and send back to HSBC to complete the payment.

But no worries! I have made the process very easy with my HSBC class.

Step – 1: Execute PASS
First create object of the class and assign following parameters and execute PASS.

// Credit Card Number

// Exipre Date with the format mm-yy

// HSBC Cardholderpan

// Currency Exponent

// Amount with Pound symbol.
// For Test payment it must not grater then 1

// Keep it same

// Currency Code for Pound

// Return URL to API Section

// Execute PASS

Step – 2: Execute API
Assign the following variables and execute API payment section. If the payment process returns “A” as a response then considers it as a successful payment.
// Set Payment mode
// For test payment set 'Y'
$hsbc->payment_mode = 'P';

// Set true to see the return XML
$hsbc->debug = false;

// Set CcpaResultsCode from PASS responds
$hsbc->ccparesultscode = $_POST['CcpaResultsCode'];

// CAVV from PASS responds
$hsbc->cavv = $_POST['CAVV'];

// XID from PASS responds
$hsbc->xid = $_POST['XID'];

// Payment information for API XML
$hsbc->xmldata = array(
// HSBC Username
"name" =>"XXXXX",
// HSBC Password
// HSBC Client ID
// HSBC Cardholderpan
// Credit Card No
// CVV code for Credit Card
// Expire Date with format mm-yy
// Issue number only for SOLO and Debit Cards
// Start date only for SOLO and Debit Cards
// Amount For test tranjection it must be 1
// Customer Information
"email" =>"",
"street1"=>"3/A 2nd floor",
"street2"=>"Dhaka Bangladesh",

// Execute Payment
$result = $hsbc->execute_api();

if( $result == "A")
echo "Pyment success";
echo "Payment failed";

Test Payment:
To execute test payment set payment_mode to Y in API section. For each test transaction the payment amount can not grater then 1.

Set $hsbc->debug = true to see the response XML to debug your integration

Download HSBC Payment Class

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image