Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
ARTICLE

Laravel eCommerce Authorize.net Payment Gateway Setup

The Authorize.Net Payment Gateway module lets your Bagisto store accept credit and debit cards on a secure hosted payment page. It adds Authorize.Net as a payment option at checkout.

Authorize.Net is a US-based gateway that merchants in the USA, UK, Canada and Australia use widely.

The module works in sandbox and production mode, so you can test payments before you go live. Also, customers enter card details on the Authorize.Net page, never on your server.

Requirements

  1. Bagisto: v2.5.0
  2. PHP: 8.4
  3. Database: MySQL, MariaDB or PostgreSQL
  4. Merchant account: an Authorize.Net account with an API Login ID, a Transaction Key and a Signature Key

Features of Authorize.Net Payment Gateway

The module has these features for secure and reliable card payments.

  • Hosted payment page: Customers pay on an Authorize.Net page, so card data never reaches your store.
  • Smaller PCI scope: Your store never handles card numbers, so the compliance work on your side shrinks.
  • Credit and debit cards: The hosted page takes the card brands that your Authorize.Net account allows.
  • Sandbox and production modes: One toggle switches the mode, and the module keeps a separate set of credentials for each.
  • Signed webhooks: The module checks every webhook with an HMAC-SHA512 signature, so it rejects unsigned or wrong payloads.
  • Confirmed payments: Before it places an order, the module asks Authorize.Net to confirm the charge for the same cart and the exact amount.
  • Automatic orders and invoices: A successful payment creates the order, sets it to processing, creates the invoice and saves the transaction.
  • Payment recovery: If a buyer pays but closes the browser, the webhook still creates the order.
  • Duplicate charge record: The module records a repeat charge on the order, so the admin can see it and refund it.
  • Account currency: The method shows at checkout only when the store currency matches the currency of your merchant account.
  • Channel settings: Each channel keeps its own settings, so a multi-channel store can use different accounts.
  • Translations: The module ships with all 22 locales of Bagisto.

Installation of Authorize.Net Payment Gateway

Follow these steps in order, because each one depends on the one before.

Step 1: Extract and merge the package

First, unzip the extension package. Then merge the packages directory into your project root.

Step 2: Update composer.json

Next, open composer.json and add the following line under ‘psr-4‘:

"Webkul\\AuthorizeNet\\": "packages/Webkul/AuthorizeNet/src"

Step 3: Register the service provider

Then open bootstrap/providers.php and add the following line under Provider:

Webkul\AuthorizeNet\Providers\AuthorizeNetServiceProvider::class,

Step 4: Install the SDK

After that, install the Authorize.Net SDK and refresh the autoloader:

composer require authorizenet/authorizenet:^2.0

composer dump-autoload

Step 5: Run the installer

Finally, run the installer. It publishes the payment method logo and clears the cache.

php artisan authorizenet:install

How the Payment Flow Works

Knowing the flow helps you fix problems on a live store. A payment has three stages.

Redirect to the hosted payment page

When the customer places the order, the module asks Authorize.Net for a one-time form token. Then it sends the customer to the hosted payment page.

Return to your store

After the payment, the customer returns to your store. Next, the module confirms the charge with Authorize.Net, creates the order and the invoice, and saves the transaction.

Reconcile through the webhook

Sometimes the customer closes the page before the return. In that case, the signed webhook confirms the payment and creates the order, and the module never creates a second order for the same cart.

Admin Configuration of Authorize.Net Payment Gateway

After the installation, go to Configuration>Sales>Payment Methods and open the Authorize.Net section.

Authorize.Net Payment Gateway admin configuration screen

General fields

  • Status: turns the method on or off at checkout.
  • Title: sets the name that customers see at checkout.
  • Description: adds a short text under the method name.
  • Logo: uploads your own logo. The best size is 55 x 45 pixels, and the field is optional.
  • Account Currency: sets the currency that your merchant account settles in.
  • Sandbox: switches between test and live mode, so it also decides which credentials the module uses.
  • Sort Order: sets the position among the other payment methods.

Credential fields

