Skip to content

Pybara.js

@pybara/pybara-js is Pybara’s browser SDK for donations — the package an AI site builder or a developer reaches for when the words are “add Pybara to my donation form”. In the convention of stripe-js and paypal-js, it exposes a brand-level object with a verb: Pybara.checkout(config) returns a checkout, and checkout.open(payment) opens Pybara Wallet’s checkout frame over your page.

Your page keeps its own DOM — amount selector, the list of ways to give, form fields. The rendered checkout itself (sign-in, token choice, confirm, success) is served by the wallet inside the frame, the same way Stripe’s Payment Element or PayPal’s buttons are served remotely.

You want Package
A donation button/section, ready-made @pybara/donate-widget — a complete form, no UI work
Donations inside your own form, or from your own Donate button @pybara/pybara-js — you own the layout, Pybara owns the checkout
WordPress / WooCommerce The plugins — no code at all

The donate widget is a product built on the same checkout — for a “Support us” section it is the faster path. This SDK is for donation forms you already have: one with PayPal or Stripe beside it, a custom donation flow, or a plain Donate button.

Terminal window
npm install @pybara/pybara-js
import { Pybara } from '@pybara/pybara-js';

Both start the same way: Pybara.checkout() binds the site once, then the page either draws a Pybara button or opens the checkout from its own.

const pybara = Pybara.checkout({ siteUrl, siteName, recipientPrincipal, currency: 'EUR' });
Your donation form has… Use
PayPal or other payment methods .buttons() — a Pybara button, served by Pybara, matching PayPal’s style and following availability by itself. See Pybara next to PayPal.
A Donate button of its own .open() — the checkout opens from your button’s click; with no amount, it asks the donor. See Your own Donate button.

Until the site is set up in Pybara Wallet, open() refuses with GATE_REFUSED, and a buttons() button stays hidden, saying in the console which step is missing: a _pybara-payto DNS record listing the wallet, and the Pybara Terms of Service accepted. Both are the site owner’s steps in the wallet — see Setup.