Integrating PayTrace and Salesforce using Chargent

Connect PayTrace and Salesforce with Chargent

See all PayTrace 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!


PayTrace Inc. is motivated by the challenge of delighting merchants. They empower sales partners by offering high value SaaS technology solutions to businesses. Processing over $22B annually, PayTrace is committed to delighting merchants with 5-star service while providing comprehensive, easy to use payment solutions that lower processing costs and increase security.

Using the step-by-step instructions in this guide, it’s easy to connect Salesforce to the PayTrace gateway with Chargent Payment Processing Chargent has many features to offer, including automating and streamlining Salesforce payment processes, easy subscription management, click-to-charge buttons, payment request emails, and more.

Integrating PayTrace with Chargent gives you the ability to easily build a seamless process for completing payment for orders that you manage in Salesforce. The integration connects the PayTrace gateway directly to Salesforce.

Obtain a PayTrace Sandbox Account

The first step is to get a test account from PayTrace so that you can run test transactions from Salesforce.

To request a sandbox account, complete the form on the Sandbox Account Request page.

PayTrace Request Sandbox
Upon approval, you’ll receive an email that contains these testing credentials:

  • Username
  • Temporary Password to confirm the account

If you need any help, contact PayTrace through their Support page, email at [email protected], or by phone at 888-806-6545.

Once you have confirmed your PayTrace account you need to make yourself an API User. The sandbox account currently defaults to Web User so you can only do web transactions.

  1. Login to PayTrace
  2. Select Users
  3. Make sure you select yourself as the User
  4. Change to API User instead of Web UserNoteChanging this will no longer allow you to access the Sandbox account via your web browser. It will however allow you to use the API integration with Chargent through Salesforce. Contact PayTrace if you need this switched back for some reason although switching it back will break the integration.

Production account: You’ll also need to register for a production account. Use the contact information in the enrollment email messages to work with PayTrace Support and obtain the same set of credentials for your production account.

Configuring Salesforce for PayTrace Integration

NOTE: You must get each of these gateway credentials from PayTrace before moving on to the steps in the next section, Configuring Salesforce For Integration.

  • The steps in this section are written with the assumption that Chargent has not already been installed into your Salesforce account.
  • Before moving on to the procedure below, you must successfully complete all of the steps given in the previous section, Obtain a PayTrace Sandbox Account.

Follow the steps below to configure Salesforce to integrate with PayTrace:

  1. Contact AppFrontier Support to assist with the installation of Chargent in your Salesforce Org.NOTE: Both the Sandbox and Production installations of Chargent include a free, 30-day trial license.
  2. Complete the basic Chargent setup, such as assigning user licenses and updating page layouts. For more information, please consult our Installation and Setup Guide.

If you’ve just updated the Chargent package from a previous version you will need to activate the Remote Site for PayTrace:

  1. Go to Salesforce Settings
  2. Search for Remote Sites
  3. Click Edit next to PayTrace
  4. Check the Activate box
  5. Save the Remote Site

Setting up PayTrace using the Gateway Setup Wizard

  1. Click the AppLauncher icon on the top left of Salesforce and
  2. Select Chargent from the list of Apps (your Apps may appear in different order than the screenshot)
    PayTrace App Launcher
    PayTrace Chargent
  3. Select Chargent Settings and Chargent Setup Wizard
    PayTrace Chargent Setting

This will walk you through the Gateway Setup Wizard

  1. Do you have a Payment Gateway account? – Select Yes
  2. Select PayTrace from the dropdown menu and press Continue
  3. Enter your PayTrace Credentials
    1. Choose Test if you are setting up your gateway to test transactions in your Sandbox
    2. Choose Live if you are setting up your gateway to do live transactions in your Production Org.Note: For security purposes, Chargent typically requires use of the Endpoint Override field in order to send live transactions from a Salesforce Sandbox. (This is typically recommended as a final step prior to deploying to production).  However, PayTrace has the same server endpoint for both test and live transactions: It is therefore recommended to use caution when submitting test transactions to ensure that they are not accidentally sent as live transactions.

    Note:You can only setup one gateway at a time.

  4. Use Tokenization? Yes (recommended for PCI compliance and recurring payments)
  5. Select what payment methods you accept
  6. Setup Payment Console (Payment Console is a Platform Edition Premium Feature)

