Integrating USAePay and Salesforce using Chargent

USAePAY
Connect USAePay and Salesforce with Chargent

See all USAePay 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

Overview

USAePay has provided a secure credit card and check processing gateway for over 15 years. The gateway supports all major credit card platforms and most leading check platforms. The gateway is Level 1 PC1 compliant, enforcing the latest and strictest security requirements for the payment industry. USAePay is processor agnostic, providing an interface to 10 different credit card processing networks and 12 different check processing networks.

Integration of USAePay with Chargent Payment Processing for Salesforce allows the ability to provide a seamless process for completing payment for orders managed in Salesforce. The connection of Salesforce and USAePay allows real-time and recurring payments between the two systems. Chargent will tokenize the credit cards and stores them in Salesforce for future use by the merchant (ACH/eChecks are not tokenized through USAePay). See Setting Up Salesforce For Integration for additional information on the gateway.

Prior to setting up USAePay in Salesforce

  1. Install both the Base Package and the Chargent Orders Transaction Package into your Salesforce org.
  2. Configure Chargent according to the 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 USAePay.

    • Click the gear icon on the top right and select Settings
    • Under Security select Remote Site Settings
    • Locate USAePAY_Test and click edit
    • Check the Active box
    • Click Save
    • Do the same for USAePAY_Live

Setting Up Salesforce For Integration with USAePay

Add a USAePay Gateway record in Salesforce using Chargent’s Gateway Wizard.

  1. Click on the App Launcher on the top left side in Salesforce.
    applauncher
  2. Select Chargent as the App
  3. Select the Chargent Settings Tab
  4. Choose Chargent Setup Wizard
    chargent settings
  5. Do you have a Payment Gateway account – Select Yes
  6. Select USAePay as your Payment gateway.
  7. Select Test Transactions for testing or Live Transactions if you are looking to process real payments.
  8. Follow the prompts to configure your gateway.

You will need the following information:

  • Add your credentials based on your Sandbox (Test) or Production Live USAePay account.
    • Source Key:This is your USAePay Source Key
    • PIN This is the PIN you chose when configuring your USAePay gateway in the previous step.

Other information that will be asked:

  • Will you be using tokenization? (recommended)
  • What currency will you be using? (USD, CAN, etc.)
  • What payment methods will you be accepting?
  • Credit cards and/or ACH (electronic check)
    • What Credit Card types will you be accepting? (Visa, Mastercard, etc…)
  • Payment Console Setup (Premium feature for Platform Edition)
    • Show Charge Button
    • Show / Create Update Token Button
    • Show Authorize Button

Direct Debit Network (version 6.15 and higher)

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

You have the following Direct Debit Networks to choose from based on your region.

  • US – ACH (also known as echeck or electronic check)
  • Canada – EFT (ACSS) Electronic Funds Transfer
  • Australia – BECS
  • Europe – SEPA

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 USAePay test credit cards below. If you are testing ACH you can use the USAePay Bank Account test numbers.
  5. Click the [Charge] button.

You should receive a green box showing Approved.

trx

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 USAePay credit cards or bank account testing numbers to complete the payform and submit the payment.

You should receive a green box showing Approved.

Card Bank Payment

You should receive a green box confirmation

Card Bank payment

Testing Credit Card Data

USAePay uses different credit card numbers to simulate different response types. For full testing of all response types, please see the USAePay testing page on their website. Below will be some common credit card test cards with common response messages.

The following credit cards will return with approved transaction status regardless of amount: Note: All of the credit card numbers have the expiration date 09/19.

Note: Enabling Test Mode in the USAePay Configuration will return a response of Approved for all transactions rather than the response messages listed for the test credit card numbers below in Testing.

Credit Card Number CVV Response Message
4000100011112224 123 Approved
4000300011112220 Any Declined
4000300211112228 Any Do Not Honor
4000300611112224 Any Insufficient Funds
4000301311112225 Any Decline for CVV Failure

Testing ACH (electronic check)

Since tokenization for ACH (electronic check) isn’t supported through Chargent’s integration, you will need to setup a seperate gateway that is specific to ACH.

The following list of test check information is made available for testing check processing functionality on our Sandbox system. The account data should not be used in production.

Any other combination of 9 digit routing number and account number will return an approval.

Routing Account Amount Response Reason
987654321 Any Any Error Invalid routing Number
Any Any 5.99 Decline Returned check for this accoun
Any Any 9999.99 Manager Approval Warning: You have exceeded your allocated monthly transaction volume

All approved transactions will be moved to “submitted” at 5pm PST and on the following day at 8am PST will move to “settled”. The following account numbers will trigger returns at 8am on the 3rd day.

