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

@montte/hyprpay

v0.1.6

Published

HyprPay SDK — sincronize o ciclo de vida de clientes com o Montte

Readme

@montte/hyprpay

SDK TypeScript para o HyprPay — gerencie o ciclo de vida de clientes com um cliente type-safe e baseado em resultados. Inclui plugin para Better Auth com criação automática de clientes no signup.

Instalação

npm install @montte/hyprpay
# ou
bun add @montte/hyprpay

Uso

Cliente

import { createHyprPayClient } from "@montte/hyprpay";

const client = createHyprPayClient({
  apiKey: process.env.HYPRPAY_API_KEY!,
});

Todos os métodos retornam ResultAsync do neverthrow — erros são tipados e nunca lançados.

Clientes

// Criar
const result = await client.customers.create({
  name: "Maria Silva",
  email: "[email protected]",
  phone: "11999999999",
  document: "12345678901",
  externalId: "user_abc123",       // ID do usuário no seu sistema
});

if (result.isErr()) {
  console.error(result.error.code); // "BAD_REQUEST" | "CONFLICT" | ...
} else {
  console.log(result.value.id);
}

// Buscar por ID externo
const customer = await client.customers.get("user_abc123");

// Listar
const listResult = await client.customers.list({ page: 1, limit: 20 });
const { items, total, pages } = listResult.unwrapOr({
  items: [], total: 0, page: 1, limit: 20, pages: 0,
});

// Atualizar
const updated = await client.customers.update("user_abc123", {
  name: "Maria Santos",
  email: null,       // passe null para limpar o campo
});

Tratamento de Erros

import { HyprPayError } from "@montte/hyprpay";

const result = await client.customers.get("id-desconhecido");

result.match(
  (customer) => console.log(customer),
  (error) => {
    if (error.code === "NOT_FOUND") {
      // tratar 404
    }
    console.error(error.code, error.statusCode, error.message);
  }
);

| Code | Status | Quando ocorre | |------|--------|---------------| | UNAUTHORIZED | 401 | Chave inválida ou ausente | | FORBIDDEN | 403 | Sem permissão | | NOT_FOUND | 404 | Cliente não encontrado | | BAD_REQUEST | 400 | Dados inválidos | | CONFLICT | 409 | Cliente já existe | | TOO_MANY_REQUESTS | 429 | Rate limit excedido | | INTERNAL_ERROR | 500 | Erro interno do servidor | | NETWORK_ERROR | 0 | Falha de rede | | TIMEOUT | 0 | Timeout na requisição |

Plugin Better Auth

Cria clientes no HyprPay automaticamente no signup.

Servidor

import { betterAuth } from "better-auth";
import { hyprpay } from "@montte/hyprpay/better-auth";

export const auth = betterAuth({
  plugins: [
    hyprpay({
      apiKey: process.env.HYPRPAY_API_KEY!,
      createCustomerOnSignUp: true,

      // opcional: customize os dados enviados ao HyprPay
      customerData: (user) => ({
        name: user.name,
        email: user.email,
        externalId: user.id,
      }),

      // opcional: execute lógica após o cliente ser criado
      onCustomerCreate: async (customer, user) => {
        console.log(`Cliente HyprPay ${customer.id} criado para ${user.email}`);
      },
    }),
  ],
});

O plugin intercepta /sign-up/email, /sign-up/email-otp e /sign-in/magic-link. Falhas na criação do cliente são logadas mas nunca bloqueiam o fluxo de autenticação.

Cliente

import { createAuthClient } from "better-auth/client";
import { hyprpayClient } from "@montte/hyprpay/better-auth";

export const authClient = createAuthClient({
  plugins: [hyprpayClient()],
});

Tipos

import type {
  HyprPayClient,
  HyprPayClientConfig,
  HyprPayCustomer,
  HyprPayListResult,
  CreateCustomerInput,
  UpdateCustomerInput,
  ListCustomersInput,
} from "@montte/hyprpay";

URL Base Customizada

const client = createHyprPayClient({
  apiKey: process.env.HYPRPAY_API_KEY!,
  baseUrl: "https://sua-instancia.example.com",
});