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

Testing using Chargent Anywhere

Testing with Payment Console

To test using the Payment Console, you want to navigate to any record in your Sandbox that has the Chargent Anywhere Component enabled.

  1. Click the [PaymentConsole] button
  2. If you are using multiple gateways select your gateway from the dropdown otherwise continue to step 3
  3. Enter all the Billing Information and click [Next]
  4. Enter in a test credit card number, expiration date, and CVC code based on the test credit cards below. If you are testing ACH you can use the Bank Account test details below.
  5. Click the [Charge] button.

You should receive a green box showing Approved.


Testing using Payment Request

To test using a Payment Request you want to be sure you have the Chargent Payment Request feature set up as outlined in our documentation.

  1. Click the [Send Payment Request] button
  2. If you have multiple Payment Request templates set up you will first choose what template you want to use.
  3. Enter an email address where you want to send the test Payment Request along with any amount.
  4. Enter a Contact name (Optional)
  5. Click the [Send Request] button

Send Payment Request

When you receive the email, click the secure link for the Payment Request. Use one of Credit Cards or bank account testing numbers to complete the payform and submit the payment.

Card Bank Payment

You should receive a green box confirmation

Card Bank payment Test Credit Cards

Please Note: For testing purposes, eCheck.Net transactions under $100 will be accepted. To generate a decline, submit 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.

Card Type Card Number
Visa 4007000000027
Visa 4012888818888
Visa 4222222222222222
Visa 4111111111111111
MasterCard 5424000000000015
American Express 370000000000002
Discover Card 6011000000000012 Test ACH

Bank Account Number Any Random 9 digit number
Routing Number Any Routing from the Federal Reserve

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