Difference between revisions of "CreditLine DLL API Integration"

From Payment Processing Software Library
Jump to: navigation, search
 
(C++/C#)
Line 23: Line 23:
 
*The Header file is the regular WIN32 header file. The data type LONG is 32 bit.   
 
*The Header file is the regular WIN32 header file. The data type LONG is 32 bit.   
 
*Keep in mind that in C# and any .NET environment for instance, LONG is 64 bit so you have to use int or Integer not LONG ot Long in your definitions.
 
*Keep in mind that in C# and any .NET environment for instance, LONG is 64 bit so you have to use int or Integer not LONG ot Long in your definitions.
*In C, the path has to be "C:\\911\\DATA", because back-slash is the escape char.</font></div>
+
*In C, the path has to be of format "C:'''\\'''911'''\\'''DATA", because back-slash is the escape char
 
+
 
====C# example====
 
====C# example====
  
 
   DllImport("CLCAPIW2.dll", EntryPoint="clcInit", SetLastError=true, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)
 
   DllImport("CLCAPIW2.dll", EntryPoint="clcInit", SetLastError=true, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)
  
public static extern int clcInit(string ClientName, string ServerName);
+
''public static extern int ''clcInit(''string ClientName'', ''string'' ServerName);
 
+
 
+
  
 
=== <span style="font-weight: 400"> </span><font color="#800000">Call Sequences</font> ===
 
=== <span style="font-weight: 400"> </span><font color="#800000">Call Sequences</font> ===

Revision as of 21:38, 24 February 2006

This guide is for developers using the DLL


Inventory

To begin with, you will need the following:

1) The interface header file CLCAPIW.h located in 911\BIN directory.

2) The library file CLCAPIW2.DLLlocated in 911/DATA directory.


Language Specific Instructions

Visual Basic

  • In VB you need to declare all the parameters using the ByVal prefix instead of ByRef. This includes the strings.
  • If you would like to use an OCX instead for Visual Basic, you can use CLClient.ocx in the same directory. Another alternative is File Based Communication.

VB example

Public Declare Function clcInit Lib "CLCAPIW2.dll" (ByVal ClientName As String, ByVal ServerName As String As Integer)

C++/C#

  • The Header file is the regular WIN32 header file. The data type LONG is 32 bit.
  • Keep in mind that in C# and any .NET environment for instance, LONG is 64 bit so you have to use int or Integer not LONG ot Long in your definitions.
  • In C, the path has to be of format "C:\\911\\DATA", because back-slash is the escape char

C# example

 DllImport("CLCAPIW2.dll", EntryPoint="clcInit", SetLastError=true, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)

public static extern int clcInit(string ClientName, string ServerName);

Call Sequences

