Skip to content

Instantly share code, notes, and snippets.

@VantivSDK
Created April 13, 2012 14:15
Show Gist options
  • Save VantivSDK/2377182 to your computer and use it in GitHub Desktop.
Save VantivSDK/2377182 to your computer and use it in GitHub Desktop.
.NET SDK - Litle Payment full lifecycle example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Litle.Sdk;
//full payment LifeCycle
class Example
{
[STAThread]
public static void Main(String[] args)
{
LitleOnline litle = new LitleOnline();
//Auth
authorization authorization = new authorization();
authorization.orderId = "1";
authorization.amount = 10010;
authorization.orderSource = orderSourceType.ecommerce;
contact contact = new contact();
contact.name = "John Smith";
contact.addressLine1 = "1 Main St.";
contact.city = "Burlington";
contact.state = "MA";
contact.zip = "01803-3747";
contact.country = countryTypeEnum.US;
authorization.billToAddress = contact;
cardType card = new cardType();
card.type = methodOfPaymentTypeEnum.VI;
card.number = "4457010000000009";
card.expDate = "0112";
card.cardValidationNum = "349";
authorization.card = card;
authorizationResponse response = litle.Authorize(authorization);
Console.WriteLine("Auth Response: " + response.response);
Console.WriteLine("Auth Message: " + response.message);
Console.WriteLine("Auth Litle Transaction Id: " + response.litleTxnId);
//Capture
capture capture = new capture();
Console.WriteLine("Going to write litleTxnId of " + response.litleTxnId);
capture.litleTxnId = response.litleTxnId;
captureResponse captureResponse = litle.Capture(capture);
Console.WriteLine("Capture Response: " + captureResponse.response);
Console.WriteLine("Capture Message: " + captureResponse.message);
Console.WriteLine("Capture Litle Transaction Id: " + captureResponse.litleTxnId);
//Credit
credit credit = new credit();
credit.litleTxnId = captureResponse.litleTxnId;
creditResponse creditResponse = litle.Credit(credit);
Console.WriteLine("Credit Response: " + creditResponse.response);
Console.WriteLine("Credit Message: " + creditResponse.message);
Console.WriteLine("Credit Litle Transaction Id: " + creditResponse.litleTxnId);
//Void
voidTxn newvoid = new voidTxn();
newvoid.litleTxnId = creditResponse.litleTxnId;
litleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
Console.WriteLine("Void Response: " + voidResponse.response);
Console.WriteLine("Void Message: " + voidResponse.message);
Console.WriteLine("Void Litle Transaction Id: " + voidResponse.litleTxnId);
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment