Skip to content

Enabling Deposit Billing

Certain business use cases require merchants or suppliers to ask their customers for advance payments. To this end, JustOn allows for creating deposit invoices.

Businesses issue deposit invoices before any goods or services are supplied, usually with the intention to secure a sale. The deposit is a partial amount or a percentage of the total amount, which is to be paid up front. After the sale is completed, the deposit invoice is closed and the final invoice is issued.

Info

JustOn supports deposit billing when billing opportunities and billing arbitrary objects.

Enabling deposit billing in JustOn involves the following tasks:

Info

JustOn 2.47 has introduced deposit billing as an option to pro forma billing. As of JustOn 2.54, deposit billing and pro forma billing are available as separate features.

Deposit Billing Concepts

Basically, the creation of a deposit invoice is controlled using the ON field ON_Type on the source object. If this field is set to Deposit, JustOn generates a deposit invoice.

In order to request an advance payment with your deposit invoice, use the ON fields ON_DepositRate or ON_DepositAmount. Depending on your use case, you can then specify either a percentage value of the invoice total or a fixed amount as the deposit.

Info

For details about ON fields, see Using the ON Field Mechanism.

The deposit invoice is subject to the usual invoice proceedings and business processes finalization, payment registration and the corresponding balance generation.

Note

When you use deposit billing, be aware that JustOn does not consider order discounts with the deposit invoices, but only when generating the final invoices.

Deposit Invoice Life Cycle

The following sections describe how to work with deposit invoices, outlining their life cycle.

Deposit Invoice Creation

JustOn generates a deposit invoice if the field ON_Type on the source object is set to Deposit.

Note

Once you have set the field ON_Type on the source object to Deposit to trigger the deposit invoice creation, do not modify this field subsequently to make sure that the deposit billing features operate correctly.

You can define a deposit rate or a deposit amount using the fields ON_DepositRate or ON_DepositAmount on the source object.

Info

If both a deposit rate and a deposit amount is defined, the amount takes precedence.

Using a template detail named Deposit, you can provide appropriate texts for the invoice PDF, like the display type, deposit title or description (see PDF Contents).

After creating the deposit invoices, JustOn sets the custom field ON_ProformaInvoice on the source objects to the deposit invoices.

deposit_1
Creating a deposit invoice

Deposit Invoice Closure

Before you create the final invoice, you must close the deposit invoice. To close a deposit invoice, you use a custom process.

Applying the specific Apex class that JustOn provides for this purpose, your process

  • sets deposit invoices to the status Closed
  • clears the closed deposit invoices to 0
  • unregisters any assigned payment balances
  • sets the field RelatedInvoice of the now unregistered deposit payment balances to the corresponding deposit invoice
  • sets the custom field ON_Invoice to Final
  • clears the custom fields ON_Invoice and ON_LastInvoiceRun on the source objects to allow generating the final invoice

deposit_2
Closing the deposit invoice

Info

Usually, JustOn assigns unregistered deposit payment balances to the corresponding final invoices. Clearing the field RelatedInvoice of the unregistered deposit payment balance will allow to assign the balance to any matching invoice.

Final Invoice Creation

After you have closed the deposit invoice, you create the final invoice the same way and based on the same source records as the deposit invoice.

Doing so

  • registers the balances that were unregistered from the deposit invoice by the closing process to the final invoice
  • sets the field RelatedInvoice on the final invoice to the corresponding deposit invoice

deposit_3
Creating the final invoice, linked to the deposit invoice

Info

JustOn registers a down payment as a payment balance record. As invoices by default show related balance records, the final invoice shows the down payment information. Your business may, however, require to hide this information. In this case, you need a separate invoice template or a specific template detail that is configured to prevent the balance table from being printed. For details, see Hiding Balance Table.

Deposit Invoice Structure

A deposit invoice consists of two parts. The first part lists the invoice line items, which are represented as Information type invoice line items and therefore do not count for the grand total, followed by a subtotal section with tax breakdown. The second part contains an invoice line item of the type Deposit, followed by the corresponding tax breakdown, grand total and payment amount.

The two parts are optional. Whether they are displayed or not depends on whether there are already actual invoice line items to show or, respectively, on whether there is an advance payment defined. At least one part must exist to print the invoice line item table.

Example invoice line item table of a deposit invoice:

Pos. Title Tax Rate Net Price
1 Some Goods 20% 1000
2 Some Service 20% 500
Subtotal Net 1500
Tax Amount 300
Deposit Gross 1800
3 Down payment (50%) 20% 750
Tax Amount 150
Grand Total 900
Payment Amount 900

