AppFrontier

Table of Contents

Chargent Features



Chargent Anywhere

Chargent Anywhere allows you to process payments from any object in Salesforce. The Chargent Anywhere component contains four buttons.

  • Send Pay Request - Allows you to send an email with a URL to a secure payment page

  • Payment Console - Allows you to enter credit card information in a secure manner and either process one time payment or setup recurring billing.

  • Add Cash - Allows you to create a transaction record for a cash entry (does not get sent to your payment gateway).

  • Add Check - allows you to create a transaction record for a paper check entry (does not get sent to your payment gateway).


Using Chargent Anywhere with Payment Console and tokenization you reduce the scope of PCI Compliance by never storing sensitive credit card or bank account number information in Salesforce.

For an overview of configuring Chargent Anywhere, Payment Requests, and Payment Console, check out the following video.



For setting up and customizing Chargent Anywhere, check out our Chargent Anywhere Quick Start Guide for Chargent Anywhere

Also check out the Chargent Anywhere User Guide for Chargent Anywhere.



Payment Requests

Payment Request Setup

Notes:

  • If you are using your own Visualforce Pages from a previous version of Payment Requests, you can view the original documentation here. The setup instructions will no longer work with the Salesforce Security Updates to the Guest User (Winter ‘21) however this can be used as a guide in troubleshooting possible issues with any past configurations.

  • If you are upgrading, you will need to replace the "Active Site Home Page" component with the "PaymentRequest" lightning web component to use your original pages. This is done by going into your Salesforce Setup and Editing your Site.


Prerequisites

  1. Setup your Site:

    • Click the gear icon and choose Setup
    • In the Quick Find type and select Sites
    • Click "New " to Create a New Site
    • Site Label: Choose a name, for example: Payment Request
    • Site Name: Choose a name, for example: PaymentRequest
    • Clickjack Protection Level: Use default or check with your IT department
    • Select PaymentRequest as Active Site Home Page
    • Active: Checked
    • Require Secure Connections (HTTPS): Checked
    • Save

    site

  2. Setup My Domain

    • Click the gear icon and select Setup
    • In the Quick Find search for and Select “My Domain
    • Follow the steps to setup My Domain

    domain

    Note: There is a time delay between Domain Registration and Domain Ready for Testing. You have to complete all steps and Deploy the domain to Users.


Payment Request Setup

Once you have My Domain deployed and your Site setup, you will want to make sure you are on Chargent version 5.84 or newer. If you are on an older version of Chargent you can upgrade using our PIM (Package Installation Manager). This will add the Chargent Payment Request Setup Wizard to your Chargent Package.

  • Some of the following steps have been updated and may be slightly different depending on the version of Chargent you are running.

  1. Click on the App Launcher and select the Chargent app
  2. Click Chargent Settings
  3. Click the sub tab for Chargent Payment Request Setup Wizard.

The App will determine if you have a previous version of Payment Requests installed and will walk you through mirroring the existing setup. If this is your first time installing Payment Requests, it will guide you through the process.



Site Selection:

The first step of the configuration is the Site Selection. Here you will see the Salesforce Site you setup previously and any additional Sites that may have already been setup. You will choose the one dedicated to your Payment Requests:

site

Configure:

Step 2: The configuration page will mirror your Gateway settings. If this is your first time setting up Payment Requests, it will provide the recommended settings, otherwise it will mirror your Payment Request settings on the Advanced Settings tab. Here you will set the following:

  • Payment Methods you want to accept? This is either credit card or Bank Account (ACH, eCheck, Direct Debit)
  • Create Payment Requests for all Chargent Orders will create a Payment Request record for every Chargent Order created. Keep in mind this will also create a Payment Request for any transaction that is done from within Salesforce including the Payment Console.
  • When to have Payment Requests Expire in Days. This sets the expiration date for your Payment Request links. The Payment Request Status field on the record will change to Expired.
  • Show Debug is for when you need to test and see the data going from your Salesforce account to your Payment Gateway. This should always be set to No or unchecked in the gateway if you are processing live transactions.

configure

Layout:

When Use Custom Pages is enabled, your Customized Payment Request Visualforce pages will be used. If it’s disabled, it will use the default payment page for your Payment Request links and allow you to make some customizations.

Step 3: Upload your Company Logo

  • Click the [Upload] button to add your Logo (recommended size is 250px or less)

Step 4: Choose your Payform Location

  • This sets the alignment of your form to either Left, Center, or Right.

Step 5: Additional Fields

  • Show email field in billing address on the payform
  • Show Country field in billing address on the payform

Step 6: Edit Your Welcome Text

  • Your Welcome Text will display with the logo on your form and can provide direction to filling out the payment information.

pay

Step 7: Edit your Success, Failure, and Cancel Page Messages

  • Customize your Success, Cancel, and Fail Page to let customers know the payment they used processed as expected or if the payment was declined. If they cancel the payment, it will let them know they successfully canceled and payment will not be processed.

