Created
January 7, 2016 14:27
-
-
Save GJSissons/697d758c82e3bb870af1 to your computer and use it in GitHub Desktop.
Vantiv Auth using PHP SDK (Litle)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace litle\sdk; | |
?> | |
<html> | |
<head> | |
<title>Vantiv Demo</title> | |
</head> | |
<body> | |
<h2>Authorization Example</h2> | |
<?php | |
require_once realpath(__DIR__). '/litle-sdk-for-php/litle/sdk/../../vendor/autoload.php'; | |
$auth_info = array( | |
'orderId' => '1', | |
'amount' => '10010', | |
'id'=> '456', | |
'orderSource'=>'ecommerce', | |
'billToAddress'=>array( | |
'name' => 'John Smith', | |
'addressLine1' => '1 Main St.', | |
'city' => 'Burlington', | |
'state' => 'MA', | |
'zip' => '01803-3747', | |
'country' => 'US'), | |
'card'=>array( | |
'number' =>' xxxxxxxxxxxx000', | |
'expDate' => '0112', | |
'cardValidationNum' => '349', | |
'type' => 'VI') | |
); | |
$initialize = new LitleOnlineRequest(); | |
$authResponse = $initialize->authorizationRequest($auth_info); | |
echo "<h3>Parsed results</h3>"; | |
echo ("Response: ".(XmlParser::getNode($authResponse,'response')) . "<br>"); | |
echo ("Message: ".XmlParser::getNode($authResponse,'message') . "<br>"); | |
echo ("Litle Transaction ID: " . XmlParser::getNode($authResponse,'litleTxnId')); | |
if(XmlParser::getNode($authResponse,'message')!='Approved') | |
throw new \Exception('LitleAuthorizationTransaction does not get the right response'); | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment