Ecommerce

Integrá checkout UNIpagos en tu tienda

Conectá tu tienda con la API UNIpagos: checkout, redirección de pago y aviso automático cuando el cobro se acredita.

WooCommerce

  1. Creá una clave en el panel API.
  2. En checkout, POST /api/v1/checkout con amount + description.
  3. Redirigí al checkout_url que devolvemos.
  4. Registrá el webhook a /wc-api/unipagos.
<?php
// wp-content/plugins/unipagos-gateway/unipagos.php (WooCommerce)
add_action('woocommerce_api_unipagos', function () {
    $payload = file_get_contents('php://input');
    $sig = $_SERVER['HTTP_X_UNIPAGOS_SIGNATURE'] ?? '';
    $secret = get_option('unipagos_whsec');
    if (!hash_equals(hash_hmac('sha256', $payload, $secret), $sig)) {
        wp_die('invalid', '', 401);
    }
    $event = json_decode($payload, true);
    if (($event['event'] ?? '') === 'payment.paid') {
        // marcar orden pagada en Woo
    }
    echo 'ok';
});

Shopify

App custom: al confirmar el draft order llamás a /api/v1/payments y usás checkout_url como payment redirect. El webhook cierra la orden.

curl -X POST https://unipagos.com.ar/api/v1/checkout \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"amount":49.90,"description":"Orden Shopify #1024"}'
Ver API completa