On Startup

  • clcInit Set the client name and server name for communications
  • clcSetJournalDir Set the directory where the credit card journal is, e.g. [file:///G:/911/DATA C:\911\DATA]
  • clcSetMessageDir Set the directory where the file communications occur, e.g. [file:///G:/911/MESSAGESclcSetStationId C:\911\MESSAGES]

NOTE: the directories are actual directories on the server (where the dll is installed)

  • clcSetStationId Set a unique number for the terminal

On Shutdown

  • clcTerm Release the resources

On Start Dial


  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcSetAccountNum Set the card account number (for manual entry)
  • clcSetTrackData Set the scanned track data (for magnetic swipe)\
  • clcDial Start to dial the processor, connect before sending the transaction

On Regular Authorization

  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcSetInvoiceId Set the invoice number
  • clcSetOperatorId Set the operator number
  • clcSetTableNum Set the table number
  • clcSetPaymentType Set the payment type
  • clcSetGuestCount Set the guest count
  • clcSetAccountNum Set the card account number (for manual entry)
  • clcSetExpDate Set the expiration date (for manual entry)
  • clcSetTrackData Set the scanned track data (for magnetic swipe)
  • clcSetAmount Set the authorization amount ($20.01 is entered as 2001 )
  • clcSetCVCNumber Set the CVC Number
  • clcSetAVSData Set the AVS Data (e.g. Zip)
  • clcAuth Do the authorization, returns the Transaction Id if successful. Auths cannot be settled until Tip is added
  • clcSale Do the sale, returns the Transaction Id if successful
  • clcGetAuthCode Get the authorization code if successful
  • clcGetErrText Get the error text if failed

On Regular Force

  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcSetInvoiceId Set the invoice number
  • clcSetOperatorId Set the operator number
  • clcSetTableNum Set the table number
  • clcSetPaymentType Set the payment type
  • clcSetGuestCount Set the guest count
  • clcSetAccountNum Set the card account number (for manual entry)
  • clcSetExpDate Set the expiration date (for manual entry)
  • clcSetTrackData Set the scanned track data (for magnetic swipe)
  • clcSetAmount Set the authorization amount
  • clcSetAuthCode Set the force auth code (acquired from the call center)
  • clcSetCVCNumber Set the CVC Number
  • clcSetAVSData Set the AVS Data (e.g. Zip)
  • clcForce Actual do the force, returns the Transaction Id if successful

On Regular Credit

  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcSetInvoiceId Set the invoice number
  • clcSetOperatorId Set the operator number
  • clcSetTableNum Set the table number
  • clcSetPaymentType Set the payment type
  • clcSetGuestCount Set the guest count
  • clcSetAccountNum Set the card account number (for manual entry)
  • clcSetExpDate Set the expiration date (for manual entry)
  • clcSetTrackData Set the scanned track data (for magnetic swipe)
  • clcSetAmount Set the authorization amount
  • clcSetCVCNumber Set the CVC Number
  • clcSetAVSData Set the AVS Data (e.g. Zip)
  • clcSetAuthCode Set the force auth code (acquired from the call center)
  • clcCredit Do the credit, returns the Transaction Id if successful


On Add Tip

  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcAddTip Add actual tip to the transaction, need the Transaction Id

On Void Transaction

  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcVoid Void the transaction, need the Transaction Id

On Batch

  • clcSetMerchantIndex Optional, use a different merchant than the default
  • clcBatch Batch

On Gift Card Transaction

  • 'clcActivate' Optional, activate gift card
  • clcDeactivate Optional, deactivate gift card
  • clcInquire Optional, returns the balance on the gift card
  • clcSale Do the sale, returns the Transaction Id if successful. Add tip is not supported, so clcAuth does not apply
  • clcCredit Do the credit, returns the Transaction Id if successful

Call Samples for VB

Dim hCC As Integer;

Dim nResult As Integer;

Dim nTransNum As Integer;

Dim nBalance As Integer;

' On Startup

hCC = clcInit("TERM001", "CCVSVR1");

' NOTE: the directories are actual directories on the server

' (where the dll is installed). These are required.

clcSetJournalDir(hCC, "[file:///c:/911/data c:\911\data]");

clcSetMessageDir(hCC, "[file:///c:/911/messages c:\911\messages]");

clcSetStationId(hCC, 1);


' On Shutdown


clcTerm(hCC);

' On Start Dial


clcSetMerchantIndex(hCC, 1); 'default is 0

clcSetAccountNum(hCC, "4111111111111111");

clcDial(hCC);

' On Regular Authorization


clcSetMerchantIndex(hCC, 1); 'default is 0

clcSetInvoiceId(hCC, 123);

clcSetOperatorId(hCC, 1);

clcSetTableNum(hCC, 10);

clcSetAccountNum(hCC, "4111111111111111");

clcSetExpDate2(hCC, 02, 12);

clcSetAmount(hCC, 100); '$1.00

' sales can be batched right away but auths need tip to be added to them before batching

nResult = clcAuth(hCC); ' or nResult = clcSale(hCC);

if (nResult > 0)

       nTransNum = clcGetTransId(hCC);
       clcCopyAuthCode(hCC, strAuthCode);

else

       clcCopyErrText(hCC, strErrText);

' On Regular Force


clcSetMerchantIndex(hCC, 1); 'default is 0

clcSetInvoiceId(hCC, 123);

clcSetOperatorId(hCC, 1);

clcSetTableNum(hCC, 10);

clcSetAccountNum(hCC, "4111111111111111");

clcSetExpDate2(hCC, 02, 12);

clcSetAmount(hCC, 100); '$1.00

clcSetAuthCode(hCC, "123456");

nResult = clcForce(hCC);

if (nResult > 0)

       nTransNum = clcGetTransId(hCC);
       clcCopyAuthCode(hCC, strAuthCode);

else

       clcCopyErrText(hCC, strErrText);

' On Regular Credit


clcSetMerchantIndex(hCC, 1); 'default is 0

clcSetInvoiceId(hCC, 123);

clcSetOperatorId(hCC, 1);

clcSetTableNum(hCC, 10);

clcSetAccountNum(hCC, "4111111111111111");


clcSetExpDate2(hCC, 02, 12);

clcSetAmount(hCC, 100); '$1.00

clcSetAuthCode(hCC, "CREDIT");

nResult = clcCredit(hCC);

if (nResult > 0)

       nTransNum = clcGetTransId(hCC);
       clcCopyAuthCode(hCC, strAuthCode);

else

       clcCopyErrText(hCC, strErrText);

' On Add Tip


clcSetMerchantIndex(hCC, 1); 'default is 0

clcAddTip(hCC, nTransNum, 100); 'Add $1.00 Tip

' On Void Transaction
clcSetMerchantIndex(hCC, 1); 'default is 0

clcVoid(hCC, nTransNum);

' On Gift Card transaction
' sale & credit are the same as a regular credit card

clcActivate(hCC, "4111111111111111");

clcDeactivate(hCC, "4111111111111111");

nBalance = clcInquire(hCC, "4111111111111111");


' On Batch


clcSetMerchantIndex(hCC, 1); 'default is 0


nResult = clcBatch(hCC);


Fine Tuning

CreditLine behavior can be fine tuned to match your operational requirements.

Please see the in [file:///c:/911/data/911_CCV.INI c:\911\data\911_CCV.INI] for more information.

Note: Do not forget to remove ';' in front of a key to uncomment it; for the key to take effect