Integrating Authorize.net and Salesforce using Chargent
Easily connect Authorize.net and Salesforce with Chargent,the leading payments app on the Salesforce AppExchange. See all Authorize.net transactions, manage refunds, send payment links and more, all inside Salesforce.
Contact us for a no-obligation 30 day trial, and see for yourself!
- Installation and Configuration of Chargent
- Connecting Authorize.net & Salesforce using the Chargent Setup Wizard
- Testing using Chargent Anywhere
- Testing with Payment Console
- Testing using Payment Request
- Authorize.net Test Credit Cards
- Authorize.net Test ACH
- Sending Live Transactions from a Salesforce Sandbox
- Going into Production
- Testing with Live Credentials
- Using Tokenization / Authorize.net CIM
- Authorize.net Duplicate Window Setting
- Transaction Sync
- Gateway Mapping
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.
Installation and Configuration of Chargent
- Install both Chargent Base and Chargent Transactions into your Salesforce org.
- 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.
- Click the gear icon on the top right and select Settings
- Under Security select Remote Site Settings
- Locate AuthNetAPI2 and click edit
- Check the Active box
- Click Save
- Do the same for:
Connecting Authorize.net & Salesforce using the Chargent Setup Wizard
- Click on the App Launcher on the top left side in Salesforce.
- Select Chargent as the App
- Select the Chargent Settings Tab
- Choose Chargent Setup Wizard
- Follow the prompts to configure your gateway
You will need the following information to configure the gateway:
- API Login ID from Authorize.net
- Transaction Keyfrom 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.
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.
- Click the [PaymentConsole] button
- If you are using multiple gateways select your gateway from the dropdown otherwise continue to step 3
- Enter all the Billing Information and click [Next]
- 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.
- 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.
- Click the [Send Payment Request] button
- If you have multiple Payment Request templates set up you will first choose what template you want to use.
- Enter an email address where you want to send the test Payment Request along with any amount.
- Enter a Contact name (Optional)
- Click the [Send Request] button
You should receive a green box confirmation
Authorize.net Test Credit Cards
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.
|Card Type||Card Number|
Authorize.net Test ACH
|Bank Account Number||Any Random 9 digit number|
|Routing Number||Any Routing from the Federal Reserve|
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.
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.
- Click Edit on your Authorize.net Sandbox / Developer account gateway
- Uncheck the Active checkbox, so no transactions are accidentally sent to this test gateway
- 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.
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.
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:
- Click the App Launcher on the top left
- Search for Gateways in the Search field
- 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.
- Check the box that says Use Tokenization
- 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.
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:
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 followup task.
Authorize.net also retrieves transaction settlement time from gateway response. It is stored in the ‘Settlement Time’ field.
|Chargent Salesforce Field||Authorize.net Field|
|Invoice Number||>||Invoice Number|
|Billing First Name / Billing Last Name||>||Name|
|Billing Address / Billing Address 2||>||Address|
|Billing State / Province||>||State / Province|
|Billing Zip Code / Postal Code||>||Zip Code|
|Billing Phone Number||>||Phone|
|Billing Fax Number||>||Fax|
|Billing Email Address||>|
|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.
Token = 1514425405-1512881945