Step 8: Edit your Page Footer

  • You can include a small logo to your footer text as well as custom links to your company’s website.

Review:

Allows you to Preview the Page and finish the setup.



Sending a Payment Request

Our Payment Request feature allows you to generate and send a payment link (URL) to your customers directly from any object you’ve configured Chargent Anywhere on. This payment link can also be used in Salesforce email templates, your own email service / application, over IM, or really any media that has clickable links! Let’s take a look at how Payment Request works.

  1. Click the Send Payment Request button in the Chargent Anywhere Lightning component
  2. Click the Contact picklist to choose the contact to which you’re sending the request (You may also manually enter an email address in the Recipient Email Address field instead).
  3. Enter the Request Amount
  4. Enter the Payment Request Type: You have 3 types of Payment Request Types

    • Charge Full Amount - This will charge the total of the Payment Request
    • Authorize Full Amount - This creates an authorization only and does not charge the transaction
    • Authorize Minimum - This will only authorize the minimum amount your gateway will allow (this is generally $1.00)

  5. Enter optional info in the Request Notes (These are notes the recipient of this Payment Request will see in the email they receive)
  6. Click the Send Request button

Send Payment Request

Here is the email that the customer will receive showing the link to make their payment (fully customizable Salesforce email template).

Salesforce Email Template

The payment link takes them to a secure payment page, where their contact information and the amount is already populated. The customer simply has to enter their credit card, CSC (Card Security Code), and Expiration Date then press Charge.

Payment Request



The Payment Request will create the following records in your Salesforce Org:

  • Chargent Order - the Chargent Order acts as a payment source for the transaction. Its where the token will be stored for future payments and recurring billing.
  • Chargent Payment Request - the Payment Request object consists of all Payment Requests for all transactions. Each payment request generated is associated with a Chargent Order.
  • Transaction - Once the Payment Request is completed and payment has been made a transaction record is created showing the payment and associating the transaction back to the Chargent Order.

Once the Payment Request is paid, the Status field will change from Created to Paid.

Payment Request

For more information on setting up and configuring the Payment Request feature check our Payment Request Setup & User Guide.

Payment Requests for Developers

Using Custom Pages

If you choose to use Custom Pages for Payment Request, this section will outline how to create and prepare those pages. Please note that this section contains developer-level actions. As such, it is best practice that a Salesforce Certified Developer performs these tasks.

Useful Links
Use Lightning Components in Visualforce Pages
Using apex:slds

Existing Payment Request Pages

If you were already using Chargent Payment Request prior to upgrading to Chargent Base 5.84, and would like to continue using those customized pages, you will need to comment out the visualforce tag for the sitePaymentComponent and replace it with our new Chargent Payment Request Lightning Web Component.

An example custom page from the previous version of Payment Request might look like this:

<apex:page showHeader="false" standardStylesheets="true" id="page">
      <apex:outputPanel id="content" layout="block" styleClass="customstyle">
            <ChargentOrders:SitePaymentComponent showAddress="true" cancel="/PaymentCancel" success="/PaymentSuccess" fail="/PaymentFail"/>
      </apex:outputPanel>
      <apex:outputPanel id="footer" layout="block">
            <apex:outputPanel layout="block" styleClass="footer">
                  <apex:outputText value="AppFrontier LLC | 870 Market Street, Suite 809 | San Francisco, CA 94102 | USA | " styleClass="footertext"/>
                  <apex:outputLink value="http://www.AppFrontier.com" >www.AppFrontier.com</apex:outputLink>
                  <apex:outputText value=" | " styleClass="footertext"/>
                  <apex:outputLink value="mailto:support@appfrontier.com" styleClass="maillink">support@appfrontier.com</apex:outputLink>
                  <apex:outputPanel layout="block" styleClass="band" />
            </apex:outputPanel>
      </apex:outputPanel>
</apex:page>

In this example, the line you are looking for is:

<ChargentOrders:SitePaymentComponent showAddress="true"cancel="/PaymentCancel"success="/PaymentSuccess"fail="/PaymentFail"/>

To comment it out you would place a after this line

Changing it to this:

<!-- <ChargentOrders:SitePaymentComponent showAddress="true"cancel="/PaymentCancel"success="/PaymentSuccess"fail="/PaymentFail"/> -->

Once complete, the next step is to add the chargentPaymentRequest component to the page. Adding the Chargent Payment Request LWC Component to your Payment Request page works just like adding any other LWC on a visualforce page as outlined in the Salesforce documentation linked above.

First, make sure your page has the following tag within its markup:

<apex:includeLightning />

Next, add the chargentPaymentRequest Lightning Web Component. Where to place the component is completely dependent on your implementation. If you already have an existing payment request page with the old sitePaymentComponent, the best starting place will be the same place that line of code was or just below it if you have commented it out.

Place this code where you want it on the page. There are additional options you can set, which will be described below. Please refer to the salesforce documentation linked above on how to use those options and where to specify them.