PayTrace Congratulations

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. Cybersource 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 PayTrace test credit cards below. If you are testing ACH you can use the PayTrace Bank Account test numbers.
  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 Cybersource 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

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

PayTrace Credit Card Numbers

As shown on the PayTrace Testing Information page, these are valid test credit card numbers. Test credit card numbers should be used for sending transactions to your PayTrace test account.

Card Type Card Number CSC
Visa 4012000098765439 999
MasterCard 5499740000000057 998
Discover 6011000993026909 996
American Express 371449635392376 9997

Below are the valid Account Number and Routing Number for PayTrace. This will help you test ACH (Electronic Check – Direct Debit) Transactions.

Account Number Routing Number
123456 325070760

For PayTrace, submission of $0.50, $1.00 or a higher amount (except $1.12, $1.13) should give an approval response. Amounts such as $0.20, $0.21, $0.29 will cause the return of a DECLINE message. The full list of testing amounts can be found on PayTrace Testing Information page in the Testing Amount section.

Expiration dates in the future are returned as valid; expiration dates in the past are returned as invalid.

Sending Live Transactions from a Salesforce Sandbox

All PayTrace transactions are sent to the same endpoint ( You want to use caution when testing to make sure you are using your test credential gateway setup, because real transactions will process the same as the test credit card numbers provided by PayTrace.

Understanding Transactions

When a transaction occurs between Chargent and the PayTrace gateway, a new transaction record is created in Salesforce. The listing of transactions can be found in the Transaction section near the bottom of the Chargent Order page. See the figure above.

On the order page, go to the Related tab and click a Transaction ID link to see the details, as shown below. This transaction record contains the entire set of data that PayTrace sends in its response, including transaction Type (Charge, Authorize, Refund or Void), the Response Status (Approved, Declined, Error), and any related approval or error messages.

PayTrace Transaction

PayTrace Transaction

PayTrace Transaction

PayTrace Transaction

You can compare the transaction records in Salesforce with the records in your PayTrace administrative app. As shown in the figure below, click the Dashboard menu category, then click View Transactions. Then click the link for a specific transaction to view details.

PayTrace Dashboard

From the Transaction Record in Salesforce copy the Gateway ID. You can paste the Gateway ID in the search field in PayTrace to locate the transaction.

PayTrace View Transaction

PayTrace View Transaction

PayTrace View Transaction

PayTrace View Transaction

PayTrace View Transaction Details

Correspondence in the Transaction Fields

The Gateway Date is the timestamp for the submission to PayTrace, and the Gateway ID field corresponds to the PayTrace Transaction ID for use in reconciliation between two systems.

This table contains the mapping information between PayTrace and Salesforce fields.

Salesforce field Direction Gateway field
Gateway ID < Transaction ID
Invoice Number > Invoice ID
Order Information > Description
PO Number > Customer Reference ID

Going Live

This section contains the procedure for configuring the integration in a production system.

NOTE: Do not proceed here until the testing procedure described in Testing the Integration is successful.

  1. First, obtain the production credentials for the PayTrace production gateway account (similar to the method given for sandbox credentials in Obtain a PayTrace Sandbox Account.
  2. Get these production credentials from your enrollment email message:
    • Username
    • Password
  3. Repeat the steps in the Configuring Salesforce for PayTrace Integration section above, but substitute the production credentials.
  4. Repeat the steps in the Testing the PayTrace Integration section above with respect to the SalesForce production environment, using the production credentials.
  5. Void the transactions: If you’re using an actual credit card and want to prevent the charge from settling, remember to void the transaction after testing.
  6. Be sure to successfully transmit at least one real credit card transaction using company or personal accounts. We recommend that you submit a transaction with a very small amount and then void that transaction afterwards. This ensures that the system works with your production credentials.

Transaction Sync

Chargent has always sent charges and authorizations to the payment gateways, and recorded the result in a real-time Transaction in Salesforce. Chargent can also 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.

Possible values of the Transaction Status are either final or non-final. It 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()

The following are the various transaction status values for PayTrace 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.

  • N
  • GB or Settled (and batch number appended)
  • Batch number itself