Integrating Authorize.net and Salesforce using Chargent

Authorize.Net

This guide shows you how you can easily connect the Authorize.net 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 Authorize.net from Salesforce will receive the Authorize.net responses (approved / declined with related information) and store them in Salesforce, but transactions that are not initiated from Salesforce will not be synced from Authorize.net to Salesforce.

Connect Authorize.net and Salesforce with Chargent

See all Authorize.net 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
If you do not already have an Authorize.net account for testing, sign up for a sandbox account here. If you are looking to process live payments, register for a live Authorize.net account and connect it to your merchant account.

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 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 Authorize.net.

  1. Click the gear icon on the top right and select Settings
  2. Under Security select Remote Site Settings
  3. Locate AuthNetAPI2 and click edit
  4. Check the Active box
  5. Click Save
  6. Do the same for:
    AuthNetCIMAPI
    AuthNetTestAPI
    AuthNetTestCIMAPI

Connecting Authorize.net & 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 Authorize.net
  • Transaction Key from Authorize.net
    • In Authorize.net 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 Authroize.net 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 Authorize.net account.
  2. Will you be using Tokenization/CIM (Customer Information Management)? (recommended)
  3. Other information it is handy to know includes what currency will you be using and what Payment Methods will you be accepting

Authorize.net transactions use different server endpoint 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. Authorize.net 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.

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.

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 Authorize.net test credit cards below. If you are testing ACH you can use the Authorize.net 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 Authorize.net 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

Authorize.net Test Credit Cards

To generate a decline for Authorize.net, 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

Authorize.net 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 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.

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 Authorize.net 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: https://api2.authorize.net/xml/v1/request.api

Tokenization Disabled: https://secure2.authorize.net/gateway/transact.dll

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.

Optional: Keep the Sandbox Gateway for future testing

Chargent allows you to have multiple gateway records, so you may wish to keep the initial gateway we set up earlier for future testing.

  1. Click Edit on your Authorize.net Sandbox / Developer account gateway
  2. Uncheck the Active checkbox, so no transactions are accidentally sent to this test gateway
  3. Click Save

Add a new Gateway record for Authorize.net 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 Authorize.net credentials (rather than the developer sandbox we used in the first part), but setting Authorize.net 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 Authorize.net account, you should NOT put the account in test mode. If the Authorize.net 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 Authorize.net 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.
Please Note: When processing test transactions in Test Mode, Authorize.net will return a transaction ID of “0.” This means you cannot test follow-on transactions, for example, credits, voids, etc., while in Test Mode, because the original transactions will not have the required Transaction IDs (stored in the Gateway ID field in Chargent). To test follow-on transactions, you can process a test transaction with any valid credit card number in live mode.

Test mode is only available in live Authorize.net accounts. In sandbox accounts, all transactions are in test mode, whether this is enabled or not.

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 Authorize.net 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 Authorize.net 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 Authorize.net, via the Chargent Payment Processing for Salesforce app. You can now process one-time or recurring credit card payments through Authorize.net directly from Salesforce.If you have any questions or need assistance, please contact us.

Using Tokenization / Authorize.net CIM

Chargent supports Authorize.net’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 Authorize.net’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 Authorize.net 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 Authorize.net 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 Authorize.net 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 Authorize.net’s API works.

Authorize.net Duplicate Window Setting

Authorize.net 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 Authorize.net 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, Authorize.net 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, Authorize.net 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 Authorize.net documentation, the following are the various transaction status values for Authorize.net 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

Authorize.net also retrieves transaction settlement time from gateway response. It is stored in the ‘Settlement Time’ field.

Gateway Mapping

Chargent Salesforce Field Authorize.net 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