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

@bob-payments/sdk

v2.0.0

Published

SDK oficial Node.js/TypeScript da API Bob Payments (PIX)

Readme


Instalação

pnpm add @bob-payments/sdk
# npm install @bob-payments/sdk · yarn add @bob-payments/sdk

Server-side only — a API key sk_live_/sk_test_ é secreta e nunca deve ir para o browser.

Comece em 30 segundos

import { BobPayments } from '@bob-payments/sdk';

const bob = new BobPayments({ apiKey: process.env.BOB_API_KEY! });

const tx = await bob.transactions.create({
  customer: {
    name: 'João Silva',
    document: '12345678901',
    documentType: 'CPF',
    email: '[email protected]',
    address: { street: 'Rua das Flores', streetNumber: '123', neighborhood: 'Centro', zipCode: '01310-100', city: 'São Paulo', state: 'SP' },
  },
  payment: { amountCents: 10_000, product: 'Assinatura Pro' }, // R$ 100,00 — sempre centavos
  originDomain: 'loja.example.com',
});

console.log(tx.pixCode); // PIX copia-e-cola, pronto para o comprador

Recebendo a confirmação de pagamento (webhook):

import { constructWebhookEvent } from '@bob-payments/sdk';

// ⚠️ use o corpo BRUTO da request (ex.: express.raw()) — nunca o JSON re-serializado
const event = constructWebhookEvent(rawBody, req.headers['x-webhook-signature'], webhookSecret);

if (event.event === 'transaction.paid') {
  liberarPedido(event.data.transactionId); // v2: event.data.amountCents
}

Por que este SDK

| | | |---|---| | 🪶 Zero dependências | fetch nativo + node:crypto. Nada para conflitar com o seu lockfile. | | 🔁 Idempotência automática | Todo create envia Idempotency-Key e faz retry seguro em timeout/rede/5xx — sem risco de PIX duplicado. | | 🔐 Webhooks verificados | Assinatura HMAC em tempo constante, com proteção anti-replay (payload v2). | | 🧪 Sandbox de verdade | sk_test_ + gateway Bob Sandbox: pague, expire ou deixe pendente controlando os centavos do valor. | | 🇹 TypeScript first | Tipos completos do contrato da API, ESM + CJS. | | ⚠️ Erros úteis | BobPaymentsApiError com os campos RFC 7807 da API (status, code, detail, retryAfterSeconds). |

Documentação

A referência completa vive em docs.payments.bob.company:

| Guia | O que você encontra | |---|---| | Primeiros passos | API keys, ambientes live/sandbox, primeira cobrança | | Transações | create / get / list, filtros, idempotência, HTTP 202 | | Checkout hospedado | Sessões de checkout, redirect, polling de status | | Webhooks | Eventos, verificação de assinatura, payload v1 vs v2 | | Sandbox | Valores mágicos e fluxo de teste ponta a ponta | | Erros | Catálogo de códigos e como tratar cada um |

Desenvolvimento

pnpm install && pnpm test   # vitest · pnpm typecheck · pnpm build

Releases são automatizadas por semantic-release — commits Conventional Commits na main geram versão, CHANGELOG e GitHub Release. Publish no npm ativa com o secret NPM_TOKEN + npmPublish: true no .releaserc.json.