Skip to main content
Two packages, both on npm under the @paywit org: Both use the publishable key and so set the amount client-side. That is fine for a storefront. If the amount decides what you deliver, create the payment on your server with the secret key instead and only hand the checkout URL to the browser.

The button

Clicking creates the payment and opens the hosted checkout in a new tab. Events:
Theme it with CSS variables on the element, for example --paywit-button-bg, --paywit-button-color and --paywit-button-radius. You can also turn any element into a button with data-paywit-* attributes, or call attachPaywitButton(selector, options) from code.

The client

Any non-2xx response throws a PaywitError with status, message and body.
Pin a version and add Subresource Integrity when loading from a CDN in production.