Pos. 1 and 2 are Information invoice line items, which do not count for the grand total of the invoice. Pos. 3 is a Deposit invoice line item. The value depends on the deposit setting used: it is either calculated based on the net subtotal of all invoice line items and the defined deposit rate, or it can be included as an absolute net amount using the deposit value.

Adding Deposit Billing Fields to Source Objects

In order to hold the required deposit billing data, you must add new fields to the source object, which can be

Info

If you need multiple billing configurations when billing arbitrary objects, JustOn must distinguish between different sets of field configurations using control field suffixes. To this end, append specific suffixes to the ON fields, as explained in Creating Recipient-Specific Controlling Fields.

  1. Navigate to the fields list of the source object.
  2. Create the following new fields as required.

    Mandatory fields

    API Name Data Type Description
    ON_Type Text (255) Must be set to Proforma or Deposit in order to create pro forma or deposit invoices. Is cleared automatically when the pro forma invoice is closed.
    ON_ProformaInvoice Lookup (Invoice) Shows the related pro forma or deposit invoice.

    Optional fields

    API Name Data Type Description
    ON_DepositRate Percent (3,2) Deposit invoice only. If set, JustOn creates a deposit line item with an amount of Deposit Rate * Total on the deposit invoice.
    If both a deposit rate and a deposit amount is defined, the amount takes precedence.
    ON_DepositAmount Currency (16,2) Deposit invoice only. If set, JustOn creates a deposit line item with the specified amount on the deposit invoice.
    If both a deposit rate and a deposit amount is defined, the amount takes precedence.
    ON_CloseProformaInvoice Checkbox Can be used to trigger the process to close the pro forma or deposit invoice.

    For help about creating fields, see Managing Object Fields.

Info

You can add more fields using the ON field mechanism.

Configuring Deposit Invoice Display

Adjusting Invoice Texts

Usually, deposit and pro forma invoices need other texts on the printed invoice than the final invoice. You can therefore define a template detail - named Proforma or Deposit, respectively - to provide appropriate texts.

For further information about template details and invoice PDF contents, see Configuring Template Details and PDF Contents.

The following fields are relevant on the template and the template detail:

Field Description Example Target
Display Type Specifies the type of the invoice to be printed to the PDF. It should reflect the nature of the pro forma or deposit invoice. Advance Invoice Template Detail
Text 2 Text to be rendered below the invoice line item table. Use it, for example, to describe how the deposit can be made (bank account etc.) and to specify the payment terms. Template Detail
Deposit Title Short description of the nature of the deposit
This field is mandatory if you have set a deposit rate or a deposit amount.
Advance Payment (50%) Template
Deposit Description Long description of the nature of the deposit Template
  1. Open the template or template detail to be edited.
  2. Double-click the intended field and specify the corresponding text as required.

    Alternatively, you can click Edit in the detail view to edit all fields at once.

  3. Click Save.

Adjusting Spacing Between Deposit Invoice Line Item Table Parts

As explained in Deposit Invoice Structure, the deposit invoice first lists the invoice line items as Information type invoice line items, then shows an invoice line item of the type Deposit, which represents the advance payment. In order to visually separate the two table parts, add the following custom CSS rule to the invoice template:

  1. Open the template to be edited.
  2. In the Layout & Design section, double-click the Custom CSS field and specify the CSS code as required.

    tr.Deposit.firstRowAfterSubtotal td {
        padding-top: 2.5em;
    }
    
  3. Click Save.

Enabling Deposit Gross Display

As explained in Deposit Invoice Structure, the deposit invoice lists the invoice line items as Information type invoice line items, followed by a subtotal section with tax breakdown. Optionally, you can display a line that shows the gross value for the Information type invoice line items.

To do so, add the following custom CSS rule to the invoice template:

  1. Open the template to be edited.
  2. In the Layout & Design section, double-click the Custom CSS field and specify the CSS code as required.

    .invoice-table .subtotal-calculated.criteria-forced.gross {
        display: table-row;
    }
    
  3. Click Save.

PDF Contents of a Final Invoice with Deposit

In the event of a final invoice with existing deposit payments, the invoice PDF shows additional information about the received payments and the final payments below the grand total.

You can define the display of the grand total label using the template field Deposit Grand Total Label. The field can contain placeholders. It is used only for final invoices with deposit payments - in all other cases or if the field is empty, the invoice PDF shows the label of the invoice field Grand Total, which is the standard behavior. The other fields use custom labels.

Using custom CSS, you can adjust the positioning, layout, etc. according to your needs.

