gomesmateus/appypay-sdk
Composer 安装命令:
composer require gomesmateus/appypay-sdk
包简介
SDK lightweight para integração com AppyPay (Angola)
README 文档
README
SDK não-oficial para integrar aplicações Laravel com o gateway de pagamentos angolano AppyPay. Fornece serviços para emissão de QR Codes, cobranças via Multicaixa Express (GPO) e referências, abstracção de autenticação OAuth2 e modelos de resposta tipados.
Funcionalidades
- Autenticação
client_credentialscom cache e refresh automático. - Cliente HTTP partilhado com renovação transparente de token em
401. - Serviços para:
- Criar/listar charges.
- Criar cobranças GPO (push para Multicaixa Express).
- Criar cobranças por referência (REF).
- Emitir QR Codes.
- DTOs para requests e responses, com exceções customizadas (
AppyPayException).
Instalação
Usando Composer (path repository)
Para testar a SDK num outro projecto Laravel sem publicá-la no Packagist, adiciona um path repository ao composer.json desse projecto:
{
"repositories": [
{
"type": "path",
"url": "../appypay-sdk"
}
]
}
A seguir instala a dependência:
composer require gomesmateus/appypay-sdk:^1.0.2
Ajusta o caminho em
urlpara apontar para a pasta onde o SDK está clonado.
Directamente neste repositório
Se quiseres apenas experimentar localmente, garante que as dependências do Laravel (HTTP e Cache) estão disponíveis através do teu projecto hospedeiro.
Configuração
Publica o ficheiro de configuração (opcional, mas recomendado):
php artisan vendor:publish --tag=appypay-config
Define as variáveis no .env do projecto que consome o SDK:
APPYPAY_BASE_URL=https://gwy-api.appypay.co.ao/v2.0
APPYPAY_TOKEN_URL=https://auth.appypay.co.ao/connect/token
APPYPAY_CLIENT_ID=xxxxxxxx
APPYPAY_CLIENT_SECRET=xxxxxxxx
APPYPAY_RESOURCE=xxxx
APPYPAY_PAYMENT_METHOD_GPO_QR=GPO_xxx
APPYPAY_PAYMENT_METHOD_GPO_EXPRESS=GPO_xxx
APPYPAY_PAYMENT_METHOD_REFERENCE=REF_xxx
Verifica na documentação oficial quais IDs de métodos de pagamento correspondem ao teu ambiente (produção/sandbox).
Depois limpa o cache de configuração, se necessário:
php artisan config:clear
Utilização
Resolve o cliente através do container:
use AppyPay\AppyPayClient; $client = app(AppyPayClient::class);
Criar QR Code
use AppyPay\DTO\Requests\CreateQrCodeRequest; $response = $client->qrCodes()->create(new CreateQrCodeRequest( amount: 2500.00, currency: 'AOA', merchantTransactionId: 'TEST' . time(), paymentMethod: config('appypay.payment_methods.gpo_qr'), description: 'Pagamento de teste via QR Code', qrCodeType: 'SINGLE', startDate: new \DateTime('2025-01-01 10:00:00'), endDate: new \DateTime('2025-01-01 18:00:00') )); $qrCodeBase64 = $response->qrCodeArr;
Multicaixa Express (GPO)
$charge = $client->charges()->createGpoPayment( amount: 2500.00, currency: 'AOA', merchantTransactionId: 'TEST' . time(), description: 'Consulta de teste', phoneNumber: '244923000000', notify: [ 'name' => 'Cliente Teste', 'telephone' => '244923000000', 'email' => 'cliente@example.com', 'smsNotification' => true, 'emailNotification' => false, ] ); $referenceNumber = $charge->reference()?->referenceNumber;
Consultar charge
$charge = $client->charges()->find($chargeId); $status = $charge->responseStatus->status;
Referência (REF)
use AppyPay\DTO\Requests\CreateChargeRequest; $charge = $client->charges()->create(new CreateChargeRequest( amount: 2500.00, currency: 'AOA', merchantTransactionId: 'TEST' . time(), description: 'Pagamento por referência', paymentMethod: config('appypay.payment_methods.ref'), isAsync: true )); $referenceNumber = $charge->reference()?->referenceNumber;
Listar charges
$response = $client->charges()->list([ 'status' => 'Pending', ]); $payload = $response->json();
Testes Locais
- Usa
php artisan tinkerpara executar chamadas rápidas, garantindo que as credenciais são válidas. - Para testes automatizados, usa
Illuminate\Support\Facades\Http::fake()e simula respostas (401seguido de200para validar refresh do token,422para erros de validação, etc.). - Se tiveres ambiente sandbox da AppyPay, cria um
.env.testingcom credenciais próprias e definesAPP_ENV=testingpara executar testes de integração reais.
Roadmap
- Webhook helper (validação e normalização de payloads).
- Suporte a outros endpoints (refunds, void, status async).
- Transformers opcionais para responses para frameworks não Laravel.
Licença
MIT © Gomes Mateus
gomesmateus/appypay-sdk 适用场景与选型建议
gomesmateus/appypay-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 12 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payments」 「sdk」 「laravel」 「angola」 「appypay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gomesmateus/appypay-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gomesmateus/appypay-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gomesmateus/appypay-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Alfabank REST API integration
Scanpay module for Magento 2
Laravel package for Accurate Online API integration.
Official Safaricom Daraja M-Pesa integration for Laravel built on ysg/payment-core.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-12