nowo-tech / openpay-php
Clean-room PHP SDK for the public Openpay REST API. PHP 8.3+ and FrankenPHP worker-safe (no static merchant credentials).
Fund package maintenance!
Requires
- php: >=8.3 <8.6
- ext-curl: *
- ext-json: *
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
- psr/log: ^1.1 || ^2.0 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- igor-php/igor-php: ^0.9.7 || ^0.10.0
- nowo-tech/phpstan-frankenphp: ^1.1
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- rector/rector: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- v3.2.1
- 3.2.0
- 3.1.1.1
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- dev-main / 1.0.x-dev
- v1.0.2
- v1.0.1
- v1.0.0
- dev-chore/demo-platform-shell
- dev-chore/deps-2026-11-18
- dev-chore/phase-c-req
- dev-feat/arch-001-ports
- dev-fix/version-1.6.1
- dev-feat/arch-001-d
- dev-fix/worker-state-a5
- dev-ci/igor-worker-audit
This package is auto-updated.
Last update: 2026-11-30 21:00:14 UTC
README
⭐ Found this useful? Install from Packagist · Star on GitHub.
Clean-room PHP SDK for the public Openpay REST API. Namespace Nowo\Openpay\. License MIT. Release 1.1.4.
Independent implementation from public docs — not a redistribution of openpay/sdk. No process-wide static merchant credentials (FrankenPHP worker-safe, including when the kernel is not reset between requests).
This bundle is FrankenPHP worker mode friendly.
Create a customer through Session (mocked without keys)
|
The customer payload returned by the SDK |
Table of contents
Features
- Merchant resources: charges, customers, cards, tokens, webhooks (plus customer-scoped charges and cards).
- Request-scoped
Credentials/Session/Client— no static merchant state, safe in FrankenPHP workers. - Injectable
HttpClient(defaultCurlHttpClientwith connect/request timeouts and OS-store TLS), or any PSR-18 client throughPsr18HttpClient. - Typed API errors (
OpenpayApiExceptionwith HTTP status, error code, category, request id). - Countries: Mexico, Colombia, Peru (sandbox and production hosts).
Installation
composer require nowo-tech/openpay-php:^1.1
See docs/INSTALLATION.md.
Quick start
use Nowo\Openpay\Client; use Nowo\Openpay\Country; use Nowo\Openpay\Credentials; use Nowo\Openpay\Session; $credentials = new Credentials( merchantId: getenv('OPENPAY_MERCHANT_ID') ?: '', privateKey: getenv('OPENPAY_PRIVATE_KEY') ?: '', country: Country::Mx, sandbox: true, publicIp: $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1', ); $session = new Session($credentials); $customer = $session->run(static fn (Client $client) => $client->customers->create([ 'name' => 'Demo', 'email' => 'demo@example.test', ]));
Requirements
- PHP 8.3+ (
>=8.3 <8.7) withext-curlandext-json - No framework dependency (plain PHP library; the Symfony 8 demo is illustrative)
Documentation
- Installation
- Configuration
- Usage (includes DDD / hexagonal hosts)
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
- Coverage
- FrankenPHP demo
- FrankenPHP worker mode audit
- GitHub Actions CI requirements
- PSR evaluation (REQ-CS-007)
- Branching
Tests and coverage
composer test
composer test-coverage
make qa
- Tests: PHPUnit (unit)
- PHP: 100% lines (187/187; gate ≥ 99% via
make release-check, see docs/COVERAGE.md) - TS/JS: N/A
- Python: N/A
License
MIT — see LICENSE.
Independent clean-room client for the public Openpay REST API. Not a redistribution of openpay/sdk. “Openpay” is a trademark of its owners.


