SDK Authorization example

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

The Authorization transaction enables you to confirm that customers have submitted a valid payment method with their order and have sufficient funds to purchase goods or services. Setting the <allowPartialAuth> element to true in the Authorization request enables the system to return Authorizations for a portion of the order amount for cases where the card does not have an adequate credit limit or balance available for the full amount.

 

An approved Authorization reduces the customer's credit limit (or bank balance, in the case of a debit card) by the amount of the approval by placing the amount on hold. If you have the Prepaid Indicator feature enabled, the Authorization response also includes an element that indicates if the card is Prepaid, as well as an element indicating the available balance on the card.

 

PHP Example

 

<?php
require_once realpath(dirname(__FILE__)) . '/../lib/LitleOnline.php';

#Authorization
$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' =>'4457010000000009',
              'expDate' => '0112',
              'cardValidationNum' => '349',
              'type' => 'VI')
            );

$initilaize = new LitleOnlineRequest(); 
$authResponse = $initilaize->authorizationRequest($auth_info);

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

 

Java example

 

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

//Authorization
public class AuthExample {
    public static void main(String[] args) {
        Authorization auth = new Authorization();
        auth.setOrderId("1");
        auth.setAmount(10010L);
        auth.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");
        auth.setBillToAddress(billToAddress);
        CardType card = new CardType();
        card.setNumber("375001010000003");
        card.setExpDate("0112");
        card.setCardValidationNum("349");
        card.setType(MethodOfPaymentTypeEnum.AX);
        auth.setCard(card);

        AuthorizationResponse response = new LitleOnline().authorize(auth);
        //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();
            authorization authorization = new authorization();
            authorization.orderId = "1";
            authorization.amount = 1495;
            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);

            //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

#Authorization
auth_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' =>'4**************9',
  'expDate' => '0112',
  'cardValidationNum' => '349',
  'type' => 'VI'}
}
auth_response = LitleOnlineRequest.new.authorization(auth_info)

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

Attachments

    Outcomes