Skip to content

Instantly share code, notes, and snippets.

@VantivSDK
Created March 9, 2012 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VantivSDK/2007204 to your computer and use it in GitHub Desktop.
Save VantivSDK/2007204 to your computer and use it in GitHub Desktop.
PHP SDK- Litle Payment full lifecycle example
<?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);
@VantivSDK
Copy link
Author

Please make sure to adjust the pathname, before running any tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment