iPagos
Home Products Terminals Tocas i Cobras Tocas i Pagas E-Commerce Crypto Services Developers Payment Scheme Conciliation Customer Portal Contact
Customer portal EN Español English
Documentación

Desarrolladores

Todo lo que necesitas para integrar iPagos en tu producto: APIs REST, SDKs oficiales, webhooks, ambientes de prueba y guías paso a paso.

Empezar ahora Solicitar API key
Introducción Guía rápida Autenticación Manejo de errores Paginación Idempotencia
Pagos Clientes Suscripciones Webhooks
JavaScript / Node PHP Python
Sandbox Tarjetas de prueba Changelog
¿Necesitas ayuda? Escríbenos a [email protected] y un especialista te apoyará.
Documentación Introducción
SDKs

SDK PHP

Cliente oficial de iPagos para PHP 8.1+. Compatible con frameworks modernos como Laravel, Symfony, Slim y CodeIgniter 4.

Instalación

composer require ipagos/ipagos-php

Inicialización

<?php
require 'vendor/autoload.php';

use IPagos\Client;

$ipagos = new Client(
    secretKey: getenv('IPAGOS_SECRET_KEY'),
    apiVersion: '2026-01-15',
    maxRetries: 3,
);

Crear un pago

<?php
$payment = $ipagos->payments->create([
    'amount'      => 25000,
    'currency'    => 'MXN',
    'source'      => 'tok_visa_4242',
    'description' => 'Pedido #1042',
    'metadata'    => ['order_id' => '1042'],
], [
    'idempotency_key' => bin2hex(random_bytes(16)),
]);

echo $payment->id, ' ', $payment->status;

Integración con Laravel

<?php
// config/services.php
'ipagos' => [
    'key'    => env('IPAGOS_SECRET_KEY'),
    'webhook'=> env('IPAGOS_WEBHOOK_SECRET'),
],

// app/Providers/AppServiceProvider.php
$this->app->singleton(IPagos\Client::class, fn () =>
    new IPagos\Client(config('services.ipagos.key'))
);

// app/Http/Controllers/CheckoutController.php
public function pay(Request $request, IPagos\Client $ipagos)
{
    $payment = $ipagos->payments->create([
        'amount'   => $request->integer('amount'),
        'currency' => 'MXN',
        'source'   => $request->string('token'),
    ]);

    return response()->json($payment);
}

Manejo de errores

<?php
use IPagos\Exceptions\CardException;
use IPagos\Exceptions\RateLimitException;
use IPagos\Exceptions\ApiException;

try {
    $payment = $ipagos->payments->create([...]);
} catch (CardException $e) {
    // El banco rechazó la tarjeta — mostrar al usuario.
    return back()->withErrors(['card' => $e->getMessage()]);
} catch (RateLimitException $e) {
    // Esperar y reintentar.
    sleep($e->retryAfter);
} catch (ApiException $e) {
    // Falla genérica — log + retry asíncrono.
    Log::error('iPagos', ['id' => $e->requestId, 'msg' => $e->getMessage()]);
}
iPagos

We offer comprehensive payment solutions for your business, adapting to your needs with cutting-edge technology and top-tier security.

Products:

Terminals Tocas i Cobras Tocas i Pagas E-Commerce Crypto

Services:

Developers Payment Scheme Conciliation Customer Portal Contact

Are you ready to get started?

Connect with us today and take your business to the next level.

[email protected]
[email protected]
+52 77 7915 4887
© 2026 iPagos. All rights reserved.