<script type="text/javascript">
      $Lightning.use("ChargentBase:ChargentTakePaymentApp", function () {
            $Lightning.createComponent(
                  "ChargentBase:chargentPaymentRequest",
                  {
                        'formName': 'Pay Request Form',
                        'req': '{!$CurrentPage.parameters.req}'
                  },
                  "container",
                  function (cmp) {}
            );
      });
</script>
<div id="container"></div>

Note: The div with the id of “container” is where the platform will render the component. The script block can be placed anywhere on the page but typically is placed near this div.


Chargent Payment Request Configuration

The component you place on your page has several parameters used to properly render the component.

Parameter Type Required Description
req String YES Must be set to: 

'{!$CurrentPage.parameters.req}'

DO NOT set to anything else
formName String NO The header that will be displayed with the payment request form
hideEmailField Boolean NO Defaults to false. Set to true if you do not wish to display the email address field on the payment form
hideCountryField Boolean NO Defaults to false. Set to true if you do not wish to display the country field on the payment form
failPage String NO If using custom pages, set this to the name of the Visualforce page you wish to display to the user for a failed transaction
successPage String NO If using custom pages, set this to the name of the Visualforce page you wish to display to the user for a successful transaction
cancelPage String NO If using custom pages, set this to the name of the Visualforce page you wish to display to the user if they click cancel on the payment request page


Activating Your Custom Pages

Now that you’ve edited your pages to include the proper chargentPaymentRequest component, follow these steps to activate your Custom Pages:

  1. Navigate to Setup > Sites & Domains > Sites
  2. Click the [Edit] button next to the Site your Payment Request configuration is using
  3. Click the Search icon next to the “Activate Site Home Page” field
  4. Select the Visualforce page you customized for Payment Request
  5. Click the [Save] button

Note: These steps describe the most direct implementation of using the custom page you’ve created: adding it as the Active Site Homepage. However, when using custom pages, the payment request link will navigate the user to the Active Site Home Page for the specified site. Where you add your custom page to your site depends on your specific implementation requirements. The two options are:

  1. Active Site Homepage
    • Placing your custom page here means that anyone who accesses the site URL will be presented with your custom Payment Request page
  2. Available Visualforce Pages
    • Placing your custom page here will require that your active site homepage is coded to serve up the correct page. This is useful if you are using your site for multiple purposes or want to present another page prior to the Payment Request

Now that you’ve edited your Site to point to your custom Visualforce page, it’s time to toggle the “Use Custom Page” setting to Enabled in the Payment Request Setup Wizard.

  1. Click the App Launcher icon applauncher at the top-left of your screen, then click the “Chargent” app
  2. Click the “Chargent Settings” tab
  3. Click the “Chargent Payment Request Setup Wizard” tab
  4. Click the [Next] button to navigate to the Layout page of the wizard
  5. Click the toggle switch for “Use Custom Page”
  6. Click the [Next] button, then click the [Finish] button

Your custom pages are ready to test. Create a new Payment Request record and follow the Payment Link to view and test your custom page.



Basic Custom Page Code

If you’re using Custom Pages and need a quick starting point, here’s the code for that. Note that this code includes only our chagentPaymentRequest component and nothing else. You may place this component in any section / table / etc, and it will expand to fill the available space. You’ll want to customize this further to include your branding, layout, tracking pixels, etc.

<apex:page showHeader="false" standardStylesheets="true" id="PaymentRequest" cache="false">

      <apex:includeLightning />
      <apex:slds />

            <script type="text/javascript">
                  $Lightning.use("ChargentBase:ChargentTakePaymentApp", function () {
                        $Lightning.createComponent(
                              "ChargentBase:chargentPaymentRequest",
                              {
                                    'formName': 'Pay Request',
                                    'showCountryField': true,
                                    'showEmailField': true,
                                    'req': '{!$CurrentPage.parameters.req}'
                              },
                              "container",
                              function (cmp) {
                              }
                        );
                  });
            </script>
      <div id="container"></div>

</apex:page>


Chargent Payment Console

AppFrontier always strives to provide features that lower the scope of your PCI compliance. Chargent's Payment Console with tokenization can further reduce your PCI scope by allowing secure entry of payment information via the phone, protecting cardholder data that is never stored in your Salesforce database.

Chargent’s Payment Console feature allows you to process one time payments and set up recurring payments, directly from a Salesforce popup window. This makes it a convenient interface for call center agents, customer service, billing or sales teams since it is able to initiate payments, receive tokens back from the payment gateway, and create transaction records in Salesforce.

Most importantly, with the Payment Console feature, transactions and tokens are created without ever saving or storing cardholder account number information in Salesforce. This helps you reduce the scope of your PCI Compliance.



How Payment Console Works

When a user clicks the Payment Console button in Chargent Anywhere, they will see a popup prompting you to enter the billing address and payment data. You will be able to select what payment method you want to use in order to process a one time payment or setup a recurring payment schedule.

Chargent Payment Console


Activation Key:

