SDK Sale

Document created by gjsissons on May 6, 2016
Version 1Show Document
  • View in full screen mode

The Sale transaction enables you to both authorize fund availability and deposit those funds by means of a single transaction. The Sale transaction is also known as a conditional deposit, because the deposit takes place only if the Authorization succeeds. If the Authorization is declined, the deposit will not be processed.

 

Note: If the Authorization succeeds, the deposit will be processed automatically, regardless of the AVS or CVV2 response.

 

 

 

PHP example

 

<?php
require_once realpath(dirname(__FILE__)) . '/../lib/LitleOnline.php';
#Sale
$sale_info = array(
                  'orderId' => '1',
                      'id'=> '456',
              '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' =>'5112010000000003',
              'expDate' => '0112',
              'cardValidationNum' => '349',
              'type' => 'MC')
            );

$initilaize = new LitleOnlineRequest(); 
$saleResponse = $initilaize->saleRequest($sale_info);

#display results
echo ("Response: " . (XmlParser::getNode($saleResponse,'response')) . "<br>");
echo ("Message: " . XmlParser::getNode($saleResponse,'message') . "<br>");
echo ("Litle Transaction ID: " . XmlParser::getNode($saleResponse,'litleTxnId'));

 

Java example

 

import com.litle.sdk.*;
import com.litle.sdk.generate.*;

public class SaleExample {
    public static void main(String[] args) {
        Sale sale = new Sale();
        sale.setOrderId("1");
        sale.setAmount(10010L);
        sale.setOrderSource(OrderSourceType.ECOMMERCE);
        Contact billToAddress = new Contact();
        billToAddress.setName("John Smith");
        billToAddress.setAddressLine1("1 Main St.");
        billToAddress.setCity("Burlington");
        billToAddress.setState("MA");
        billToAddress.setCountry(CountryTypeEnum.US);
        billToAddress.setZip("01803-3747");
        sale.setBillToAddress(billToAddress);
        CardType card = new CardType();
        card.setNumber("375001010000003");
        card.setExpDate("0112");
        card.setCardValidationNum("349");
        card.setType(MethodOfPaymentTypeEnum.AX);
        sale.setCard(card);

        SaleResponse response = new LitleOnline().sale(sale);
        //Display Results
        System.out.println("Response: " + response.getResponse());
        System.out.println("Message: " + response.getMessage());
        System.out.println("Litle Transaction ID: " + response.getLitleTxnId());
    }
}

 

.NET example

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Litle.Sdk;

    class Example
    {
        [STAThread]
        public static void Main(String[] args)
        {
            LitleOnline litle = new LitleOnline();
            sale sale = new sale();
            sale.orderId = "1";
            sale.amount = 10010;
            sale.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;
            sale.billToAddress = contact;
            cardType card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4457010000000009";
            card.expDate = "0112";
            card.cardValidationNum = "349";
            sale.card = card;

            saleResponse response = litle.Sale(sale);
            //Display Results
            Console.WriteLine("Response: " + response.response);
            Console.WriteLine("Message: " + response.message);
            Console.WriteLine("Litle Transaction Id: " + response.litleTxnId);
            Console.ReadLine();
        }
    }

 

Ruby example

 

require 'LitleOnline'
include LitleOnline

#Sale
my_sale_info = {
  'orderId' => '1',
  'amount' => '10010',
  'orderSource'=>'ecommerce',
  'billToAddress'=>{
  'name' => 'John Smith',
  'addressLine1' => '1 Main St.',
  'city' => 'Burlington',
  'state' => 'MA',
  'zip' => '01803-3747',
  'country' => 'US'},
  'card'=>{
  'number' =>'5***********5100',
  'expDate' => '0112',
  'cardValidationNum' => '349',
  'type' => 'MC'}
}
sale_response = LitleOnlineRequest.new.sale(my_sale_info)

#display results
puts "Response: " + sale_response.saleResponse.response
puts "Message: " + sale_response.saleResponse.message
puts "Litle Transaction ID: " + sale_response.saleResponse.litleTxnId

1 person found this helpful

Attachments

    Outcomes