Integrating and Salesforce using Chargent


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.

Connect and Salesforce with Chargent

See all transactions, manage refunds, send payment links and more, all inside Salesforce with Chargent, the top rated payments app on the Salesforce AppExchange.

Not yet a Chargent customer?

Contact us for a no-obligation 30 day trial, and see for yourself!

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 Installation and Setup Guide.

Connecting & Salesforce using the Chargent Setup Wizard

  1. Click on the App Launcher on the top left side in Salesforce.
  2. Select Chargent as the App
  3. Select the Chargent Settings Tab
  4. Choose Chargent Setup Wizard
  5. Follow the prompts to configure your gateway

You will need the following information to configure the gateway:

  • API Login ID from
  • Transaction Key from
    • 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.

  1. Select Test Transactions for Sandbox or Live Transactions for Production. Add your credentials based on your Sandbox or Live account.
  2. Will you be using Tokenization/CIM (Customer Information Management)? (recommended)
  3. Other information you will need to know includes:
    • What currency will you be using?
    • What payment methods will you be accepting? transactions use different server endpoints, 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 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.

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

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

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.

You should receive a green box confirmation

Card Bank payment Test Credit Cards

To generate a decline for, enter an amount of $70.02 when sending to a test gateway.  This will generate a decline response.

Card Type Card Number Expiration / CVV
Visa 4007000000027222 Any / Any
Visa 4012888818888444 Any / Any
Visa 4222222222222222 Any / Any
Visa 4111111111111111 Any / Any
MasterCard 5424000000000015 Any / Any
American Express 370000000000002 Any / Any
Discover Card 6011000000000012 Any / Any Test ACH

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.

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

ACH Validation

The ACH Validation feature works with Lyon’s ACH Validation service to validate the bank account, and store the validation in your Salesforce Org. During your Gateway Setup you will authenticate your Lyon’s credentials and Chargent uses a referral relationship for all first-time transactions.

If you are not using Lyon’s ACH Verification you want to disable this.

If you are using Lyon’s ACH Validation you will enter the following credentials.

  • Company ID
  • Username
  • Password

Note: If you are testing in a Salesforce Sandbox or Developer account, you want to be sure to check the ‘Test Transactions Only’ box.

  1. Enabled: this setting will enable or disable the ACH Validation.
  2. Company Id: The company Id in Lyons validation.
  3. Username: Username to log in Lyons validation.
  4. Password: Password to log in Lyons validation.
  5. Test Transactions Only: If this setting is checked, you will send all validations, through a test gateway.

In case you decide to turn off ACH Validation, you will see this warning message.

On the other hand, when you edit the gateway, in “Advanced Settings” you will see this new checkbox, Allow “No-Hit” Transactions.

A “no hit” ACH Validation Response is neither positive or negative. It indicates that ACH validation couldn’t be completed as this account is not listed in the reference database at this time.

On failure validation you will receive this message

New Behavior

NACHA validation, when enabled and correctly configured, applies to all Orders with Bank Account payment method and ACH as Bank Account type in the related gateway.

The only exception to the above mentioned rule is for orders with already-approved transactions, with the same Account Number last 4; these Bank Accounts are treated valid without using the Lyons service.

In case that there was an error from Lyons service the transaction will continue as usual but this Bank Account will try to get validated again on the next transaction.

If the transaction doesn’t count with the necessary information to get validated because of the tokenization will count as a valid transaction, without the ACH validation

Sending Live Transactions from a Salesforce Sandbox

When Chargent is installed in a Salesforce Sandbox, transactions are typically 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, checking the Test Endpoint checkbox on the Gateway record will route transactions to the test environments provided by the gateway.

Note: Some gateways use the same endpoint for live and test environments. For these gateways, the Chargent application does not prevent live transaction processing. As such, it is best practice to deactivate your live gateway records in orgs used for testing.

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.

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).
  • Run some test transactions using your live credentials in test mode.

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. Search for Gateways in the Search field
  3. 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
  4. Check the box that says Use Tokenization
  5. Set the Credit Card / Bank Account Data Handling field to “Clear when token is present”. Click on the dropdown arrow to select.

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.

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:

  • 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 follow-up 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.

Example: Token = 1514425405-1512881945