Created
March 9, 2012 15:52
-
-
Save VantivSDK/2007204 to your computer and use it in GitHub Desktop.
PHP SDK- Litle Payment full lifecycle example
This file contains hidden or 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 | |
require_once realpath(dirname(__FILE__)) . '/../lib/LitleOnline.php'; | |
#Authorization | |
#Puts a hold on the fund | |
$auth_info = array( | |
'id'=> '456', | |
'orderId' => '1', | |
'amount' => '10010', | |
'orderSource'=>'ecommerce', | |
'billToAddress'=>array( | |
'name' => 'John Smith', | |
'addressLine1' => '1 Main St.', | |
'city' => 'Burlington', | |
'state' => 'MA', | |
'zip' => '01803-3747', | |
'country' => 'US'), | |
'card'=>array( | |
'number' =>'4457010000000009', | |
'expDate' => '0112', | |
'cardValidationNum' => '349', | |
'type' => 'VI') | |
); | |
$initilaize = &new LitleOnlineRequest(); | |
$authResponse = $initilaize->authorizationRequest($auth_info); | |
#Capture | |
#Captures the authorization and results in money movement | |
$capture_hash = array('litleTxnId' =>(XmlParser::getNode($authResponse,'litleTxnId')),'id'=> '456',); | |
$initilaize = &new LitleOnlineRequest(); | |
$captureResponse = $initilaize->captureRequest($capture_hash); | |
#Credit | |
#Refund the customer | |
$credit_hash = array('litleTxnId' =>(XmlParser::getNode($captureResponse,'litleTxnId')),'id'=> '456',); | |
$initilaize = &new LitleOnlineRequest(); | |
$creditResponse = $initilaize->creditRequest($credit_hash); | |
#Void | |
#Cancel the refund, note that a deposit can be Voided as well | |
$void_hash = array('litleTxnId' =>(XmlParser::getNode($creditResponse,'litleTxnId')),'id'=> '456',); | |
$initilaize = &new LitleOnlineRequest(); | |
$voidResponse = $initilaize->voidRequest($void_hash); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please make sure to adjust the pathname, before running any tests