When you set up your Payment Gateway using the Chargent Setup Wizard, you are prompted to set up the Payment Console. When you select ‘Yes’, an email is sent on your behalf requesting an Activation Key. Once you receive the Activation Key you will need to enter it into Salesforce.

You can enter your Activation Key by navigating to Chargent Settings and selecting the Chargent Feature Activation tab. You will also be able to request an activation key if you didn’t request it during the gateway setup.

  1. Click the [App Launcher] in the top left corner and select [Chargent app].
  2. Click [Chargent Settings] and the sub tab for [Chargent Feature Activation].
  3. Copy and Paste the Activation Key and click [Save].

Chargent Payment Activation

Payment Console Setup

If you originally chose to add the Payment Console during the initial setup of your payment gateway, you have already selected the buttons you want to display along with the types of credit cards you accept, and the payment methods. You can update these settings through your Gateway record to enable or disable specific features.

Payment Console configuration options are divided into several fields in the Gateway record:

  1. Available Card Types: Visa, MasterCard, American Express, etc...
  2. Available Payment Methods: Credit Cards, and/or Bank Account (ACH, echeck, Direct Debit)
  3. Payment Buttons: Authorize, Charge, Update Token
  4. Require CVV: This setting will require the CVV / CVV2 Security Code in the Payment Console. This is the 3 digit code on the back of the credit card. It will be either 3 digits for Visa / MasterCard or 4 digits for American Express.

Advance Tokenization Setup

For more information regarding your Payment Gateway settings, please check out the documentation specific to your gateway.


Using the Payment Console

When you have Chargent Anywhere installed on your Page Layout you will see the button to access the Payment Console.

Chargent Anywhere

When you click on the [Payment Console] button you will be prompted to enter the Billing Address.

Chargent Anywhere

When you click [Continue] you will have the option to select the Payment Method and choose whether you want to do a one time payment, a recurring payment, or a combination of both (one time payment with recurring payments).


Payment Method:

This is the payment method (Credit Card of ACH) you configured in the previous section or when setting up your gateway using the Chargent Setup Wizard.

Card: Credit Card (Visa, MasterCard, Discover, American Express, etc…). Chargent works with all major credit cards.

Bank Account: This can be either a Checking or Savings account. Bank Account also refers to ACH, eCheck, or Direct Debit in Australia.

One Time: This indicates that you are looking to process a one time payment.

Recurring: This will allow you to process a one time payment and set up a recurring billing schedule.

Recurring Billing

One Time Payments

If you are processing a one time payment, and do not need to set up a recurring schedule, you can just enter the above information and press the [Charge] Button.

Recurring Billing

If the transaction was successful you will see a green success window pop up and a Transaction record will be created. If the transaction is unsuccessful, you will see a red pop-up showing the decline and a Transaction record will be created with the decline reason.

Recurring Billing

Recurring Billing

Setting Up A Recurring Schedule

When you choose Recurring, you will have the option of adding a one time initial payment to be processed immediately along with the options to set up your recurring schedule. This field can be left blank if you only want to schedule payments for a future date.

Recurring Billing

When you have entered in the credit card or bank information, and filled out Amount fields to be processed, you can click the [Next] button to set up the schedule. There are some required fields and some optional fields to set up the billing to your requirements.

Required fields for Recurring Billing

  • Frequency
  • Payment Start Date

Optional fields for Recurring Billing

  • Fixed Day of the Month to Charge
  • Stop Rule is defaulted to Unending. Updating this field allows you to set when the recurring schedule should end.

    • Date: Recurring Billing schedule ends on a specific date. This requires you to set the Payment End Date field
    • Count: Recurring Billing schedule ends after a specific number of transactions. This requires you to set the Number of Payments field.
    • Balance Due: Recurring Billing schedule ends once the balance has been met.
    • Unending: Recurring Billing schedule continues until you change the status to Stopped.

Recurring Billing

Chargent Payment Console

Clicking [Next] will bring you to the Preview page where you will see the payment schedule. You should verify that the Frequency, Amount, and the schedule is correct. Once everything looks good you can click the button [Charge One Time Amount and Start Recurring Billing].


Chargent Payment Console

Add Cash / Add Check

Add Cash and Add Check both will create a transaction but do not send the payment information to your gateway. They are designed to help you keep track of additional payment types that are associated with the record. Add Check refers to a paper check. These buttons can also be hidden from the page.

  1. Press Add Cash or Add Check
  2. You can either select an existing Chargent Order or create a new one by selecting the box that says Create New Order
  3. Enter the Payment Date
  4. (Paper Check only) Add the check number
  5. Enter the Amount
  6. Click Save


Customizing the Payment Console

Once you have the configuration done and Payment Console working, you can now customize the Chargent Anywhere Component. You can set the defaults for the following items (please note, some may require custom fields to be added prior)

