npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@insoutt/datafast-react

v2.0.3

Published

Componente de React para la pasarela de pagos Datafast

Readme

@insoutt/datafast-react

@insoutt/datafast-react es una librería de React que permite integrar Datafast y facilita la interacción con el flujo de pago. Permite implementar una interfaz personalizada y robusta sobre el widget de Datafast de manera rápida.

Componentes

Datafast

Renderiza el formulario de pago de Datafast y carga el script remoto. Soporta modo redirection e inline (iframe de respuesta) y permite personalizar textos y comportamiento del widget.

Props

| Prop | Tipo | Requerido | Default | Descripción | | ------------------ | --------------------------- | --------- | --------------------------------------- | --------------------------------------------------------------------- | | checkoutId | string | Sí | — | ID de pago generado en el backend. | | callbackUrl | string | Sí | — | URL de retorno del pago. En modo inline se carga dentro del iframe. | | title | string | No | Información de pago | Título del encabezado. | | description | string | No | Ingresa los datos de tu tarjeta | Texto descriptivo del encabezado. | | rememberCard | boolean | No | false | Muestra el checkbox para recordar tarjeta. | | rememberCardText | string | No | Recordar tarjeta para futuras compras | Etiqueta del checkbox de recordar tarjeta. | | amount | number | No | 0 | Muestra el resumen “Total a pagar” cuando es mayor a 0. | | onReady | () => void | No | — | Callback cuando el widget está listo. | | onError | (error: any) => void | No | — | Callback ante error del widget. | | type | 'redirection' \| 'inline' | No | redirection | Modo de respuesta del pago. inline muestra un iframe. | | availableBrands | string[] | No | ['VISA','MASTER','AMEX'] | Marcas de tarjeta disponibles para el widget. | | config | Omit<WpwlOptions,'style'> | No | — | Opciones avanzadas de WPWL (labels, callbacks, etc). | | isTest | boolean | No | true | Usa el script de entorno de pruebas. |

Ejemplo mínimo

import { Datafast } from '@insoutt/datafast-react';

<Datafast
  checkoutId={checkoutId}
  callbackUrl="https://mi-sitio.com/pago/resultado"
  amount={19.99}
  availableBrands={['VISA', 'MASTER']}
/>;

PaymentButton

Botón que crea el checkout y devuelve checkoutId para renderizar el widget de Datafast. Permite render-prop para personalizar el UI.

Props

| Prop | Tipo | Requerido | Default | Descripción | | -------------- | -------------------------------------------------------------------------- | --------- | ------------------- | ------------------------------------------------- | | url | string | Sí | — | Endpoint backend que crea el checkout. | | checkoutData | CheckoutData | Sí | — | Datos del cliente y carrito enviados al backend. | | onSuccess | (data: { checkoutId: string; }) => void | Sí | — | Se ejecuta cuando el backend retorna el checkout. | | onError | (error: Error) => void | Sí | — | Se ejecuta cuando falla la creación del checkout. | | text | string | No | Pagar con tarjeta | Texto del botón por defecto. | | variant | 'primary' \| 'dark' | No | primary | Estilo visual del botón. | | children | (props: { isLoading: boolean; createCheckout: () => void }) => ReactNode | No | — | Render-prop para UI personalizado. |

CheckoutData incluye customer (datos del cliente) y cart.items (items del carrito).

Para que PaymentButton funcione correctamente, el backend debe responder un JSON usando la siguiente estructura:

{
  "data": {
    "id": "79E1E1EBB41134A257CB8D22280D6BBC.uat01-vm-tx01" // id generado en el backend
  }
}

Uso

import { useState } from 'react';
import { PaymentButton, Datafast } from '@insoutt/datafast-react';

function CheckoutExample() {
  const [checkoutId, setCheckoutId] = useState<string | null>(null);

  return (
    <>
      <PaymentButton
        url="https://mi-backend.com/checkout"
        checkoutData={{
          customer: {
            givenName: 'Juan',
            surname: 'Pérez',
            email: '[email protected]',
            phone: '0999999999',
            identificationDocId: '0102030405',
          },
          cart: {
            items: [
              {
                name: 'Producto A',
                description: 'Descripción',
                val_base0: 0,
                val_baseimp: 19.99,
                val_iva: 2.4,
                quantity: 1,
              },
            ],
          },
        }}
        onSuccess={({ checkoutId }) => setCheckoutId(checkoutId)}
        onError={(error) => console.error(error)}
      />

      {checkoutId && (
        <Datafast
          checkoutId={checkoutId}
          callbackUrl="https://mi-sitio.com/pago/resultado"
        />
      )}
    </>
  );
}

Ejemplo botón de pagos personalizado

import { PaymentButton } from '@insoutt/datafast-react';

<PaymentButton
  url="https://mi-backend.com/checkout"
  checkoutData={checkoutData}
  onSuccess={({ checkoutId }) => console.log('checkoutId', checkoutId)}
  onError={(error) => console.error(error)}
>
  {({ isLoading, createCheckout }) => (
    <button
      onClick={createCheckout}
      disabled={isLoading}
      className="mi-boton-personalizado"
    >
      {isLoading ? 'Procesando...' : 'Pagar ahora'}
    </button>
  )}
</PaymentButton>;

Contact