medyat/parapos

Php client for Parapos API

Maintainers

Package info

github.com/medyat/parapos-php

pkg:composer/medyat/parapos

Transparency log

Statistics

Installs: 825

Dependents: 0

Suggesters: 0

Stars: 0

4.0.0 2026-08-16 19:27 UTC

README

This package provides php client for Parapos API.

Requires PHP 8.2+

Upgrading a major version? See UPGRADE.md.

Using your own payment model

Point config('parapos.model') at your own Eloquent model (e.g. a uuid-keyed, tenant-aware one). It must use MedyaT\Parapos\Concerns\InteractsWithParaposPayment and implement MedyaT\Parapos\Contracts\PaymentStatus:

// config/parapos.php
'model' => \App\Models\Payment::class,

// Set to false when your app owns the payments schema
// (e.g. uuid primary key) and ships its own migration.
'load_migrations' => false,

The bundled (bigint) migration can be published as a starting point:

php artisan vendor:publish --tag=parapos-migrations

Running two profiles in one application

Global config assumes one profile per process. When an application collects on more than one โ€” say a tenant context and an admin context sharing the same workers โ€” pass the profile to Parapos instead, and nothing has to be written to global config (writes that would otherwise leak from one request into the next under Octane or a queue worker):

$parapos = new Parapos([
    'apiKey' => '...',
    'secretKey' => '...',
    'model' => \App\Models\Landlord\LandlordCardPayment::class,
    'response_url' => 'landlord/parapos/response/{hash}',
    'appUrl' => 'https://admin.example.com',
]);

model, response_url, tenant and appUrl each fall back to config('parapos.*') (and config('app.url')) when omitted, so an application with a single profile needs no changes.

The 3D callback needs a matching route. Extend HandleResponseAction, override what differs, and register it wherever you like:

class LandlordParaposResponseController extends \MedyaT\Parapos\Http\HandleResponseAction
{
    protected function model(): string
    {
        return \App\Models\Landlord\LandlordCardPayment::class;
    }
}

Route::post('landlord/parapos/response/{hash}', LandlordParaposResponseController::class);

Set 'register_routes' => false if you would rather register every callback route yourself.

๐Ÿงน Keep a modern codebase with Pint:

composer lint

โœ… Run refactors using Rector

composer refacto

โš—๏ธ Run static analysis using PHPStan:

composer test:types

โœ… Run unit tests using PEST

composer test:unit

๐Ÿš€ Run the entire test suite:

composer test