Download the PHP package fevinta/cashier-asaas without Composer

On this page you can find all versions of the php package fevinta/cashier-asaas. 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 cashier-asaas

Laravel Cashier-style Asaas (Unofficial)

Latest Version on Packagist Tests codecov Total Downloads

Laravel Cashier-style subscription billing for Asaas payment gateway (Brazil).

Features

Requirements

Installation

Publish the configuration and migrations:

Configuration

Add your Asaas credentials to .env:

Define your subscription plans in config/cashier-asaas.php:

Setup

Add the Billable trait to your User model:

Usage

Creating Subscriptions

Checking Subscription Status

Managing Subscriptions

Plan Swapping & Proration

When you swap plans, automatic proration is applied via the Asaas API. Here's how it works:

Example: Upgrading from R$10/month to R$20/month

The swap() method sends updatePendingPayments: true to Asaas, which automatically:

Single Charges

Webhooks

The package automatically handles Asaas webhooks. Configure the webhook URL in your Asaas dashboard:

Available events you can listen to:

Middleware

Protect routes requiring subscription:

Register the middleware in your Kernel:

Payment Split

Share revenue with partners:

Asaas Checkout

The package provides a powerful checkout session builder that redirects customers to Asaas's hosted checkout page. This is similar to Stripe Checkout and allows customers to complete payments without you handling sensitive payment data.

Basic Usage

Guest Checkout (No Account Required)

Customer Checkout (Existing User)

Payment Method Options

Installment Payments

Recurring/Subscription Checkout

Redirect URLs

Or configure defaults in config/cashier-asaas.php:

Session Options

Payment Split in Checkout

Using the Checkout Response

Checkout Webhook Events

Invoices (Nota Fiscal de Serviço)

The package supports issuing NFS-e (Nota Fiscal de Serviço) through the Asaas API. Invoices are scheduled via the API, processed with the city hall (prefeitura), and kept in sync locally through webhooks.

Configuration

Add the following to your project's .env:

Run the migration to create the asaas_invoices table:

Scheduling an Invoice

Working with the Invoice Model

Status Lifecycle

API Queries

Subscription Invoice Auto-Generation

Configure automatic NFS-e issuance for subscription payments:

Invoice Webhook Events

The webhook controller automatically syncs invoice data to the local database and dispatches events:

Webhook Event Event Class Invoice Status
INVOICE_CREATED InvoiceCreated SCHEDULED
INVOICE_UPDATED InvoiceUpdated (varies)
INVOICE_SYNCHRONIZED InvoiceSynchronized SYNCHRONIZED
INVOICE_AUTHORIZED InvoiceAuthorized AUTHORIZED
INVOICE_CANCELED InvoiceCanceled CANCELED
INVOICE_CANCELLATION_DENIED InvoiceCancellationDenied CANCELLATION_DENIED
INVOICE_ERROR InvoiceError ERROR

Listen to invoice events in your application:

Custom Invoice Model

If you need to extend the default Invoice model:

API Reference

Billable Trait Methods

Method Description
createAsAsaasCustomer() Create customer in Asaas
updateAsaasCustomer() Update customer data
asAsaasCustomer() Get Asaas customer data
newSubscription($type, $plan) Start subscription builder
subscription($type) Get subscription by type
subscribed($type) Check if subscribed
onTrial($type) Check if on trial
charge($amount, $type, $options) Single charge
newCheckout() Start checkout builder
checkout($items, $options) Create checkout with items
checkoutCharge($amount, $name) Quick single charge checkout

Subscription Methods

Method Description
active() Is subscription active
valid() Is subscription valid (active/trial/grace)
cancel() Cancel at period end
cancelNow() Cancel immediately
resume() Resume cancelled subscription
swap($plan) Change plan
updateValue($value) Update subscription price
updateCreditCard() Update payment card

Checkout Builder Methods

Method Description
charge($amount, $description) Add single item
addItem($name, $value, $qty) Add item to checkout
items($items) Set multiple items
allowAllPaymentMethods() Enable PIX, Boleto, Credit Card
onlyPix() Only allow PIX
onlyBoleto() Only allow Boleto
onlyCreditCard() Only allow Credit Card
withPix() / withBoleto() / withCreditCard() Add payment method
oneTime() One-time payment (default)
installments($count) Fixed installment payment
maxInstallments($count) Customer chooses installments
monthly() / yearly() / weekly() Recurring payment cycles
successUrl($url) Set success redirect
cancelUrl($url) Set cancel redirect
expiredUrl($url) Set expired redirect
expiresIn($minutes) Set session expiration
externalReference($ref) Set external reference
split($walletId, ...) Add payment split
create() Create checkout session

Checkout Response Methods

Method Description
id() Get checkout session ID
url() Get checkout page URL
status() Get checkout status
session() Get full API response
redirect() Redirect to checkout page
toArray() Convert to array
toJson() Convert to JSON

Testing

The package uses PEST for testing with a dual approach: mocked HTTP for fast unit/feature tests, and real Asaas Sandbox API for integration tests.

Run All Tests (Mocked)

Run Specific Test Suites

Integration Tests (Real Asaas Sandbox)

Integration tests hit the real Asaas Sandbox API. They are skipped by default when no credentials are configured.

Static Analysis

Test Configuration

Environment variables for testing:

Variable Description Default
ASAAS_API_KEY Asaas API key (required for integration tests) -
ASAAS_SANDBOX Enable sandbox mode true
ASAAS_WEBHOOK_TOKEN Webhook verification token -

License

MIT License. See LICENSE for details.


All versions of cashier-asaas with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
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 fevinta/cashier-asaas contains the following files

Loading the files please wait ...