krugerdavid/laravel-pagopar

Laravel integration for Pagopar payment gateway

Maintainers

Package info

github.com/krugerdavid/laravel-pagopar

pkg:composer/krugerdavid/laravel-pagopar

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 1

v1.0.0 2026-01-19 21:02 UTC

This package is auto-updated.

Last update: 2026-02-19 21:17:04 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

Laravel integration for Pagopar payment gateway.

Installation

You can install the package via composer:

composer require krugerdavid/laravel-pagopar

The service provider will automatically register itself.

You can publish the config file with:

php artisan vendor:publish --tag="pagopar-config"

Configuration

Add these variables to your .env file:

PAGOPAR_PUBLIC_KEY=your_public_token
PAGOPAR_PRIVATE_KEY=your_private_token

Usage

Creating a Payment

use KrugerDavid\Pagopar\Facades\Pagopar;
use KrugerDavid\Pagopar\DTOs\PagoparBuyer;
use KrugerDavid\Pagopar\DTOs\PagoparItem;
use KrugerDavid\Pagopar\DTOs\PagoparPaymentRequest;

$buyer = new PagoparBuyer(
    name: 'Juan Perez',
    email: 'juan@example.com',
    document: '1234567',
    phone: '+595981123456'
);

$items = [
    new PagoparItem(
        name: 'Producto de Prueba',
        price: 10000,
        quantity: 1
    )
];

$request = new PagoparPaymentRequest(
    orderId: 'ORDER-123',
    buyer: $buyer,
    items: $items,
    maxPaymentDate: now()->addDays(2)->format('Y-m-d H:i:s'),
    description: 'Descripción del pedido'
);

$response = Pagopar::createPayment($request);

if ($response['hash']) {
    $checkoutUrl = Pagopar::getCheckoutUrl($response['hash']);
    return redirect($checkoutUrl);
}

Checking Order Status

$status = Pagopar::getOrderStatus($hash);

if (!empty($status) && $status[0]['pagado']) {
    // El pedido ha sido pagado
}

Verifying Webhook Token

public function handleWebhook(Request $request)
{
    $hash = $request->input('resultado.0.hash_pedido');
    $token = $request->input('resultado.0.token');

    if (Pagopar::verifyWebhookToken($hash, $token)) {
        // Token válido, procesar el pago
    }
}

Security

If you discover any security related issues, please email david.kruger@duplaa.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.