There are several items that can be setup to pre-populate in Chargent Anywhere.

  • Gateway - Assign a specific gateway to be populated automatically when you process a transaction.

  • Default Charge Amount - If you have a specific amount that you want to charge every time, you can automatically populate this based on a specific field.

  • Default Recurring Amount - Similar to the Default Charge Amount, if you have a specific recurring amount to be processed in your scheduled payments, you can set this as a default based on the field on the record.

  • Account - The Account is usually already set on the record however this field can also be set to default when processing payments using the Payment Console.

  • Contact - Allows you to select the contact on the record you are processing the transaction from. This will automatically populate to the Payment Console along with this contacts address for billing.

For the above items you will need to add custom fields to the Page Layout in order for these to populate.

  • Account and Contact, you would want to do a Lookup field.
  • Charge Amount and Recurring Amount you want to do a currency field.
  • Gateway you need the Gateway record ID

Create Custom Fields

  1. Click the [gear icon] and choose [Setup]
  2. Under [Objects & Fields] select [Object Manager]
  3. Choose the Object you have Chargent Anywhere installed
  4. Click [Fields & Relationships]
  5. Choose [New] and go through the setup for custom fields

When you create your custom fields it will give you a Field Name which you will use to configure the Chargent Anywhere LWC.

field

Configure Default Settings

  1. Navigate to a record on the object with Chargent Anywhere.
  2. Click the [gear icon] and select [Edit Page]
  3. Select the Chargent Anywhere Lightning Component.
  4. Add the field names and record ID where specified.
  5. Click Activate and Save.

Field References:

Gateway ID: You can get the Gateway ID from the URL on the Gateway record.

gateway

Additional Items to configure:

  • Show / Hide Remove Buttons: Allows you to display or remove buttons from your Chargent Anywhere Console. This includes Payment Request, Payment Console, Add Cash, and Add Check buttons.
  • Change the name of the Charge button: This allows you to modify the button name to whatever suits your organization best.

gateway id

Chargent Payment Console should now be configured. For additional help with Payment Console, please check out our Knowledge Base or contact our Support team.


Manually Scheduling the Apex Batch

If you originally said no when setting up your gateway, or if you are on a version prior to 5.40 and want to schedule your Apex batch manually, then do the following:

  1. Click on the gear icon gear icon on the top right side and select Setup.
  2. Under Custom Code select Apex Classes.
  3. Click Schedule Apex.

  4. apex

  5. Enter the following fields:

    • Job Name: You should name your batch something that reflects Recurring Billing so you can identify it later if needed.
    • Apex Class: Click on the magnifying glass and select the "sheduledBatchProcessing" class to be run.

    • Note: The class name contains a typo - there is no "c" in the word "scheduled". While that was not intentional, we can't change it!


    • Schedule Apex Execution:

      • Frequency = Weekly
      • Check every day of the week so that the batch runs daily.
      • Start Date = today’s date
      • End Date (important): The end date should be far into the future so that the schedule doesn’t end. Once the batch ends the recurring batch will no longer process recurring transactions. 2050 is generally a good year to use.
      • Start Time: Although you can choose any time you want we recommend 3am to give your team the whole day to review transactions and make any required adjustments or voids during business hours.

frequency

Processing Payments Using Chargent Orders

Note: Chargent Anywhere is the current way you should be processing Payments. If you are on Sites Edition or do not have access to the Payment Console, you may want to use our legacy method of processing transactions directly from the Chargent Order object.


You can also use the Chargent Orders records directly to process payments. Similar to Chargent Anywhere, which creates a Chargent Order record in the background, you can manually create a Chargent Order record and use the Charge, Authorize, Send Payment Request and use the Payment Console.

Chargent recommends you use tokenization rather than storing sensitive credit card information in Salesforce. Tokens can be used in place of the credit card in order to provide greater security. Storing credit card numbers is not recommended for PCI Compliance which is why Chargent provides settings to have the credit card data cleared after a successful transaction, after any transaction, or when a token is present on the Gateway record.

The minimum fields required to process a credit card transaction will vary slightly depending on your payment gateway and your settings. As a best practice, you should complete the basic fields below using the Payment Console or Payment Request tools.


In general terms, however, the following fields should be populated:

  • Charge Amount: This is the amount that will be sent to the payment gateway. This field is defaulted to the balance due unless the manual charge box is checked. If you don’t check the manual charge box then you want to fill out the subtotal field, and optionally the shipping and tax fields. See Chargent Order Amounts for more information.
  • Billing First Name and Billing Last Name (these automatically populate Credit Card Name when the information gets sent to the gateway)
  • Billing Address: The address associated with the credit card
  • Billing Zip Code:
  • Payment Method (Credit Card or Check -- Check applies to ACH / electronic check / Direct Debit)
  • Card Type (Visa, Mastercard, Amex, Discover and other payment sources)
  • Card Number
  • Card Expiration Month (2 digits - MM)
  • Card Expiration Year (4 digits - YYYY)

The CVC (Card Verification Code) will be required after you press the Charge button. If you have the CVC required with your payment gateway, then this needs to be populated when the popup asks for it. If you don’t have it required then you can leave it blank and press the Charge button.