Routing Account Amount Response Reason
Any 10178101 Any Returned R01: Insufficient Funds
Any 10178102 Any Returned R02: Account Closed
Any 10178103 Any Returned R03: No Account/Unable to Locate Account
Any 10178104 Any Returned R04: Invalid Account Number

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 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. (There are a few exceptions, such as Stripe, which has a single endpoint to send transactions to, and different credentials for live versus test transactions).

If you wish to send live transactions from a Salesforce Sandbox, as a final step in testing, simply use Chargent’s Endpoint Override field on the Gateway record, and enter the production endpoint of your chosen gateway there.

Here is the production endpoint URL for Chargent’s integration with USAePay:

https://www.usaepay.com/gate

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 Live

This section contains the procedure for making the integration available for production systems. This procedure should not occur until the testing procedure described in Testing the Integration is successful.

Setting Up USAePay Live Integration

USAePay works through resellers and does not provide payment gateway accounts directly to merchants. If you don’t already have a USAePay account contact our sales team to obtain one. You can also sign up for a payment processing account with any other USAePay reseller.

Similar to the Sandbox setup, you will receive the credentials for signing into your Merchant Console. Once you have the email and credentials login to your USAePay account.

  1. Click Settings in Merchant’s console.
  2. Click Source Keys
  3. Click Add Source
  4. Enter Name and Pin. Click Apply.
    test chargent

Understanding Transactions

When a successful transaction is generated in USAePay from Chargent / Salesforce, a Transaction record is created in Salesforce with the results. This transaction record contains a complete set of data returned from USAePay, such as the type of transaction (Charge, Authorize, Refund or Void), the Response Message (Approved, Declined, Error) as well as various response and result codes (detailed below).

The Salesforce Transaction Gateway Date shows the date and time it was submitted to USAePay, and Chargent’s Gateway ID field in Salesforce corresponds to the Transaction ID in USAePay for use in reconciling systems.

A Transaction Record from Chargent in Salesforce:

transaction record

The Corresponding Transaction record in USAePay:

details

Tokenization

If you haven’t already set up tokenization during the initial configuration of your USAePay account in Salesforce, this section will assist you in setting it up. USAePay uses a token system in order to maximize security of credit card data.

  1. In the top left corner click on the App Launcher
  2. Search and select Gateways
  3. Click on USAePay
  4. Click Edit
  5. Check the box that Says Tokenization
  6. Under the Credit Card / Bank Account handling field choose one of the following.
    • Never Clear
    • Clear After Successful Charge
    • Clear After All Transactions
    • Clear When Token is Present (recommended)
  7. Click Save.

record type

NOTE: The token is stored in Chargent’s Token field in Salesforce after your first successful transaction, and the credit card fields are handled as specified in the procedure

If you are using Chargent’s APIPayment Console or Payment Request features, credit cards are never saved to Salesforce but are instead tokenized in memory.

Field Mapping

Salesforce field Direction USAePay Field
Gateway ID < Transaction ID
Token < Customer Code
Order Information > Comment
Invoice Number > Invoice Number
Chargent Order record ID > Order ID

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 receives 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()

As shown in the USAePay documentation, the following are the various transaction status values for USAePay 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.

  • queued
  • pending
  • submitted
  • funded
  • settled
  • error
  • voided
  • returned
  • timed out
  • manager approval req.

Common Errors

Gateway Message: “Customer Name Not Submitted”

  • Make sure you have the Name and Billing Address completed in your Chargent Order record. Incomplete information can create this error.

Specified Source Key Not Found:

  • This error means you have entered incorrect credentials for your USAePay gateway account, or are sending to the incorrect server.

Make sure that “Test Endpoint” is unchecked in the Chargent Gateway record if you are trying to send to your Production USAePay account.

If you wish to run some live tests from a Salesforce Sandbox, note that the “Test Endpoint” functionality is disabled for security purposes there.

Use the “Endpoint Override” field on the gateway record, with the reference gateway for value https://www.usaepay.com/gate This will allow you to gain access and process a transaction.

Transaction Authentication Failed

  • This indicates that either your USAePay key / pin combination entered in the Chargent Gateway record in Salesforce are incorrect, or that you may be sending to the wrong environment to match your credentials. When using the USAePay Sandbox for testing, make sure “Test Endpoint” is checked in the Gateway record, and for production usage make sure it is unchecked.

Testing Decline Transactions keep showing as Approved

  • You want to make sure you have the Test Mode unchecked in your Source Key settings in USAePay.

source info