lumensistemas/laravel-inter 问题修复 & 功能扩展

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

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

lumensistemas/laravel-inter

最新稳定版本:1.1.0

Composer 安装命令:

composer require lumensistemas/laravel-inter

包简介

A Laravel package for integrating with Banco Inter API.

README 文档

README

Latest Version on Packagist Tests Total Downloads

A typed, testable Laravel API client for Banco Inter. Supports billing (cobranca), multi-tenancy, and OAuth 2.0 + mTLS authentication.

Requirements: PHP 8.4+, Laravel 12+

Installation

You can install the package via composer:

composer require lumensistemas/laravel-inter

Publish the configuration file:

php artisan vendor:publish --tag=inter-config

Add your credentials to .env:

INTER_CLIENT_ID=your-client-id
INTER_CLIENT_SECRET=your-client-secret
INTER_CERTIFICATE=/path/to/certificate.crt
INTER_PRIVATE_KEY=/path/to/private.key
INTER_ENVIRONMENT=sandbox
INTER_CONTA_CORRENTE=

Usage

Billing (Cobranca)

use LumenSistemas\Inter\Facades\Inter;

// Issue a new billing (boleto + Pix QR code)
$response = Inter::billing()->create(
    seuNumero: 'INV-001',
    valorNominal: 150.00,
    dataVencimento: '2026-05-01',
    numDiasAgenda: 30,
    pagador: [
        'cpfCnpj' => '12345678901',
        'tipoPessoa' => 'FISICA',
        'nome' => 'John Doe',
        'endereco' => 'Rua Example, 123',
        'cidade' => 'Curitiba',
        'uf' => 'PR',
        'cep' => '80000000',
    ],
);
// $response->data['codigoSolicitacao']

// Retrieve a billing
$billing = Inter::billing()->find('abc-123-def');
// $billing->data['cobranca'], $billing->data['boleto'], $billing->data['pix']

// List billings (paginated)
$page = Inter::billing()->list(
    dataInicial: '2026-04-01',
    dataFinal: '2026-04-30',
    situacao: 'A_RECEBER',
    tipoOrdenacao: 'DESC',
);

// Iterate through all pages automatically
foreach (Inter::billing()->all(['dataInicial' => '2026-04-01', 'dataFinal' => '2026-04-30']) as $item) {
    // ...
}

// Get billing PDF (base64)
$pdf = Inter::billing()->pdf('abc-123-def');

// Cancel a billing
Inter::billing()->cancel('abc-123-def', 'APEDIDODOCLIENTE');

// Summary grouped by status
$summary = Inter::billing()->summary(
    dataInicial: '2026-04-01',
    dataFinal: '2026-04-30',
);

Billing Webhooks

use LumenSistemas\Inter\Facades\Inter;

// Register a webhook URL
Inter::billingWebhook()->create('https://example.com/webhooks/inter/billing');

// Retrieve current webhook config
$webhook = Inter::billingWebhook()->retrieve();
// $webhook->data['webhookUrl'], $webhook->data['criacao']

// Delete the webhook
Inter::billingWebhook()->delete();

// Retrieve callback delivery history
$callbacks = Inter::billingWebhook()->callbacks(
    dataHoraInicio: '2026-04-01T00:00:00Z',
    dataHoraFim: '2026-04-30T23:59:59Z',
);

Multi-Tenancy

Each tenant can use its own credentials:

$tenant = Inter::client(
    clientId: $tenant->inter_client_id,
    clientSecret: $tenant->inter_client_secret,
    certificate: $tenant->inter_certificate_path,
    privateKey: $tenant->inter_private_key_path,
);

$tenant->billing()->create(...);

Testing

composer test                # Unit + Feature tests
composer test:integration    # Integration tests (requires .env credentials)

Webhook Development

Start a local webhook receiver and register it with Inter's sandbox:

composer webhook:serve       # Start receiver on port 8008
composer webhook:register    # Register TEST_EXPOSE_URL from .env with Inter

Use Expose or ngrok to tunnel the local server to a public URL.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 63
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-10