Products » dgCharge User Guide

Method:  dgCharge::CheckLastSettle()

CheckLastSettle

The CheckLastSettle method queries the results of the most recent settlement batch performed for the merchant. The results of the query are placed into the SettleBatchID, SettleCreditAmount, SettleCreditCount, SettleNetAmount, SettleNetCount, SettlePurchaseAmount, SettlePurchaseCount, SettleResponse, SettleSaleAmount, SettleSaleCount, SettleVoidAmount, and SettleVoidCount properties. If the most recent settlement cannot be queried for any reason, the above properties are not set, but the ErrorText property is set to contain a descriptive text of the error condition. A current merchant must be set before calling this method (see SetMerchant).

This method is applicable only if the current merchant is one that has been set to perform automatic settlement. Please see the AddMerchant method for more information.

This method takes no arguments and returns no value.

Code:
<%
    ' create an instance of the object
    Set oChargeObject = Server.CreateObject("dgCharge.Charge")
    ' establish the merchant
    bSetOK = oChargeObject.SetMerchant ("999999999","999999")
    ' check the results of the most recent settlement
    If bSetOK Then
      oCharge.CheckLastSettle()
      If oCharge.ErrorText = "no error" Then
        Response.Write ("Batch number: " & oCharge.SettleBatchID)
        Response.Write ("Settlement response: " & oCharge.SettleResponse)
        Response.Write ("Number of credits: " & oCharge.SettleCreditCount)
        Response.Write ("Amount of credits: " & oCharge.SettleCreditAmount)
        Response.Write ("Number of sales: " & oCharge.SettleSaleCount)
        Response.Write ("Amount of sales: " & oCharge.SettleSaleAmount)
        Response.Write ("Number of purchases: " & oCharge.SettlePurchaseCount)
        Response.Write ("Amount of purchases: " & oCharge.SettlePurchaseAmount)
        Response.Write ("Number of Voids: " & oCharge.SettleVoidCount)
        Response.Write ("Amount of voids: " & oCharge.SettleVoidAmount)
        Response.Write ("Net number: " & oCharge.SettleNetCount)
        Response.Write ("Net amount: " & oCharge.SettleNetAmount)
      Else
        Response.Write ("Could not get results of last settlement.")
      End If
    End If
%>