With applyLateFeesToInvoice API, you can charge your customers a Late Fee, if they do not complete their payment by the Due Date.

APISignature
applyLateFeesToInvoicesstatic List applyLateFeesToInvoices(List inputs)

applyLateFeesToInvoice API accepts Invoice ID and Late Fee ID as input parameters. This API calculates the late fee amount and adds the calculated amount to the Total Due Amount of the specified invoice Id. A Destinated Related A/R Transaction record is created for the late fee applied on the invoice. applyLateFeesToInvoice API returns ApplyInvoiceLateFeeResult object as response parameters. 

Request: ApplyInvoiceLateFeeAmount

Field

Type

Required?

Description

invoiceId

ID

Yes

The invoice Id to apply the late fee.

lateFeeIdID

Yes

Id of the late fee to calculate penalty amount for the specified invoice

Response: ApplyInvoiceLateFeeResult

Field

Type

Description

isSuccess

Boolean

Value is set as true if the Late Fee is applied successfully. 

Value is set as false if the API encounters an error.

errorMessageStringIf the API execution false, errorMessage string contains a detailed error message.
lateFeeAmountDecimalValue is set as the calculated late fee amount.
relatedA/RTransactionIdIDValue is set as the ID of the created Related A/R Transaction record
Apttus_Billing__LateFee__c lateFee = new Apttus_Billing__LateFee__c(
        Name = 'Test Late Fee',
        Apttus_Billing__LateFeeValue__c = 100,
        Apttus_Billing__LateFeeType__c = 'Amount'
    );
    insert lateFee; 

List<Apttus_Billing.CustomClass.ApplyInvoiceLateFeeInput> lateFeeInputs = new List<Apttus_Billing.CustomClass.ApplyInvoiceLateFeeInput>();
Apttus_Billing.CustomClass.ApplyInvoiceLateFeeInput lateFeeInput1 = new Apttus_Billing.CustomClass.ApplyInvoiceLateFeeInput(invoiceId, lateFee.Id);
lateFeeInputs.add(lateFeeInput1);
List<Apttus_Billing.CustomClass.ApplyInvoiceLateFeeResult> invoiceLateFeeResultList = Apttus_Billing.BillingService.applyLateFeesToInvoices(lateFeeInputs);
CODE