Six fields hold your API credentials. The Sandbox toggle picks the set that the module uses.

  • API Login ID: the production login ID of your Authorize.Net account.
  • Sandbox API Login ID: the login ID of your sandbox account.
  • Transaction Key: signs every production API call.
  • Sandbox Transaction Key: signs the same calls in the test environment.
  • Signature Key: checks the production webhook payloads.
  • Sandbox Signature Key: checks the same payloads in test mode.

Remember that the module shows the method only when the status is on and the matching credentials are filled in. Otherwise, it hides the option.

Save the configuration

  1. Log in to the Bagisto admin panel.
  2. Open Configuration>Sales>Payment Methods.
  3. Scroll to the Authorize.Net section.
  4. Turn the Status toggle on.
  5. Enter a Title and a Description.
  6. Turn Sandbox on while you test, or leave it off for live payments.
  7. Fill in the credentials for the mode you chose.
  8. Set a Sort Order and click Save Configuration.

Register the webhook

Next, add this URL in the Authorize.Net merchant portal:

https://your-store.com/authorizenet/webhook

The module places an order from these events: net.authorize.payment.authcapture.created, net.authorize.payment.capture.created and net.authorize.payment.fraud.approved.

However, the endpoint answers 401 when the signature is missing or wrong, so a forged request cannot create an order.

How to Get Your Authorize.Net API Keys

The module needs three credentials: an API Login ID, a Transaction Key and a Signature Key. You create all three in the Authorize.Net merchant portal.

API Login ID and Transaction Key

First, sign in to your Authorize.Net account and open Account>Settings>Security Settings>API Credentials & Keys. The page shows your API Login ID.

Authorize.Net Payment Gateway API Credentials and Keys page
Source:- www.authorize.net

Generate a new Transaction Key

Authorize.Net never shows an old Transaction Key again, so you create a new one. Select New Transaction Key and submit the request.

Authorize.Net verify PIN screen for a new Transaction Key
Source:- www.authorize.net

After you verify the PIN, the portal shows the new Transaction Key. Copy it at once, because you cannot see it a second time.

Authorize.Net Transaction Key shown in the merchant portal
Source:- www.authorize.net

Signature Key for webhooks

The Signature Key sits on the same API Credentials & Keys page. The module uses it to check each webhook signature.

Note: Without this key, the webhook endpoint rejects every request, because it cannot check the signature.

Sandbox accounts issue their own credentials. So create them at sandbox.authorize.net and enter them in the three sandbox fields.

Test in the sandbox

With Sandbox on, the hosted page takes the Authorize.Net test cards. For example, use 4111 1111 1111 1111 with any future expiry date and any card code.

Also, the module allows a 30 second duplicate window, so you can repeat a test for the same amount.

Customer View of Authorize.Net Payment Gateway

After you save the configuration, customers can pay by card. The next three steps show the path from checkout to confirmation.

Select Authorize.Net at checkout

First, the customer picks Authorize.Net under the payment methods. Then the customer clicks Place Order.

Authorize.Net Payment Gateway option at checkout

Pay on the hosted page

Next, the store sends the customer to the Authorize.Net page. There the customer enters the card number, expiry date, card code and billing address, then clicks Pay now.

Authorize.Net hosted payment page with card details and billing address

Confirm the order

Finally, Authorize.Net confirms the payment. The customer clicks Continue and returns to the Bagisto order success page.

Authorize.Net payment receipt

The module records the order, creates the invoice and saves the transaction ID. So the admin can follow the payment on the order page.

Conclusion

The Authorize.Net Payment Gateway lets your store take card payments on a hosted page, which keeps checkout simple and card data off your server.

For more help, read the Bagisto developer documentation. You can also raise a ticket on the Bagisto support forum.

Also, explore our Bagisto payment gateway extensions, for example Stripe, for more payment options.

Current Product Version - 2.5.0

Supported Framework Version - Bagisto v2.5.0

Blog Version - Bagisto v2.5.0
  • Version Bagisto v2.5.0
  • Version Bagisto v2.4.2
  • Version Bagisto v2.4.10
  • Version Bagisto v1.2.0
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • Sharif
    • Nishad Bhan (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home