adrianovcar/asaas-php-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

adrianovcar/asaas-php-sdk

Composer 安装命令:

composer require adrianovcar/asaas-php-sdk

包简介

Asaas.com PHP API v3 Wrapper

README 文档

README

Latest Version on Packagist Total Downloads

SDK for integration with the www.asaas.com service API

In addition to offering a payment gateway service, ASAAS also offers several other financial services, including acting as a BaaS (bank as a service). This SDK is being developed with a focus on the most frequent operations, check the features:

  • CUSTOMERS

    • Check if customer is "in debt" (new)
    • Get all customer's payments "in debt" (new)
    • Get by id
    • Get by customer email
    • List all customer payments
    • List all
    • Create
    • Update
    • Delete
  • PAYMENTS

    • Get by id
    • Get all payments by customer id
    • Get all payments by subscription id
    • Generate a QrCode to payment
    • List all
    • Create new payment (slip, credit card or pix)
    • Update
    • Delete
  • SUBSCRIPTIONS

    • Check if subscription is "in debt" (new)
    • Get all subscription's payments "in debt" (new)
    • Evaluate next due date (based on pro-rata balance) (new)
    • Change plan (with upgrade and downgrade feature) (new)
    • Get by customer id
    • Get by subscription id
    • Get all payments by subscription id
    • List all
    • Create
    • Update
    • Delete
  • PIX-KEY

    • Create
    • List
    • Get by id
    • Delete
  • PIX-QRCODE

    • Create
  • CITIES

    • List
    • Get city by id
  • NOTIFICATIONS

    • The notifications entity is deprecated and will be improved on the next weeks

Installation

The library can be installed using the composer dependency manager. To install the library and all its dependencies, run:

composer require adrianovcar/asaas-php-sdk

Tips

This library was created to facilitate communication with ASAAS, create your own business rules for your SaaS and couple this library for payments.

AsaaS has a strong gear for payment and subscription status notifications, it will communicate with your application via webhooks. You will need to configure directly in ASAAS which endpoint you want to point webhook requests to (configure here)

Examples

<?php

require 'vendor/autoload.php';

use Adrianovcar\Asaas\Adapter\GuzzleHttpAdapter;
use Adrianovcar\Asaas\Asaas;

$adapter = new GuzzleHttpAdapter('your_access_token');

// Instantiate the Asaas client using the previously created adapter instance.
$asaas = new Asaas($adapter);

Endpoint

If you want to use the API in test mode, just specify the environment when the client is instantiated.

// Note: If the second parameter is not informed, the API enters production mode
$asaas = new Asaas($adapter, 'sandbox|production');

Customers

// Returns the list of customers according to the filter used (https://docs.asaas.com/reference/listar-clientes)
$clientes = $asaas->customer()->getAll(array $filtros);

// Returns the customer's data according to the Id
$cobranca = $asaas->customer()->getById('cus_123123');

// Returns the customer's data according to the email
$clientes = $asaas->customer()->getByEmail('email@mail.com');

// Inserts a new customer
$cobranca = $asaas->customer()->create(array $dadosCliente);

// Updates the customer's data
$cobranca = $asaas->customer()->update('cus_123123', array $dadosCliente);

// Deletes a customer
$asaas->customer()->delete('cus_123123');

Payments

// Returns the list of payments
$cobrancas = $asaas->payment()->getAll(array $filtros);

// Returns the payment data according to the Id
$cobranca = $asaas->payment()->getById('pay_123123');

// Returns the list of payments according to the Customer Id
$cobrancas = $asaas->payment()->getByCustomer($customer_id);

// Returns the list of payments according to the Subscriptions Id
$cobrancas = $asaas->payment()->getBySubscription($subscription_id);

// Inserts a new payment
$cobranca = $asaas->payment()->create(array $dadosCobranca);

// Updates the payment data
$cobranca = $asaas->payment()->update('pay_123123', array $dadosCobranca);

// Deletes a payment
$asaas->payment()->delete('pay_123123');

Subscriptions

// Returns the list of subscriptions
$assinaturas = $asaas->subscription()->getAll(array $filtros);

// Returns the subscription data according to the Id
$assinatura = $asaas->subscription()->getById('sub_123123');

// Returns the list of subscriptions according to the Customer Id
$assinaturas = $asaas->subscription()->getByCustomer($customer_id);

// Inserts a new subscription
$assinatura = $asaas->subscription()->create(array $dadosAssinatura);

// Updates the subscription data
$assinatura = $asaas->subscription()->update('sub_123123', array $dadosAssinatura);

// Deletes a subscription
$asaas->subscription()->delete('sub_123123');

Notifications

// Returns the list of notifications
$notificacoes = $asaas->notification()->getAll(array $filtros);

// Returns the notification data according to the Id
$notificacao = $asaas->notification()->getById('not_123123');

// Returns the list of notifications according to the Customer Id
$notificacoes = $asaas->notification()->getByCustomer($customer_id);

// Inserts a new notification
$notificacao = $asaas->notification()->create(array $dadosNotificacao);

// Updates the notification data
$notificacao = $asaas->notification()->update('not_123123', array $dadosNotificacao);

// Deletes a notification
$asaas->notification()->delete('not_123123');

Cities

// Returns the list of cities
$cidades = $asaas->city()->getAll(array $filtros);

// Returns the city data according to the Id
$action123 = $asaas->city()->getById(123);

Official Documentation

The ASAAS documentation is extensive and very complete. For details on each endpoint, consult the official documentation.

Credits

Changelog

Consult the updates of this SDK in the changelog

Support

To report a new bug please open a new Issue on github

License

Distributed under the MIT license. Copy, paste, modify, improve and share without fear ;)

adrianovcar/asaas-php-sdk 适用场景与选型建议

adrianovcar/asaas-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.09k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「credit card」 「boleto」 「Asaas」 「Payment SaaS」 「pix」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 adrianovcar/asaas-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 adrianovcar/asaas-php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 adrianovcar/asaas-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 41
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-30