Download the PHP package squareetlabs/laravel-authorizenet without Composer

On this page you can find all versions of the php package squareetlabs/laravel-authorizenet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-authorizenet

Laravel Authorize.Net Package

Scrutinizer Code Quality Code Intelligence Status Build Status PHP Version Laravel Version

A comprehensive Laravel package for seamless integration with Authorize.Net payment gateway. This package provides an elegant, fluent interface for managing customer profiles, payment methods, transactions, subscriptions, and more.

Features

Requirements

Installation

Install the package via Composer:

Publish Configuration

Publish the configuration file (optional):

Run Migrations

The package requires database tables to store customer and payment profiles. Run the migrations:

This will create two tables:

Setup User Model

Add the ANetPayments trait to your User model:

Configuration

Add your Authorize.Net credentials to your .env file:

You can obtain these credentials from your Authorize.Net Merchant Interface:

Navigate to Settings > Security Settings > API Credentials & Keys to find your credentials.

Basic Usage

Once configured, you can access Authorize.Net functionality through the anet() method on your User model:

Customer Profiles

Customer profiles are required before you can store payment methods. Authorize.Net uses customer profiles to securely store payment information without requiring PCI compliance on your end.

Create a Customer Profile

Get Customer Profile ID

The customer profile ID is automatically stored in your database using the UserGatewayProfile model.

Payment Profiles

Payment profiles allow you to store payment methods securely without handling sensitive card data. This is achieved through Authorize.Net's Accept.js, which sends payment data directly to Authorize.Net.

Creating a Payment Profile with Accept.js

Frontend (JavaScript):

Backend (Laravel):

Get Payment Profiles

Using Eloquent Models

You can also work directly with the Eloquent models:

Charging Payment Profiles

Once you have a payment profile, you can charge it:

Refunds

Refund a previous transaction:

Direct Card Transactions

For one-time payments without storing payment methods, you can process direct card transactions:

Card Service Methods

Subscriptions

Create and manage recurring subscription payments:

Create a Subscription

Get Subscription

Update Subscription

Cancel Subscription

Get Subscription Status

List Subscriptions

Subscription Aliases

You can use any of these methods to access the subscription service:

Transaction Management

Work with transaction responses to check status and retrieve information:

Get Transactions by Batch ID

Working with Transaction Responses

All transaction methods return a CreateTransactionResponse object. Here's how to work with it:

Eloquent Models

The package provides two Eloquent models for working with stored data:

UserGatewayProfile

Represents a customer profile stored locally:

UserPaymentProfile

Represents a payment method stored locally:

Environment Configuration

The package automatically uses the appropriate environment based on your Laravel app environment:

You can override this by setting AUTHORIZE_NET_ENVIRONMENT in your .env file:

Error Handling

Always wrap Authorize.Net operations in try-catch blocks:

Testing

Running Package Tests

The package includes a comprehensive test suite. To run the tests:

Test Coverage

The package includes tests for:

Test Environment Setup

For testing, you need to configure your .env file with Authorize.Net sandbox credentials:

Note: Some integration tests require valid Authorize.Net sandbox credentials and will fail if credentials are invalid or missing. This is expected behavior as these tests verify actual API connectivity.

Testing in Your Application

When testing your own application that uses this package:

Option 1: Use Authorize.Net Sandbox (Recommended)

Configure your test environment to use Authorize.Net's sandbox:

Option 2: Mock Authorize.Net Responses

Use PHPUnit's mocking capabilities to mock API responses:

Option 3: Use Feature Flags

Skip actual API calls during testing:

Test Database Setup

The package tests use an in-memory SQLite database. The package automatically creates the necessary tables during testing. Note: The package does not create a users table migration - your application should already have this table.

Test Results

Current test status:

Best Practices for Testing

  1. Use Sandbox Environment: Always use Authorize.Net sandbox credentials for testing
  2. Mock External Calls: For unit tests, mock Authorize.Net API responses
  3. Test Error Handling: Test both success and failure scenarios
  4. Isolate Tests: Each test should be independent and not rely on previous test data
  5. Use Test Database: Always use a separate test database, never test against production data

API Reference

ANet Class Methods

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

Support

For issues and questions:

Changelog

Version 2.0.0


Made with ❤️ for the Laravel community


All versions of laravel-authorizenet with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-curl Version *
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
authorizenet/authorizenet Version ^2.0.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package squareetlabs/laravel-authorizenet contains the following files

Loading the files please wait ...