Label Custom Label Description
Grand total The total amount of the invoice.
Received Payments (net) ReceivedPaymentsNet The calculated total net amount of all payments received on the related deposit invoice. This is the sum of all balance amounts that are related to the deposit invoice without taxes. The tax rate is taken from the field TaxRate__c of the Deposit line item of the related deposit invoice.
Tax on Received Payments ([TaxRate]) ReceivedPaymentsTax Taxes on the total net amount of the payments received. The placeholder [TaxRate] is replaced by the actual value, like 7%.
Received Payments (gross) ReceivedPaymentsGross Total gross amount of the payments received. The display is disabled by the default CSS rules.
Remaining Final Payment (net) FinalPaymentNet The remaining net final payment amount.
Tax on Remaining Final Payment FinalPaymentTax Taxes on the remaining net final payment amount.
Remaining Final Payment (gross) FinalPaymentGross Remaining gross final payment amount. The display is disabled by the default CSS rules.

Info

Use Configuring Overrides to overwrite the values of the custom labels.

Creating Process for Closing Deposit Invoices

Closing deposit invoices requires a process that calls the appropriate Apex class provided by JustOn. The process criteria that start the execution depend on your use cases. For example, you can define a custom checkbox field Close Deposit Invoice on the source object to trigger the process when the checkbox is selected.

The source object for the process depends on the object that is used for the deposit billing:

Info

You can use multiple billing configurations when billing arbitrary objects with different sets of field configurations using recipient-specific suffixes. In this case, create an individual process with an individual trigger for each configuration.

Set up the process as follows:

  1. In Setup, open Process Builder.

    In Salesforce Lightning, navigate to Process Automation > Process Builder.

    In Salesforce Classic, navigate to Create > Workflow & Approvals > Process Builder.

  2. Click New.

  3. Specify a name and an API name as required.
  4. Set the process to start when A record changes.
  5. Click Save.
  6. Select the object ( Order or Opportunity) whose modifications are to close the deposit invoice.
  7. Set the process to start when a record is created or edited.
  8. Define the process criteria as required.

    • [<object>].Close Proforma Invoice Is changed True
    • [<object>].Close Proforma Invoice Equals True
    • [<object>].ON_ProformaInvoice__c Is null False

    Combine the conditions with logical AND, that is, select All of the conditions are met.

  9. Select Apex as immediate action, and specify the class Close Proforma Invoice.

  10. Set the following Apex variables:

    • For recordIds, set the Field Reference value [<object>].Id.
    • Optionally, for Suffix, set the String value to the corresponding recipient-specific suffix.

      Suffix is required when using multiple processes for multiple billing configurations.

  11. Click Save.

  12. Click Activate.

    This triggers JustOn to execute the process when the Close Deposit Invoice checkbox is selected. It closes the deposit invoice and prepares the object for creating the final invoice (for details, see Deposit Invoice Closure).

Info

Depending on your use cases, the process setup and the objects to involve may vary.

For help with setting up processes, see Create a Process in the Salesforce Help, or contact the JustOn support team.

Enabling Deposit Billing to Multiple Parties

Generally, JustOn is set up to issue invoices to one recipient, usually via the account associated to the corresponding source record. Certain business use cases, however, require billing transactions to multiple parties. To cover these needs, you apply the configuration explained in Enabling Multiple Party Billing.

  1. Create multiple (recipient-specific) sets of ON fields as listed in Adding Deposit Billing Fields to Source Objects.

    For details, see Creating Recipient-Specific Controlling Fields.

  2. Create an individual closing process with an individual trigger for each configuration set, specifying the corresponding recipient-specific suffix as an Apex variable.

    Process Name Trigger Control Field Suffix
    Close Deposit Merch checkbox Close_Merch Merch
    Close Deposit Buy checkbox Close_Buy Buy

Enabling Dunning Reminders for Deposit Invoices

By default, pro forma invoices and deposit invoices are exempt from dunning processes. If your business, however, requires issuing reminders for pro forma invoices and deposit invoices, you must explicitly enable this option using the corresponding global setting Allow Pro Forma / Deposit Dunnings.

  1. In Setup, open Custom Settings.

    In Salesforce Lightning, navigate to Custom Code > Custom Settings.

    In Salesforce Classic, navigate to Develop > Custom Settings.

  2. Click Manage in the row of Global Settings.

  3. Click Edit in the Default row.
  4. Select the checkbox Allow Pro Forma / Deposit Dunnings.
  5. Click Save.

Next steps:

Managing Deposit or Pro Forma Invoices

Return to JustOn Administration.