If you are doing recurring billing you will need to use tokenization and provide the CVC for the initial transaction. Once a token is present recurring payments will occur as scheduled.

Optional but commonly used:

  • Billing Email (some gateways will send a receipt to your customer - Chargent also sends a receipt to this email address when a transaction is processed).
  • Invoice Number (may reduce your fees, useful for reconciliation).
  • Order Information (may appear on customer receipt as description)

For ACH / eCheck transactions:

  1. Bank Account Type (Checking, Savings or Business Checking)
  2. Bank Account Number
  3. Bank Routing Number
  4. Bank Account Name (person or company name on bank account)
  5. Bank Name (name of the financial institution)

Card Details

A Visualforce field that you can add to the page layout to give you a summary of the card information - Type, Last 4, and Expiration Date. It appears green if the card is more than 2 months from expiration, yellow if card is within 2 months of expiration, and red if the card is expired. When adding this Visualforce page to the Page Layout, update the settings to include the field name.

credit card

Chargent Order Amounts

The Chargent Orders Transaction package has the following fields that are involved in calculating a payment value:

  • Subtotal
  • Tax
  • Shipping

The Total field is automatically populated from these three fields. The Balance Due field is made up of the Total minus the total of all past transactions, including both Charges & Refunds. The Balance Due field also populates the Charge Amount field which is the amount sent to be processed with your payment gateway.

The Charge Amount field is automatically populated with the Balance Due however this field can be updated with any Charge Amount providing the checkbox for Manual Charge is checked. If the Manual Charge box is checked then Chargent sends the amount you enter to the gateway.

Chargent Order Recurring Billing

In order to set up Recurring Charges directly from the Chargent Order (versus using the Chargent Anywhere Payment Console above), you will need to create a new Chargent Order record as outlined in the Using Chargent document. Some additional fields need to be set in order to process recurring / subscription billing. Here you will find a list of Recurring Billing options and how they work with Recurring Billing.

Payment Status

Chargent requires a value of "Recurring" to include a record in its batch. There are four Payment Status options that can regulate how Recurring transactions work.

  • Recurring: Allows the record to be picked up in the batch for processing based on the frequency, and Payment Start Date.
  • Error: If Chargent discovers a problem with the transaction such as a declined form of payment, the payment status will change to "Error" and no further transactions will be processed until the status is changed back to "Recurring".
  • Stopped: You may use the "Stopped" status to temporarily pause recurring transactions.
  • Complete: When Chargent reaches a stop event, such as Balance Due, End Date or Count, it will change the status to "Complete".

Payment Frequency

The Payment Frequency field tells the batch how often to process a payment. This field needs to be set in order for recurring payments to occur. Chargent will look at the last recurring transaction record, check the frequency, then determine by the other Recurring fields if the payment should be processed. Here are the different frequencies that can be set and what they mean.

  • --None-- (default) - This will not be processed in the Recurring Billing batch
  • Once - a single transaction will occur on the Payment Start Date
  • Daily - one transaction per day that the schedule process is executed
  • Weekly - one transaction per calendar week on the same weekday
  • Biweekly - one transaction every two weeks on the same weekday
  • Monthly - one transaction per calendar month on the same day as the Payment Start Date
  • Bimonthly - one transaction every two months on the same day of the month
  • Quarterly - one transaction per every three months on the same day of the month
  • Semiannual - one transaction per every six months on the same day of the month
  • Annual - one transaction per every year on the same day
  • Biennial - one transaction per every two years on the same day

frequency

Note: There is a difference between pressing the Manual Charge button and the "Recurring" transactions that occur in the batch. As such, if you are collecting a down payment and setting up Recurring billing, you should set the Payment Start Date to date you wish the next transaction to occur, to prevent it from running prematurely. This can lead to your customer getting charged twice.


Payment Stop

The Payment Stop field is dependent on Payment Frequency. This field determines when transactions should stop running. Chargent offers you four options to manage the payment schedule of a recurring transaction. If this field is left blank, the payment schedule will run indefinitely.

  • Date - Chargent will process the last transaction on or before the Payment End Date depending on frequency. Payment End Date needs to be set for this to end based on a date.

  • Count - Chargent will stop processing transactions when the number of approved recurring transactions equals the value in the Payment Count field. This is helpful to follow an agreed payment schedule based on number of payments instead of date.

  • Note: this only tracks against the total number of "Approved" recurring transactions and does not include manual transactions by hitting the Charge button. If you would like to monitor this field, you can display or report on "Transaction Count Recurring".


  • Balance Due - Chargent will continue to process transactions until Balance Due is less or equal to zero.

  • Note: If the number of payments exceeds the total balance due you may end up charging more than was intended, resulting in a negative Balance Due.

    Chargent recommends only using Balance Due when the Charge Amount is evenly divided into the Total.


  • Unending - Chargent will process transactions with no stop event for as long as the Scheduled Apex is automatically executed and the Payment Status remains as Recurring..

Charge Date

