AppFrontier

USAePay Salesforce Integration Chargent

Integrating USAePay with Salesforce using Chargent


Easily connect USAePay and Salesforce with Chargent,

the leading payments app on the Salesforce AppExchange. See all USAePay 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!



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.

logo

Configure your USAePay account

This section contains the procedures for configuring your USAePay account prior to setting up the integration in Salesforce. Each subsection under this section contains a separate procedure, however, the procedures must be completed in the order presented.

  1. If you don’t already have a USAePay Sandbox account you should register for one at https://sandbox.usaepay.com/_developer/app/register. Fill out all fields and click Register new account. Note: You will receive an Email containing your sandbox (test) credentials.

  2. When you receive your credentials you should log into your sandbox using the credentials received in step 1 at https://sandbox.usaepay.com/login.

  3. Click Settings in Merchant’s console.

  4. Click Source Keys

  5. Click Add API Key

  6. Enter Name and Pin. Click Apply

  7. Click Save


source

Note:

  • This Key and Pin will be used for Testing the Integration.
  • Test Mode needs to be disabled in order for testing to work correctly. Enabling Test Mode will return a response of Approved for all transactions rather than the response messages listed for the test credit card numbers below in Testing.


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.

  2. applauncher

  3. Select Chargent as the App

  4. Select the Chargent Settings Tab

  5. Choose Chargent Setup Wizard

  6. chargent settings

  7. Do you have a Payment Gateway account - Select Yes

  8. Select USAePay as your Payment gateway.

  9. Select Test Transactions for testing or Live Transactions if you are looking to process real payments.

  10. 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


Add a USAePay Gateway record in Salesforce (Chargent versions prior to 5.40)

  1. Click on the AppLauncher on the top left side in Salesforce.

  2. applauncher

  3. In the Search for apps or items box, Search for Gateways and select

  4. gateways

  5. Click New and select USAePay as the Gateway Type

  6. Map the following fields in Chargent with your credentials from USAePay:

    • Merchant ID: USAePay Source Keyy

    • Merchant Security Key: USAePay Source PIN

  7. Setup the following Gateway fields

    • Check the Active box - To make the Gateway active

    • Use Tokenization - If you are planning on using USAePay tokenization (recommended)

    • Available Card Types - Select the cards you will be accepting (this is based on your gateway settings and what card types they can process - Visa, Mastercard, American Express, etc..)

    • Available Payment Methods - Will you be accepting just Credit Cards or ACH

    • Available Currencies - What currencies will you accept (this is based on your payment gateway and the currencies they accept payment in.

    • Credit Card / Bank Account Data Handling - This lets Chargent know when to clear the information in Salesforce. You have 4 options.

      • Never Clear
      • Clear After Successful Charge
      • Clear After All Transactions
      • Clear When Token is Present (recommended)

      • new gateway

When using Payment Requests or Payment Console the following should also be set. Please note these features come with Sites and Platform edition & require activation in your Production Org.

  • Available PR Transaction Types

    • Charge Full Amount - Charges the credit card immediately
    • Authorize Full Amount - This option won’t charge the card but only holds the funds available until you capture them.
    • Authorize Minimum Amount - This option won’t charge the card but only holds the minimum amount that your gateway will allow. You will need to charge the correct amount in order to capture the transaction

    • card types


  • Show Charge Button
  • Show Authorize Button

  • pr

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

test

Testing the Integration

Now that you have created the USAePay gateway record in Salesforce, it is time to run some test transactions to ensure it was set up correctly, and understand how Chargent works to charge credit cards within Salesforce.

Create a Chargent Order in Salesforce to run test transactions

  1. Click on the App Launcher in the top left side and select Chargent as the App.

  2. chargent app

  3. Click the Chargent Orders Tab.

  4. Click on New

  5. Enter in the following information:

    • Account: The Account the Chargent Order should be associated with.

    • Payment Type should be either credit card or check depending on if you are testing credit cards or ACH (electronic check)

    • Billing Information
      • Billing First Name
      • Billing Last Name
      • Billing Address
      • Billing City
      • Billing State / Province
      • Billing Zip Code / Postal Code
      • Billing Email Address (if you want to test the email receipt that gets triggered upon a successful transaction)

    • Charge Amount (check the Manual Charge checkbox to enter a specific amount. If you are entering Subtotal, Tax, and Shipping then the Charge Amount will be automatically calculated and the Manual Charge box does not need to be checked).

    • Credit Card Number = See USAePay test credit card information. USAePay uses different test credit card numbers to determine the response message and whether it’s approved or declined for specific reasons. For ACH testing see USAePay’s Test ACH Account and Routing Numbers..

    • Card type (Visa, MasterCard, etc..) or Bank Account Type for ACH (Checking or Savings).

    • Card Expiration Month and Card Expiration Year should be in the future

    • order
      billing


  6. Click Save

  7. Click the Charge button. You will receive a pop-up asking for the CSC (Card Security Code). This can be any 3 digits for Visa, MasterCard or Discover or 4 digits for American Express when testing in the Sandbox.

  8. charge

  9. Press the Charge button

  10. You should receive a popup that shows the test transaction was approved.

    trx


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


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.

  5. 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.

  8. 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 API, Payment 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