What is Automated Collections? #
Chargent Automated Collections is an add-on module that automatically communicates with customers, letting them know that they’ve missed a payment. This feature provides them with a Payment Request link that allows them to update their payment information and get their account back in good standing.
Automated Collections also allows you to automatically retry collecting payments based on the schedule and logic that you choose. It takes minutes to configure and activate. Once activated, there’s no more need to spend time sending emails and making phone calls to collect on late payments.
Prerequisites
- Chargent Base and Transaction Packages version 5.85 or newer installed
- Chargent configured with active gateway
- Payment Request is already configured
- The Automated Collections feature is activated (subscription required)
Setting up the Automated Collections Batch
In order for Automated Collections to work, you need to schedule a daily batch to run. The daily batch looks for records with the following.
- Payment Status = Automated Collections
- Next Transaction Retry date on the Automated Collections Stage Record
To Schedule the Batch:
- Click on the gear icon and select Setup.
- In the Quick Find, search and select Apex Classes
- Click the [Schedule Apex] button
- Provide a Job Name
- Use the Magnifying Glass to search for Automated Collections ScheduledBatchAutomatedCollections
- Select the Frequency Weekly and check every day of the week.
- Modify the End Date to be a distance in the future like 12/31/2099
- Select the Run Time for your batch (we recommend running the batch in the middle of the night so reconciling can be done in the morning).
- Click [Save]

Enabling Automated Collections
- Click the App Launcher and select the Chargent App
- Click the “Chargent Settings” tab and select the “Chargent Automated Collections” subtab
- Toggle the Automated Collections switch to Enabled
Add Your Failed Payment Stages
There are two things that need to be set in order to set up each stage of Automated Collections
- Email Template: The email you want to send for each stage
- Retry Options: How long after the failed payment you want Chargent to automatically retry charging the card or bank account on file

To add a new stage click the icon above the [Cancel] / [Save] buttons
If you already have an Email Template setup for this stage you can select it from the drop down menu then select the Retry Option based on the sequence.
Collect Any Payment #
Collect Any Payment gives you 3 additional ways to trigger your Automated Collections process outside of the Automated Collections set up.
- Trigger any Chargent Order by clicking the [Start Automated Collections] button
- Create an API Trigger
- Use the Chargent Automated Collections Template Flow that Chargent provides.
Start Automated Collections Button
Chargent understands that not all collections can be automated through the standard Automated Collection process. Sometimes your business needs the option to quickly start the Automated Collections process manually.
With Chargent’s Collect Any Payment feature, you can add the [Start Automated Collections] button to the Chargent Order which allows you to instantly put that record into the Automated Collections process.

- Navigate to the Chargent Order Record
- Press the [Start Automated Collections] button
- Select the Automated Collection Process you want to trigger
- Press the [Start Collections] button
Automated Collections In Flows #
Chargent likes to make it as easy as possible to collect payments anywhere in Salesforce. This is why we have added a Chargent Automated Collections Flow that can be used to trigger the Automated Collections process. You can use the existing Flow or modify it to your business needs. Modifications should only be done by someone who understands how Flows work in Salesforce.

For Flows, you will have an Apex Action to Create Automated Collections and a Global class called ACFlowCreate.
Inside you can find the InvocableMethod createAutomatedCollections, this method receives a list of AutomatedCollectionsInput.
Below is a description of each attribute:

- AC Process to Trigger: This is used to specify which Automated Collections Process to be triggered.
- Record ID List: This is used to define the chargent Order Record IDs to be targeted for the triggering of Automated Collections.
- Post-Collection Payment Status (optional): This is the value applied to the ‘Payment Status’ field on the related Chargent Order record after this Automated Collections process has collected a payment.
Below is the Output Values:

- Chargent Orders – AC Not Triggered: This is the list of Chargent Order records for which AC has been triggered.
- Chargent Orders – AC Triggered: This is the list of Chargent Order records for which AC could not be triggered.
- DML Status: This is the status of the DML operation.
- Result: This is the result of the operation.
Automated Collections using an API Trigger #
As we can see in the diagram below, we are using the ACWebservice class as an entry point, this class has the webservice annotation to allow it to be used as a soap api.

Note: The ActionService class, getService() and performAction(String input) methods are global, this means that those methods can be accessed and used in apex code outside the package. |
createAutomatedCollections (from ChargentOrders)
<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:acw=”http://soap.sforce.com/schemas/class/ChargentBase/ACWebservice”> <soapenv:Header> <acw:SessionHeader> <acw:sessionId>***************</acw:sessionId> </acw:SessionHeader> </soapenv:Header> <soapenv:Body> <acw:createAutomatedCollections> <!–One or more repetitions:–> <acw:lstRecordObjectIds>lstRecordObjectIds1 </acw:lstRecordObjectIds> <acw:lstRecordObjectIds>lstRecordObjectIds2 </acw:lstRecordObjectIds> <acw:processId>processId</acw:processId> <acw:onCompletePaymentStatus>onCompletePaymentStatus </acw:onCompletePaymentStatus> </acw:createAutomatedCollections> </soapenv:Body> </soapenv:Envelope> |
createAutomatedCollectionsForObject (from any object that has a relationship to ChargentOrder)
<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:acw=”http://soap.sforce.com/schemas/class/ChargentBase/ACWebservice”> <soapenv:Header> <acw:SessionHeader> <acw:sessionId>***************</acw:sessionId> </acw:SessionHeader> </soapenv:Header> <soapenv:Body> <acw:createAutomatedCollectionsForObject> <!–One or more repetitions:–> <acw:lstRecordObjectIds>lstRecordObjectIds1 </acw:lstRecordObjectIds> <acw:lstRecordObjectIds>lstRecordObjectIds2 </acw:lstRecordObjectIds> <acw:processId>processId</acw:processId> <acw:onCompletePaymentStatus>onCompletePaymentStatus </acw:onCompletePaymentStatus> <acw:lookupRelationWithOrders> ChargentBase__Order__c </acw:lookupRelationWithOrders> </acw:createAutomatedCollectionsForObject> </soapenv:Body> </soapenv:Envelope> |
By initiating the Automated Collections Process it will create the following based on the process you selected.
- Email with a Payment Request link (if your process includes email)
- Payment Request Link referencing the Chargent Order
- Automated Collection Stages
Payment Status is changed to Automated Collections
Add / Edit Email Template
Note: The following merge fields need to remain in your email template in order for Automated Collections to work.
[[amount due]] [[decline date]][[payment request link]]
You can add new email templates or modify existing templates in order to customize your automated messages. Email templates are sent based on your Retry Options and should coincide with the sequence. For example, the first email may just be a reminder that a payment was missed, whereas the 3rd email may be a final attempt for payment before deactivation or termination.
To create a new email template or edit an existing one, click on the pencil icon and select the appropriate action.
You will see 3 icons: View: This allows you to view the existing Email Template
Edit: This allows you to edit the existing template
Delete: This will allow you to delete the existing template
To create a new template, click the [New Email Template] button
When creating the new template, you will need to provide the following:
- Email Template Name – a name to identify the template
- Description (optional) – a brief description of what the template should accomplish
- Subject Line for the email – something to catch their attention
- Email Body – what the template for this stage should say.
Be sure to click the [Save] button when you are finished setting up your Email Templates and Retry Options.
Advanced Settings:
In the “Advanced Settings” tab, you will have additional options for customizing your Automated Collections setup. You can control both the ‘Automated Collections Batch Chunk Size’ and the ‘Expiration Time in Hours’.
- Automated Collections Batch Chunk Size: This tells Salesforce how many records to batch. If you have 120 records, and this is set to 30, then you will have 4 batches of 30 records each.
- Automated Collections Expiration Time in Hours: This setting tells when to expire the completed Automated Collections Records, and also when they should be deleted.
How Automated Collections Works #
When you enable Automated Collections and set up your stages above, the batch will run daily and look for failed payments. If a failed payment is detected, the Payment Status field of the Chargent Order record will change from ‘Recurring’ to ‘Automated Collections’ and begins the automated collections process.
Note: If the Payment Status updates to Error, you want to make sure that Automated Collections is enabled and you have at least one stage setup to be automated.
The transaction will be attempted based on the “Retry Options” you’ve chosen for each stage, and the automated collection email templates will be sent each time those retries fail.. Each time an Order record has the Payment Status of “Automated Collections,” a Chargent Automated Collections record is created along with a Chargent Automated Collections Stages record for each upcoming retry attempt.