This optional field can be set to a value (1-31) and recurring charges will be done on that day of the month. Regardless of how long it took to get it paid last time. If a card is declined, then finally approved a week later, the customer will still be charged on the same date next month, rather than 30 days from the previous successful recurring transaction.

This field is not used in Daily, Weekly, or Biweekly recurring transactions, but will work for any time periods Monthly or above. If this field is set to 31, Chargent will automatically charge on the 30th for months with 30 days, or on the 28th/29th of February.

Next Transaction Date

Chargent runs its logic and indicates when the next recurring transaction is going to occur in this field. Useful for reporting, and double checking your configuration.

Please note that the Next Transaction Date field cannot be modified, as it is set automatically by Chargent when a record is saved. For this reason, we recommend setting it to Read Only at the Page Layout level (not the field level security level).

  • Transaction Total: Transaction Total field represents the sum of all transactions including both charges and refunds.

  • Status: The Status field indicates the status of the Chargent Order. Based on the total minus all transactions, once the balance due is reached, the Status field gets updated to Complete.

  • Transaction Count: will display the sum total and number (respectively) of the Transactions related to this Chargent Order. Once the total of Approved charges equals the Total of the Chargent Order, the order is considered to be paid.

  • Payment Received: The Payment Receivedfield should automatically be updated to reflect this status after transactions are finalized, and has no impact on transaction behavior. Values for Payment Received include None, Partial and Full.

  • Balance Due: This field automatically calculates the difference between Amount and Transaction Total and is a useful field to display below or near Amount. Remember if "Manual Charge" is not checked, the Charge Amount will automatically reset to Balance Due.

Other fields that you may wish to send include:

  • Order Information field, which shows up as the Description in most gateways and email receipts to your customers.

  • Invoice Number. Not all gateways use the Invoice Number, but you may get more favorable rates if it is populated, and many companies use it for reconciliation.

Order Information and Invoice Number may be mapped to a different fields within your Gateway. Please check our Gateway Guides to make sure your Gateway has these fields mapped and which fields are mapped within your gateway.


Process builder and Validation Rules

Please be very cautious if you use the Process Builder, Validation Rules or Required fields on your Chargent Orders with recurring billing. Validation rules can prevent the Chargent Order from saving properly after a transaction occurs, and because Recurring transactions run in a batch you would only see the errors in the Apex Jobs monitoring page in Salesforce.

Certain validation rule problems can result in duplicate transactions, so please be sure to test any validation rules in Sandbox prior to deployment. Contact us for additional assistance.


Recurring Versus Manual Transactions

Chargent treats manual and recurring transactions separately. Many customers wish to charge the first transaction manually, to see if it goes through, before setting a recurring billing schedule.

The key thing to remember when running a manual transaction is that after you do a manual transaction, you need to set the Payment Start Date ahead a month or year, etc. to the day when you would like the customer to next be billed automatically, or use the new Charge Date field to indicate the day of the month when they should be billed. Because Chargent does not see manual charges as part of the recurring schedule, if you do not set the Payment Start Date ahead or the Charge Date is not populated, the following day it will once again attempt a transaction as part of its recurring schedule.

The Payment Start Date is the most effective way of preventing charges before a certain date, as Chargent does not evaluate records for possible charging until the Payment Start Date is today or in the past. So if my Charge Date is 15 and Payment Start Date is set for June 16th, the next transaction attempted will be July 15.


What determines a Recurring charge?

A record will only be considered for processing if the following criteria is met.

  • The Payment Status = "Recurring"
  • The Frequency is set
  • The Payment Start Date is set to a date prior to the batch run
  • The last transaction date was greater than the frequency.

    • Eg the last transaction was more than a month ago and frequency is monthly.
    • This only applies to transactions that are marked ‘Recurring’. If no transactions are present, or only manually run transactions not marked as recurring, then it would also be counted as outside the frequency and needing to be charged.

    Another consideration that determines if a transaction should be processed is the Charge Date.

  • Charge Date - If there is a specific day of the month the transaction should be processed.

If no Charge Date is set, Chargent evaluates the "last recurring transaction" and ensure that it has been the correct number of days since the last one was processed (9/15, 10/15, 11/15 if it was monthly). Chargent only looks at the date of the last recurring transaction that was successful (Response = Approved, Recurring = True, not voided).

Chargent Orders that meet the criteria will then be processed, and a transaction with the Recurring field = true will be created (assuming the charge is successfully approved).

recurring

Installment Payments

The Charge Amount field is the amount to be charged or authorized by the next transaction. If there are multiple charges, it will automatically reflect the Total of the Chargent Order, minus the total of past successful charges (also shown in the Balance Due field).

Check the Manual Charge field when you want to charge an amount different than the amount due on the Chargent Order, such as a fixed amount every month. This field prevents the Charge Amount from automatically being calculated and updated.

