AppFrontier Salesforce Integration Chargent

Integrating and Salesforce using Chargent

Authorize Logo

Easily connect and Salesforce with Chargent,

the leading payments app on the Salesforce AppExchange. See all transactions, manage refunds, send payment links and more, all inside Salesforce.

Not yet a Chargent customer?
Contact us for a no-obligation 30 day trial, and see for yourself!

If you do not already have an account for testing, you can sign up for an sandbox account in just seconds. If you are looking to process live payments you should sign up for a live account and connect it to your merchant account.

This guide shows you how you can easily connect the payment gateway to Salesforce using Chargent. Chargent allows you to charge credit cards directly from Salesforce by clicking buttons or through a recurring billing batch.

Note: This is primarily a synchronous integration, meaning that transactions sent to from Salesforce will receive the responses (approved / declined with related information) and store them in Salesforce, but transactions that are not initiated from Salesforce will not be synced from to Salesforce.

Installation and Configuration of Chargent

  1. Install both Chargent Base and Chargent Transactions into your Salesforce org.

  2. Configure Chargent according to the step by step Quick Start Guide.

For Chargent versions prior to 5.57 you may need to activate the Remote Site Settings in Salesforce if they aren’t already active for

  1. Click the gear icon on the top right and select Settings
  2. Under Security select Remote Site Settings
  3. Locate AuthNetAPI2 and click edit
  4. Check the Active box
  5. Click Save
  6. Do the same for:

    • AuthNetCIMAPI
    • AuthNetTestAPI
    • AuthNetTestCIMAPI

Connecting & Salesforce using the Chargent Setup Wizard

  1. Click on the App Launcher on the top left side in Salesforce.

  2. App Launcher

  3. Select Chargent as the App

  4. Select the Chargent Settings Tab

  5. Choose Chargent Setup Wizard

  6. Follow the prompts to configure your gateway

  7. Chargent Settings

You will need the following information to configure the gateway:

  1. API Login ID from

  2. Transaction Keyfrom

    • In go under Settings > Accounts

    • Select the option that says API Credentials & Keys

    Your Transaction Key would have been presented when you first signed up for an account. If you need to create a new one you can do it from this page.

    Authorize Account

  3. Select Test Transactions for Sandbox or Live Transactions for Production. Add your credentials based on your Sandbox or Live account.

  4. Will you be using Tokenization/CIM (Customer Information Management)? (recommended)

  5. Other information it is handy to know includes what currency will you be using and what Payment Methods will you be accepting transactions use different server endpoint so test transactions should be sent using the "Sandbox" credentials and live transactions should be sent using the Live" credentials. We recommend creating two different Gateway records in Chargent. One for testing and another for live production.

You can easily deactivate the test gateway record in Salesforce when you are ready to process live credit card transactions, but you may wish to use it again for future testing at some point.

Direct Debit Network

Starting with Chargent version 6.15, you can now select the Bank Account network for your region during the gateway setup process. uses the ACH Network. This will allow for the correct Direct Debit Network fields to be displayed on Payment Requests and Payment Console based on your region.

You should choose ACH - US as the network. ACH is also known as echeck or electronic check.

Select the Payment Methods You Accept

Once you have your Direct Debit Network set, you will see the appropriate field names on your Payment Request that are sent as well as your internal Payment Console.

Payment Request Bank Account

Setting up (Chargent versions prior to v5.40)

  1. Click on the AppLauncher on the top left side in Salesforce.

  2. App Launcher

  3. In the Search for apps or items box, Search for Gateways and select

  4. Authorize Gateways

  5. Click New and select as the Gateway Type

  6. Name the Gateway (either Test or Live).

  7. Merchant ID = API Login ID

    • In go under Settings > Accounts

    • Select the option that says API Credentials & Keys

  8. Merchant Security Key = Transaction Key

  9. Your Transaction Key would have been presented when you first signed up for an account. If you need to create a new one you can do it from this page.

    Authorize Account

  10. Setup the following Gateway fields

    • Check the Active box - To make the Gateway active

    • Use Tokenization - If you are planning on using’s CIM (Customer Information Management).

    • Available Card Types - Select the cards you will be accepting (this is based on your gateway settings and what card types they can process - Visa, MasterCard, American Express, etc..)

    • Available Payment Methods - Will you be accepting just Credit Cards or ACH (also known as electronic check, e-check, or direct debit)

    • Available Currencies - What currencies will you accept (this is based on your payment gateway and the currencies they accept payment in.

    • Credit Card / Bank Account Data Handling - This lets Chargent know when to clear the information in Salesforce. You have 4 options.

      • Never Clear
      • Clear After Successful Charge
      • Clear After All Transactions
      • Clear When Token is Present

      When using Payment Requests or Payment Console the following should also be set. Please note these features come with Sites and Platform edition & require activation in your Production Org.

    • Available PR Transaction Types

      • Charge Full Amount - Charges the credit card immediately
      • Authorize Full Amount - This option won’t charge the card but only holds the funds available until you charge the card.
      • Authorize Minimum Amount - This option won’t charge the card but only holds the minimum amount that your gateway will allow. You will need to charge the correct amount in order to capture the transaction.

    • Show Charge Button

    • Show Authorize Button

    • Authorize Edit

      Authorize Advance

Initial Testing

If you are testing using Tokenization / CIM you want to make sure the token field is clear when testing new Credit Cards or ACH transactions. If there is a token present Chargent sends the token instead of the updated Credit Card or ACH information.

Credit Card Testing

  • Create a new Chargent Order record and enter sample data to run a test transaction.

    • Name
    • Subtotal / Charge Amount
    • Billing Address
    •'s suggested test credit card numbers, which are also emailed to you and are as follows:

      • American Express Test Card: 370000000000002
      • Discover Test Card: 6011000000000012
      • Visa Test Card: 4007000000027
      • Visa Test Card: 4012888818888
      • MasterCard Test Card: 5424000000000015
      • Visa Test Card: 4222222222222222 (response code will = dollar amount charged)
      • Visa Test Card: 4111111111111111
      • Any expiration date in the future in the format MM / YYYY

    • Gateway: If you have more than one Active gateway record in Chargent, you will need to specify which gateway to use in each Chargent Order record. Otherwise, you can leave the gateway lookup field blank (and may wish to hide it from the page layout in the future since users should not need to access it).

  • Click the "Charge" button in your newly created Salesforce order record.

  • Enter the CSC (Card Security Code). This will be 3 digits for Visa, MasterCard, Discover or 4 digits for American Express.

  • Authorize Charge

  • You will see a popup with an Approved message.

  • Charge Back

When you click Back to Record button on the popup dialog box, the Salesforce page will refresh and you can then click on Related to see the Transactions with the date, type, and amount of the transaction.

Authorize Ord

ACH / Electronic Check Testing

To test eCheck.Net® transactions requires using a valid routing number and any random number for the checking account.

Routing Numbers can be found at the Federal Reserve website.

Authorize Electronic

Please Note: For testing purposes, eCheck.Net transactions under $100 will be accepted. To generate a decline, submit a transactions over $100. A monthly limit of $5000 is also configured in the sandbox. If you exceed this amount, your eCheck transactions will receive a response code 2.

  • Create a new Chargent Order record and enter sample data to run a test transaction.

    • Name
    • Subtotal / Charge Amount
    • Billing Address
    • Bank Account Type indicate checking or savings
    • Bank Routing Number from the Federal Reserve website.
    • Bank Account Number = Any random string of numbers
    • Bank Account Name = Name of the person who holds the bank account
    • Bank Name = Name of the institution (Wells Fargo, Bank of America, Citibank, etc…)
    • Gateway If you have more than one Active gateway record in Chargent (which you probably will not at this point), you will need to specify which gateway one to use.

  • Click the Charge button and you will see a popup with an Approved message.

  • Authorize Record

When you click Back to Record button on the popup dialog box, the Salesforce page will refresh and you can then click on Related to see the Transactions with the date, type, and amount of the transaction.

Chargent Ord

Sign into the test Merchant interface to check the test transaction under Search : Unsettled Transactions.

Authorize Search

You also likely received a sample confirmation email, similar to what you will receive when you run live transactions. Once you go into production with Chargent, if you fill out the Billing Email field in Salesforce that Chargent provides, your customers will also receive an email receipt at that address.

Authorize Merchant

Your connection between Salesforce and is now set up and working. Let's proceed to the final tests before the system goes live.

Sending Live Transactions from a Salesforce Sandbox

When Chargent is installed in a Salesforce Sandbox, transactions are always sent to the payment gateway's test / sandbox / development environment, regardless of whether Chargent's Test Endpoint checkbox is checked. This is done as a security precaution, to prevent real transactions from being accidentally sent from a Salesforce Sandbox.

When Chargent is installed in a production or developer Salesforce org, the Test Endpoint checkbox on the Gateway record will select between sending to the payment gateway's live and test environments.

If you wish to send live transactions from a Salesforce Sandbox, as a final step in testing, simply use Chargent's Endpoint Override field. You will need to set up a new Gateway in your Sandbox using your live credentials. When you use the Chargent Setup Wizard, just enter the correct URL in the Endpoint Override field.

There are two production endpoints, one if you are using Tokenization and the other if you are not. You want to make sure the tokenization box is checked or unchecked accordingly. Chargent always recommends using Tokenization to reduce the scope of your PCI Compliance.

Tokenization Enabled:

Tokenization Disabled:

Note that the full endpoint URL must be entered in the Endpoint Override field, and the domain must be present in the Remote Site Settings (for standard Chargent integrations it should be already present).

Going into Production

There are many more options for customizing how Chargent works within Salesforce beyond the basic connection described above. Once you have configured Chargent to your satisfaction, and have fully set up and tested any automation or integration with other business processes that you wish, it is time to move into production.

Optional: Keep the Sandbox Gateway for future testing

Chargent allows you to have multiple gateway records, so you may wish to keep the initial gateway we set up earlier for future testing.

  1. Click Edit on your Sandbox / Developer account gateway
  2. Uncheck the Active checkbox, so no transactions are accidentally sent to this test gateway
  3. Click Save

Add a new Gateway record for based on the previous instructions but select Live instead of Test.

Version 5.40 and newer
Versions prior to 5.40

Testing with Live Credentials

During this next phase, we will be using your real credentials (rather than the developer sandbox we used in the first part), but setting to Test mode, so the transactions we send will only be test transactions.

  • Note: If other integrations or departments in your company are already using the account, you should NOT put the account in test mode. If the account is already in use, you may need to skip this step proceed to step 12.

  • IMPORTANT: Go to Account : Settings and look for the Test Mode link in the Security Settings area.

    • Click the slider to Test

    • Again, do not put your Live account into test mode if there are other users connecting to it (for example, a website ecommerce integration or accounting person using the virtual terminal).

    • Account Test

  • Run some test transactions using your live credentials in test mode.

  • Please Note: When processing test transactions in Test Mode, will return a transaction ID of "0." This means you cannot test follow-on transactions, for example, credits, voids, etc., while in Test Mode, because the original transactions will not have the required Transaction IDs (stored in the Gateway ID field in Chargent). To test follow-on transactions, you can process a test transaction with any valid credit card number in live mode.

    Test mode is only available in live accounts. In sandbox accounts, all transactions are in test mode, whether this is enabled or not.

If your testing in the live environment is successful, you are ready for the third and final phase, running Live transactions.

  • Ensure Test mode is turned off and you have toggled the switch back to Live in the Merchant Interface

  • You can now run live transactions using valid credit card numbers

If you wish to test some live transactions, you can void them immediately after, to prevent the transactions from settling. Just go to the transaction record in Salesforce and click the Void button.

Transaction Void

If you do run live transactions as a test, it is recommended to make them very low amounts to minimize any impact, in the event you forget to void them.

Note: Live transactions will incur the per transaction fee (around 30 cents depending on your pricing), so you may wish to limit the number of live transactions run as tests

For Visa live transaction tests, you can submit $0.00 transactions

  • To test the AVS or CSC responses in the live environment, you will need to submit live transactions with correct street address, ZIP Code and Card Code information to generate successful responses, and incorrect street address, ZIP Code and Card Code information to generate other responses. You can void successful transactions immediately to prevent live test transactions from being processed.

Congratulations! You have now successfully integrated Salesforce and, via the Chargent Payment Processing for Salesforce app. You can now process one-time or recurring credit card payments through directly from Salesforce.If you have any questions or need assistance, please contact us.

Using Tokenization / CIM

Chargent supports’s Customer Information Management (CIM) feature for tokenization. Tokenization helps you decrease PCI compliance scope and improve security, by storing transaction data such as credit card numbers and bank account numbers on’s servers. It then associates that information with a token that Chargent stores in Salesforce for use in future transactions. This way you don’t need to store any credit card or bank account information in Salesforce.

The token returned by is stored in the Token field on the Chargent Order record in Salesforce.

To enable tokenization in your gateway in Salesforce after you’ve setup, if you did not do so through the Gateway wizard:

  1. Click the App Launcher on the top left

  2. App Launcher

  3. Search for Gateways in the Search field

  4. Authorize gateway

  5. From the dropdown arrow on the right of the gateway, select Edit. You can also click on the gateway name to access the page and click Edit from there.

  6. Authorize Viewed

  7. Check the box that says Use Tokenization

  8. Set the Credit Card / Bank Account Data Handling field to “Clear when token is present”. Click on the dropdown arrow to select.

  9. Authorize Token

Note that Chargent’s Payment Request and Payment Console features send the data to to obtain the token, without ever saving card holder data to Salesforce, so the Credit Card / Bank Account Data Handling field is only used when you are working directly out of Chargent Order records.

When using Tokenization with you will see 2 transactions. First, Chargent sends an Authorization for $0.00 to obtain the token. Once the token is stored in Salesforce, the token is then sent instead of the credit card to charge the credit card. This is due to the way’s API works. Duplicate Window Setting duplicate window setting allows you to set a time frame, in seconds, for the gateway to search for duplicate transactions.

To set the parameter, open the gateway object and locate the “Duplicate Transaction Window” field: This field may need to be added to your Gateway Page Layout.

Duplicate Window

The field holds time frame value in seconds. Possible value types:

  • Empty. If the field is not set - then the parameter isn’t sent, will use default setting (120 seconds);
  • 0. Zero sends value is used to disable the duplicate check.
  • 1 - 28800 - time frame in seconds. 28800 seconds (8 hours) is the maximum time frame value. If greater value is set, will fall back to 28800. 1800 is 30 minutes.

Transaction Sync

Chargent has always sent charges and authorizations to the payment gateways, and recorded the result in a real-time Transaction in Salesforce. New in version 5.45, Chargent can now update Salesforce records long after the initial transaction—for ACH transactions that are returned for non-sufficient funds (NSF), credit card authorizations that expire, and more.

Two fields, Transaction Status and Settlement Date can now be updated through a daily scheduled batch in Salesforce. You should add these fields to your Transaction’s Page Layout.

Possible values of the Transaction Status are either final or non-final. If the status is final, then no more updates will occur for that transaction. Also, batches will not pick up any transaction having a final status.

The Settlement Date field stores the date and time when the Transaction Status is changed to final (such as "Settled" or "Voided"), after which it will no longer receive any updates.

To schedule the batch, navigate to Setup > Develop > Apex classes, and then click the Schedule Apex button. These are the batch names:

  • ChargentOrders.scheduledBatchUpdateTransactionStatus()
  • ChargentCases.scheduledBatchUpdateTransactionStatus()
  • ChargentSFA.scheduledBatchUpdateTransactionStatus()

As shown in the documentation, the following are the various transaction status values for Transactions. Use some of the values to learn when a transaction has been declined, and take appropriate action within Salesforce—such as sending an email or assigning a followup task.

  • couldnotvoid
  • communicationerror
  • declined
  • expired
  • failedreview
  • generalerror
  • refundsettledsuccessfully
  • settledsuccessfully
  • settlementerror
  • Voided also retrieves transaction settlement time from gateway response. It is stored in the ‘Settlement Time’ field.

Gateway Mapping

Chargent Salesforce Field Field
Invoice Number > Invoice Number
Order Information > Description
Billing First Name / Billing Last Name > Name
Billing Company > Company
Billing Address / Billing Address 2 > Address
Billing State / Province > State / Province
Billing Zip Code / Postal Code > Zip Code
Billing Country > Country
Billing Phone Number > Phone
Billing Fax Number > Fax
Billing Email Address > Email
Tax > Tax
Shipping > Freight
Gateway ID < Transaction ID
Token < Customer Profile ID-Payment Profile

The token field is made up of both the Customer Profile ID and the Payment Profile.

Token = 1514425405-1512881945