byrcsc/laravel-payrex

Unofficial PayRex SDK for Laravel: typed resources, readonly DTOs, and first-class webhook handling.

Maintainers

Package info

github.com/byrcsc/laravel-payrex

Forum

Documentation

pkg:composer/byrcsc/laravel-payrex

Transparency log

Fund package maintenance!

Buy Me A Coffee

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-07-29 12:50 UTC

This package is auto-updated.

Last update: 2026-07-29 12:53:29 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub PHPStan Action Status Total Downloads

An unofficial Laravel SDK for the PayRex payments API: typed resources, readonly DTOs, and webhook handling that feels like the rest of your app.

Built for Laravel projects accepting payments in the Philippines and shared with the community, it brings PayRex's documented API into familiar Laravel conventions.

Read the full documentation for installation, resources, webhooks, pagination, testing, and security guidance.

Laravel Supported PHP versions
12.x 8.2, 8.3, 8.4, 8.5
13.x 8.3, 8.4, 8.5

Installation

Install the package and publish its configuration:

composer require byrcsc/laravel-payrex
php artisan vendor:publish --tag="payrex-config"

Add your PayRex test credentials:

PAYREX_SECRET_KEY=sk_test_...
PAYREX_PUBLIC_KEY=pk_test_...      # Only needed for PayRex Elements
PAYREX_WEBHOOK_SECRET=whsk_test_... # Only needed for webhooks

See the installation guide for all configuration options and the optional customer migration.

Quick start

Use the facade or inject PayrexClient. Both resolve to the same singleton.

use ByRcsc\LaravelPayrex\Facades\Payrex;

$intent = Payrex::paymentIntents()->create(
    amount: 10_000,
    paymentMethods: ['card', 'gcash'],
    description: 'Order #RC-1042',
);

$intent->id;
$intent->status;
$intent->clientSecret;

Amounts are integers in the smallest currency unit: 10_000 is ₱100.00. Never send a floating-point amount.

What is included

  • Typed resources for payments, checkout, customers, refunds, payouts, billing, and webhook endpoints.
  • Readonly data objects that retain the untouched API payload on $raw.
  • Verified webhooks dispatched as generic and type-specific Laravel events.
  • Typed exceptions, response metadata, and conservative retries for GET requests.
  • Automatic cursor iteration and Laravel CursorPaginator support.
  • An Eloquent customer concern and Artisan commands for managing webhooks.
  • Http::fake() support throughout the client.

Important behavior

  • Mutating requests are never retried. PayRex documents no idempotency keys, so replaying an ambiguous request could duplicate a payment or refund.
  • Queue webhook listeners and deduplicate them using the PayRex event ID. Signature freshness checks do not prevent the same valid event from arriving more than once.
  • PayRex does not expose a subscription resource. Recurring billing must be modelled explicitly, such as with a billing statement for each cycle.
  • Keep PAYREX_SECRET_KEY on the server. Only the public key is intended for browser use with PayRex Elements.

Documentation

Support and contributing

Ask usage questions in GitHub Discussions. For reproducible package bugs, open an issue. See CONTRIBUTING.md before opening a pull request.

Report vulnerabilities privately by following SECURITY.md.

Credits

API behavior is referenced against the official PayRex documentation and payrex/payrex-php SDK.

License

MIT. See LICENSE.md. Changelog in CHANGELOG.md.