ueSecurityToken
Defines a source key used to identify a merchant or reseller.
Description
This object defines a source key which is used to identify the merchant or reseller making the request. Source keys are obtained by logging into the merchant or reseller console.
A source key that has a PIN assigned must include the Hash object. It is highly recommended that a PIN always be used in conjunction with the source key.
The ClientIP is used to reference the end client. While this field is not required (it can be left blank), it is used by several fraud modules and is recommended.
Properties
Type | Name | Description |
---|---|---|
string | SourceKey | SourceKey obtained in merchant console. (required) |
ueHash | PinHash | Hash object for the PIN (only necessary if this source key has a PIN assigned). (required) |
string | ClientIP | The IP address of the end client. (required) |
Examples
<?php
class TokenClientExample {
public $client; // initialize client
public $token;// initialize token
function setUp{
$client=self::getClient(); //Using this class
$token=self::getToken(); //Using this class
}
static function getClient(){
//for live server use 'www' for test server use 'sandbox'
$wsdl='https://secure.eBizCharge.com/soap/gate/131C979E/eBizCharge.wsdl';
return new SoapClient($wsdl,array("trace"=>1,"exceptions"=>1));
//Must have Php5 compiled with --enable-soap
//Otherwise use pear soap. For more info please visit: http://pear.php.net/package/SOAP
}
static function getToken(){
// Creating a ueSecurityToken
$sourcekey = 'yQbOFkmykeygoeshere3Lc9PH1l14';
//Input your merchant console generated source key
$pin = '1234'; //Input the PIN set in the source editor for your source key
// generate random seed value
$seed=mktime() . rand();
// make hash value using sha1 function
$clear= $sourcekey . $seed . $pin;
$hash=sha1($clear);
// assembly ueSecurityToken as an array
// (php5 will correct the type for us)
$tok=array(
'SourceKey'=>$sourcekey,
'PinHash'=>array(
'Type'=>'sha1',
'Seed'=>$seed,
'HashValue'=>$hash
),
'ClientIP'=>'192.168.0.1'
);
return $tok;
}
}
?>
eBizCharge.ueSecurityToken token = new eBizCharge.ueSecurityToken();
// SourceKey and Pin (created in merchant console)
token.SourceKey = "O79****************************c8";
string pin = "1234";
// IP address of end user (if applicable)
token.ClientIP = "11.22.33.44";
// Instantiate Hash
eBizCharge.ueHash hash = new eBizCharge.ueHash();
hash.Type = "md5"; // Type of encryption
hash.Seed = Guid.NewGuid().ToString(); // unique encryption seed
// Assemble string and hash
string prehashvalue = string.Concat(token.SourceKey, hash.Seed, pin);
hash.HashValue = GenerateHash(prehashvalue);
// Add hash to token
token.PinHash = hash;
Updated over 5 years ago