Search by

nowo-tech / openpay-php

HecFranco

Clean-room PHP SDK for the public Openpay REST API. PHP 8.3+ and FrankenPHP worker-safe (no static merchant credentials).

Package info

github.com/nowo-tech/OpenpayPhp

Documentation

Language:Shell

pkg:composer/nowo-tech/openpay-php

Fund package maintenance!

HecFranco

Statistics

Installs: 853

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.0 2026-10-22 04:28 UTC

README

CI Packagist Version Packagist Downloads License PHP GitHub stars Coverage

⭐ 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).

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly.

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 (default CurlHttpClient with connect/request timeouts and OS-store TLS).
  • Typed API errors (OpenpayApiException with 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.6) with ext-curl and ext-json
  • No framework dependency (plain PHP library; the Symfony 8 demo is illustrative)

Documentation

Additional documentation

Tests and coverage

composer test
composer test-coverage
make qa
  • Tests: PHPUnit (unit)
  • PHP: 100% lines (131/131; 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.