Version 0.2.0
Install Vendwick
Vendwick is a native EmDash plugin. It isn't on the public npm registry: you download a tarball with your license and install it into your EmDash project.
Requirements
Before you start
- An EmDash site on Cloudflare Workers with a D1 database. Vendwick 0.2.0 needs EmDash 1.5 or later and Astro 7.4.12 or later.
- A private R2 bucket for releases and downloads. Never your public media bucket.
EMDASH_ENCRYPTION_KEYset as a secret. EmDash uses it to encrypt gateway keys and webhook secrets.- An email provider plugin, so receipts, license keys and sign-in links are sent.
- A Vendwick license from gauravtiwari.org/product/vendwick.
Step 01
Download the tarball
Sign in to your account at gauravtiwari.org and downloadgatilab-emdash-vendwick-0.2.0.tgz. Check it against the SHA-256 published with the release:
shasum -a 256 gatilab-emdash-vendwick-0.2.0.tgzFor 0.2.0 the command should print 12ded0b85ea5eb4e37141035da03379a52c7b2b727c363e79d850de9de37d2a7.
Step 02
Add it to your project
Keep the tarball in your project, then install from that file.
mkdir -p vendor
cp ~/Downloads/gatilab-emdash-vendwick-0.2.0.tgz vendor/
pnpm add ./vendor/gatilab-emdash-vendwick-0.2.0.tgznpm works too:
npm install ./vendor/gatilab-emdash-vendwick-0.2.0.tgzStep 03
Register the plugin and the companion integration
Both go in astro.config.mjs.
import { vendwick } from "@gatilab/emdash-vendwick";
import { vendwickSite } from "@gatilab/emdash-vendwick/site";
const site = "https://store.example.com";
// The plugin (emails, links) and the companion (pages) must agree on these paths.
const paths = { checkoutPath: "/checkout/", portalBase: "/account/", productBase: "/products/" };
export default defineConfig({
site,
output: "server",
integrations: [
emdash({
// database, storage and adapter as your EmDash site already has them
plugins: [vendwick({ siteUrl: site, ...paths })],
}),
vendwickSite({ ...paths, termsUrl: "/terms/", privacyUrl: "/privacy/" }),
],
});vendwick() is the EmDash plugin; vendwickSite() serves what plugin routes can't: the store pages, cookies, file downloads and payment redirects.
Step 04
Add the R2 bucket and the cron trigger
Both go in wrangler.jsonc.
{
"r2_buckets": [{ "binding": "VENDWICK_PRIVATE", "bucket_name": "your-private-bucket" }],
"triggers": { "crons": ["*/5 * * * *"] }
}Step 05
Deploy
Build and deploy as usual. On a brand-new D1 database, run the EmDash migrations before the first request.
The first request after adding Vendwick can take about a minute once, while EmDash creates the plugin's storage indexes.
Step 06
Check it and enter your license
https://your-site/_vendwick/healthshould answer.- In the EmDash admin, open Store overview. It shows whether email, scheduled tasks and private file storage are available.
- Enter your license key on the Vendwick license page, under Store settings. Without a valid license the store keeps selling, but you see a notice and update information stops.
Step 07
Set up your store
- Run the setup wizard from the Store overview. Its 6 steps are store basics, payments, tax, a first product, a test purchase and going live, and any step can be skipped.
- Stay in test mode and add gateway keys on the Payments page (Stripe, PayPal, Razorpay, Polar), test keys first. The test gateway completes a purchase with no provider account.
- Add each provider's webhook:
https://your-site/_vendwick/webhook/<provider>. Turn on every event the documentation lists for that provider, including the refund and dispute events. - Create a product and a plan, upload a release, and buy it yourself in test mode before going live.
Run a test-mode purchase, renewal and refund with each provider you use before you take money.
Later
Updating
Download the new tarball, replace the file in vendor/, run the command below, then build and deploy.
pnpm add ./vendor/<new file>Updating from 0.1.0
- Upgrade EmDash to 1.5 first. Vendwick 0.2.0 does not run on EmDash 1.4.
- After the update, an admin confirms the new capabilities and approves Vendwick's tools again.
- Each gateway needs its new refund and dispute webhook events turned on in the provider's dashboard.
Reference