Authorize.net Accept.js Payment Module
Authorize.Net Accept.js Payments is a free plugin, available in the Plugins Library as Authorize.Net Accept.js Payments. It is a drop-in successor to the built-in Authorize.net AIM module: the customer sees the same card fields on the same payment page, but the card is processed through Authorize.Net’s current JSON API.
With Accept.js, the card number and security code are turned into a one-time token in the customer’s browser, so they are never posted to your store. The module also adds a transaction history and Refund, Capture and Void tools to the admin order page.
REQUIREMENTS
- Zen Cart 1.5.8 or later
- PHP 7.4 or later, with the curl and json extensions
- HTTPS/SSL active on your site. In Production mode, the module hides itself on any page that isn’t https.
- An Authorize.Net account. A free sandbox account is enough for testing; real payments need a live account (pricing and sign-up).
- Three credentials from your Authorize.Net account: the API Login ID, the Transaction Key and the Public Client Key
INITIAL SETUP
All three credentials are in the Authorize.Net Merchant Interface (or the sandbox’s, at https://sandbox.authorize.net/):
- Log in to your Authorize.Net account.
- Go to Account > Settings > Security Settings > General Security Settings.
- Click “API Credentials & Keys.” Record your API Login ID.
- On the same page, obtain a new Transaction Key and record it. It is shown only once, and a new key disables the old one within 24 hours.
- Go back and click “Manage Public Client Key.” Create one if none exists, and record it. The Public Client Key is public by design: it can tokenize a card but cannot run a transaction.
Sandbox and live accounts have different credentials.
INSTALLING THE PLUGIN
- Upload the
zc_plugins/AuthorizeNetAcceptfolder from the package into your store’szc_pluginsfolder. - Zen Cart 1.5.8 through 2.0.x only: also upload the
includesfolder from the package’sfor_zen_cart_1.5.8_to_2.0.xfolder. It adds two small files that hand off to the plugin; no core file is edited. Zen Cart 2.1.0 and later don’t need them. - Go to Admin > Modules > Plugin Manager, select Authorize.Net Accept.js Payments and click Install.
CONFIGURING THE MODULE
-
Go to Admin > Modules > Payment (or click Settings in the plugin’s Plugin Manager panel).
-
Select Authorize.net (Accept.js) and click Install.
-
Click Edit and enter your API Login ID, Transaction Key and Public Client Key.
-
Configure the rest of the settings as desired:
- Transaction Mode - Sandbox uses the Authorize.Net sandbox with sandbox credentials. Test uses your live account with every request flagged as a test. Production is live. Nothing is charged in Sandbox or Test. The module starts in Sandbox mode.
- Authorization Type - “Authorize+Capture” charges the card at checkout. “Authorize” only reserves the funds; you then capture them from the order page within 30 days (useful if the amount may change before you ship).
- Request CVV Number - Asks the customer for the card’s security code. Keep this on.
- Currency Supported - The currency your Authorize.Net account settles in. Orders in another store currency are converted with your store’s exchange rates before submission.
- Sort Order of Display - Position among the payment methods; lowest first.
- Payment Zone - If set, only customers whose billing address is in this zone can use the module.
- Set Completed Order Status - For approved and captured orders. Recommended: “Processing”
- Set Authorized (Uncaptured) Order Status - For authorize-only orders until you capture them. Recommended: “Pending”
- Set Refunded Order Status - Used after a refund or void from the order page. Recommended: “Pending”
- Set Held-For-Review Order Status - For orders held by Authorize.Net’s fraud filters. Approve or decline them in the Merchant Interface, then update the order yourself.
- Gateway Receipt Email - If enabled, Authorize.Net also emails its own receipt to the customer.
- Duplicate Window - The gateway rejects a matching second transaction within this many seconds. 0 turns the check off.
- Send Line Items - Sends the ordered products (up to 30) so they show in the Merchant Interface.
- Debug Mode - “Log File” writes each gateway call to the logs folder, with the Transaction Key and token masked. “Log and Email” also emails the store owner about failed calls. Sandbox mode always writes the log.
TESTING
- Set Transaction Mode to “Sandbox” and enter your sandbox account’s credentials.
- Place an order with a test card, any future expiry date and any 3-digit security code (4 digits for Amex):
- Visa 4007000000027
- Mastercard 5424000000000015
- Discover 6011000000000012
- American Express 370000000000002
- To see a decline, use a billing ZIP code of 46282. Other responses are listed in Authorize.Net’s testing guide.
- Once satisfied, switch Transaction Mode to “Production” and enter your live account’s credentials. Place a small real order, check it in the Merchant Interface, then void it from the order page before the day’s settlement.
The sandbox settles transactions overnight, so a refund needs a transaction from an earlier day; voids work the same day.
THE ORDER PAGE
At the bottom of Admin > Customers > Orders > (an order) you’ll find:
- The transaction history for that order: every gateway call, with its type, transaction ID, result, auth code, AVS and CVV results, card and amount.
- Refund - for settled transactions, within 120 days. The amount, last four digits and transaction ID are prefilled from the last approved charge.
- Capture - shown when the order has an uncaptured authorization. Leave the amount blank to capture the full authorization.
- Void - cancels an unsettled transaction or an uncaptured authorization.
Each action adds a line to the order’s status history, sets the order status as configured, and emails the customer the status update.
COMMON ERRORS
- “User authentication failed due to invalid authentication values.” (E00007) - The API Login ID or Transaction Key is wrong for the mode you’re in. Sandbox credentials only work in Sandbox mode; live ones only in Test or Production.
- “Your card details could not be secured for transmission.” - Accept.js couldn’t tokenize the card. Usually the Public Client Key is wrong or doesn’t match the API Login ID, or the browser is blocking
js.authorize.net. - “Your card details did not arrive securely.” - JavaScript is off, or something on the page stopped the script from running. Check the browser console.
- Error 54 on a refund - The transaction hasn’t settled yet. Void it instead, or refund it tomorrow.
- “(Not Configured)” next to the module name - One of the three credentials is blank.
- The module doesn’t show at checkout - Production mode on a page that isn’t https, a Payment Zone that doesn’t include the billing address, or the module is disabled.
- On Zen Cart 1.5.8 through 2.0.x, Modules > Payment doesn’t list the module - The two bridge files from Installing the Plugin aren’t uploaded, or are in the wrong folder.
MOVING FROM THE AIM MODULE
Install Accept.js alongside AIM, test it, then remove AIM under Modules > Payment. Orders paid through AIM keep their history, but AIM’s order-page tools go away when AIM is removed, so capture or refund any open AIM authorizations first (or do it later in the Merchant Interface).
COMPATIBILITY
The module works with the standard checkout, with Zen Cart’s AJAX checkout confirmation, and with the One Page Checkout plugin.
SUPPORT
Questions and problem reports go to the plugin’s support thread on the Zen Cart forum. The full guide comes with the plugin and opens from its ReadMe button in Plugin Manager.