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!

Learn More


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 Quick Start 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
    PayTrace App Launcher
  2. Select Chargent from the list of Apps (your Apps may appear in different order than the screenshot)
    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

To manually setup your gateway

Use the table below for guidance when entering the test credentials that can be found in the email from PayTrace Support:

Gateway Page Field Value
Gateway Name Enter an easily recognizable name for this gateway, such as “PayTrace”.
Merchant ID Your gateway account Username
Merchant Security Key Your gateway account Password
Active Check this box

Your Gateway page should look similar to the figure below. Click the Save button to commit your changes.

PayTrace Edit Test
PayTrace Edit Test

Testing the PayTrace Integration

This section contains the procedure for testing the integration that you set up according to the procedure given in Setting Up Salesforce For Integration, using your PayTrace sandbox credentials.

Follow the steps below to verify that the integration is correct.

  1. In the upper-left corner of the Salesforce page, click the AppLauncher icon to open the all of the Salesforce Apps.
  2. Locate the Chargent App and select it.
    PayTrace App Launcher
  3. Select Chargent Orders from the tabs
  4. Click the New button (see the figure below).
    PayTrace Chargent New
    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.

    In the Chargent Order Edit page, enter or select information to correctly complete the essential parts of the form, including:


    • Billing First Name
    • Billing Last Name
    • Billing Address (City, State, Zipcode)
    • Billing Email Address (to get a receipt)
    • Charge Amount (check Manual Charge if this amount is not calculated from Subtotal + Tax + Shipping)
    • Payment Method
    • Card Type
    • Card Number
    • Card Expiration Month
    • Card Expiration Year (use a future year)
    • Card Last 4

    See the figure below for the placement of these fields.

    PayTrace Order Summary
    PayTrace Order Summary
    PayTrace Order Summary
    PayTrace Order Summary
  5. Click the Save button to commit the changes on the form. On the next page, click the Charge button (as shown below).
    PayTrace Charge
  6. When the transaction is complete, you see a small pop-up as shown in this figure. Click the OK button to close the pop-up window, then scroll to the bottom of the Order page.
    PayTrace Charge
  7. A record is created for each error and each successful transaction, and this record contains the response messages and details that are sent back from PayTrace. See the figure below for an example.
    PayTrace Related

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