Install
Install Buyblock from npm in three steps, about five minutes. The free plan needs no account or key.
- Install the package in your site’s folder:
npm 7 or later also installs the peer packages it needs (React, Kumo and Phosphor icons), which an EmDash site already has.npm install @zachristudio/buyblock-paypal - Register it in
astro.config.mjs:import { defineConfig } from "astro/config"; import react from "@astrojs/react"; import emdash from "emdash/astro"; import { paypalPlugin } from "@zachristudio/buyblock-paypal"; export default defineConfig({ integrations: [ react(), emdash({ // your database and storage settings plugins: [paypalPlugin()], }), ], }); - Restart or redeploy. Buyblock appears in the admin sidebar. Then set up PayPal.
From the EmDash registry
Searching the registry for “PayPal” finds Buyblock: Payments & Buy Buttons for PayPal. That entry is a setup guide: installing it adds a Buyblock setup page to your admin with these same steps. Buyblock itself always comes from npm, because payment buttons on public pages need a trusted plugin. You can uninstall the guide once Buyblock is running.
Layout components
None needed. The PayPal button block renders through EmDash’s Portable Text on its own.
Hosting
Nothing extra to configure: the package is public, so every host installs it like any other dependency. Commit package.json and your lockfile, then deploy as usual on Cloudflare, Vercel, Netlify or your own Node server.
Updating
npm install @zachristudio/buyblock-paypal@latest
Then redeploy. Products, orders and settings carry over. Check the changelog first.
Slow admin in development
If the admin sits on “Loading EmDash” in astro dev, pre-bundle the admin’s UI libraries. Production builds aren’t affected.
export default defineConfig({
vite: {
optimizeDeps: { include: ["@cloudflare/kumo", "@phosphor-icons/react"] },
},
// …
});