One thing to be aware of when using this manual override, however, is that your Charge Amount will not be prorated. So if the Amount is $100, and you set the Charge Amount is $30, Chargent will charge 4 x $30. The system does not automatically prorate the last amount to equal the remaining balance (if less than the Charge Amount).

To automatically set the Charge Amount to the final balance that is smaller than previous installments:

  1. Create a workflow rule that fires when the Payment Status is Recurring and the Stop is Balance Due
  2. Have it check the Charge Amount.
  3. If the Charge Amount is > Balance Due, set the Charge Amount to the Balance Due

When the next to last transaction gets run, the totals update and the charge amount would be updated at that time preparing it for the final charge.


Usage Examples

Charge a Credit Card manually from Salesforce, and then set a Recurring Payment schedule

  1. Recurring Payment Via Payment Console (Chargent Anywhere)

    • Click Payment Console
    • Select your Payment Gateway
    • If you have your Page setup to select Contacts select the contact from the dropdown, otherwise enter the credit card billing address.
    • Click Continue
    • Select the Recurring option and enter in Payment Details
    • Enter both the Initial Amount and Recurring Amount
    • Click Next
    • Set the Frequency and Payment Start
    • Optional (set the Payment Stop)
    • Optional (Set Day of the Month)
    • Click Next
    • Review the Scheduled Payments
    • Press the “Charge One Time Amount and Start Recurring Billing” button.

  2. Recurring Payment Setup from a Chargent Order (Sites Edition)

    • Enter a Subtotal or Total in the Chargent Order record
    • Set Manual Charge to "TRUE" and enter Charge Amount (this prevents the Charge Amount from recalculating based on Total minus Transaction Total)
    • Set Payment Method to "Credit Card"
    • Choose a Payment Frequency (anything from daily to Biennial)
    • OPTIONALLY choose a Payment Stop (Date, Count, Balance Due or unending)
    • OPTIONALLY choose a Charge Date to have the customer billed on the same date of the month
    • Set Payment Status to "Recurring"
    • Save the record

payment

Be sure to set your Payment Start Date to when the next transaction should process. The recurring batch will not recognize the initial charge using the charge button since the transaction record will not have the Recurring box checked.


Single Scheduled Transaction

To run a single scheduled charge in the recurring batch, first complete the Billing and credit card data as shown in the Recurring Billing setup above (Although it’s a one time charge Chargent still requires the recurring billing batch to pick it up automatically for a one time charge in the future).

  1. Set Payment Frequency to "Once"
  2. Set Payment Status to "Recurring"
  3. Set Payment Start Date to the date you want the single charge to run.
  4. Save the record


Recurring Billing Declines

If a card is declined as part of the scheduled Apex batch that runs recurring billing transactions:

  1. Payment Status will automatically change from Recurring to Error.
  2. Once you have received updated billing information, change the Payment Status back to Recurring.
  3. If you have processed a charge manually outside of the recurring billing schedule by clicking the Charge button, be sure to set the Payment Start Dateahead to the next time the record should be billed, to avoid a recurring charge the next time the batch runs.


Account Updater

Account Updater is a Scheduled Apex batch which checks the Credit Card Expiration Date fields on the Chargent Order Transaction package. Credit Cards that are expiring this month (or are already expired when the batch runs) are sent update notifications.

Please note that many Payment Gateways offer Account Updater services as well. These work without the cardholder needing to make any update, by updating the card on file related to the token stored in Salesforce.


Account Updater is based on Chargent's Payment Request feature, and works similarly, but simply stores updated billing information without processing a payment. An email notification is sent to customers with expired or expiring cards, with a link that takes them to a self-service hosted payment page.

Hosted on your own Salesforce Site, the payment page features a brandable, secure credit card form, where your customers enter their payment information. A customer's billing address is already populated on the form, and they can update it if they wish, along with providing new credit card details. Those values are automatically updated into the associated Salesforce Chargent Order record. This saves time in tracking down customers to provide updated credit card information.

card

For complete details and setup of Account Updater, check out our Account Updater documentation page.


Automated Collections

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:

  1. Click on the gear icon and select Setup.
  2. In the Quick Find, search and select Apex Classes
  3. Click the [ScheduleApex] button
  4. Provide a Job Name
  5. Use the Magnifying Glass to search for Automated Collections ScheduledBatchAutomatedCollections
  6. Select the FrequencyWeekly and check every day of the week.
  7. Modify the End Date to be a distance in the future like 12/31/2099
  8. 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).
  9. Click [Save]

payment

Enabling Automated Collections

  1. Click the App Launcher and select the Chargent App
  2. Click the “Chargent Settings” tab and select the “Chargent Automated Collections” subtab
  3. 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

payment

To add a new stage click the icon icon above the [Cancel] / [Save] buttons

save

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.



Add / Edit Email Template

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 pen and select the appropriate action.

You will see 3 icons:    icons

view   View: This allows you to view the existing Email Template

edit   Edit: This allows you to edit the existing template

delete   Delete: This will allow you to delete the existing template

To create a new template, click the [New Email Template] button new

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.

chargent

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.



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.