When a successful Payment is made, all unused Chargent Automated Collections Stage records are deleted, and the used records are subsequently deleted based on the “Automated Collections Expiration Time in Hours” field in the “Advanced Settings” tab.
The Payment Status is automatically set back to Recurring in order to process all future payments as normal.
Automated Collections Dashboard #
The Automated Collections Dashboard stores records in aggregation in order to preserve the data. The Dashboard serves as a one stop overview of everything that’s happening with your collections process. The dashboard will show you the cash being collected monthly and weekly. It will also break down which stages are working, when people are paying, and all current accounts that are in collections.
To get to your Automated Collections Dashboard
- Click the App Launcher and select the Chargent App
- Click on the Automated Collections tab
You can edit this page to add or remove each section based on what your team needs to see.

Deleting the Automated Collection Records will not change the data viewed in the Automated Collections Dashboard. This is due to the aggregation of the data in order to preserve the data. It’s recommended that you use the standard Salesforce Reporting filters to hide any data that you don’t need to view. For additional information check out our article in our knowledge base
Here is the breakdown of each section:
Performance Chart Monthly: This chart shows you how much cash has been collected on a monthly basis. This includes both retries, and people who have click on the payment request link from an account that was in the Automated Collections process.
Performance Chart Weekly: This chart shows you how much cash has been collected on a weekly basis. This includes both retries, and people who have click on the payment request link from an account that was in the Automated Collections process.
Performance Process Success: This is a highlight view of which Automated Collections process is succeeding and which ones are failing. This allows you to modify your campaign so you can test different variations and increase your collections revenue.
Stages Success: This measures the success rate of each stage within a process. It will tell you at what point you are reaching your customers and getting them to act. Like the Process Process Success, this will also allow you to modify your stages to increase your collections revenue. If you have multiple processes, you can use the tabs to select which process you want to look at or use the dropdown arrow to select any that may not be visible.
Customers in Collections: This is a list of all customers and accounts that are currently in collections.
Example of an Automated Collection flow
Failed Payment #1
Email Template: Automated Collections Payment Request. This indicates to the customers that their payment failed and provides them with a link to update the payment information and re-submit the payment.
Retry Option: 3 Days After. This means that Chargent will try to charge the payment device on file 3 days after the initial declined payment.
Failed Payment #2
Email Template: An email explaining that the payment failed recently, and that you’ve recently sent a payment link they may use to correct the issue. This email can provide contact information for your billing department, as well as any next steps your customer should take to resolve this matter.
Retry Option: Day of The Month, 1 or 16. This retry will occur the day after most people receive their paycheck, and may have a better chance of success if the reason for the original decline was insufficient funds.
Failed Payment #3
Email Template: An email explaining to your customer that you’ve attempted to collect payment unsuccessfully, and that their subscription or service will be suspended (depending on your policy).
Retry Options: ‘Stop Recurring, Mark as Unpaid.’ This option will remove the Order from the daily recurring batch and mark it as ‘Unpaid’ or ‘Error.’
Looking for more information on Automated Collections? Check out our Automated Collections Page and our documentation.