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:
- Bank Account Type (Checking, Savings or Business Checking)
- Bank Account Number
- Bank Routing Number
- Bank Account Name (person or company name on bank account)
- Bank Name (name of the financial institution)
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 the 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.
Chargent Order Amounts
The Chargent Orders Transaction package has the following fields that are involved in calculating a payment value:
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. 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.
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”.
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
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.
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..
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).
Other Transaction-Related Fields
- 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 Received field 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 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 ensures 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).
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:
- Create a workflow rule that fires when the Payment Status is Recurring and the Stop is Balance Due
- Have it check the Charge Amount.
- 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.
Charge a Credit Card manually from Salesforce, and then set a Recurring Payment schedule
- 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.
- 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
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).
- Set Payment Frequency to “Once”
- Set Payment Status to “Recurring”
- Set Payment Start Date to the date you want the single charge to run.
- Save the record
Recurring Billing Declines
If a card is declined as part of the scheduled Apex batch that runs recurring billing transactions:
- Payment Status will automatically change from Recurring to Error.
- Once you have received updated billing information, change the Payment Status back to Recurring.
- 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 Date ahead to the next time the record should be billed, to avoid a recurring charge the next time the batch runs.