Skip to content
DocsFor version 1.1.x

Sponsorship payments

An optional extra. Steps 1 to 3 already make a complete, working directory. Without this, the Advertise page sells by payment link or email, and you add each placement yourself.

What you get: sponsors book and pay online, and their spot is set up for your approval. They book a place on your Advertise page and pay on Stripe’s checkout page; each paid booking arrives as a draft placement in your repository. Approving it publishes the placement on its start date. A refund in Stripe ends it.

You need:

  • Put your site online and Connect your forms. The contact form must use Formspree, Web3Forms (paid plan) or your own form address, so you’re emailed about each payment.
  • Your site’s GitHub app (Connect GitHub) and the spam check (Automatic submissions). You don’t need to take submissions.
  • The daily rebuild. A booked place starts and ends on its dates only when your site is rebuilt: with online checkout on, npm run doctor and your editor treat a missing or late rebuild as an error.
  • A host that runs functions, on a plan that allows commercial use.
  • A free Stripe account.

Always start in a Stripe sandbox or in Test mode (your account offers one or the other): no real money moves in either (Stripe’s help on sandboxes). Setting up in your browser instead? Start here → Sponsorship payments.

Run npm run setup and choose 5. Sponsorship payments. It asks which Stripe mode (test first), then opens each page on Stripe for the two values your site needs (below), which you paste once each. They show as dots.

It saves both on Cloudflare as secrets, switches the Advertise page to Stripe, and puts it live.

Your site needs two things from Stripe, and they do different jobs:

  • A restricted key lets your site start a checkout when a sponsor books, and refund one you turn down. It can do only the four things below, nothing else in your Stripe account.
  • A signing secret belongs to the webhook: the address Stripe sends a message to when something happens, here your site’s. Stripe signs each “someone paid” message, and your site checks the signature with this secret, so nobody else can pretend a sponsor paid.

In your sandbox (or Test mode):

  1. A restricted key, under Restricted keys (not Standard keys), named after your site (Stripe’s help). Give it these four permissions, and leave everything else as None:

    • Checkout Sessions: Write (to start a checkout when a sponsor books);
    • Refunds: Write (to refund a booking you turn down);
    • PaymentIntents: Read (to match a payment to its booking);
    • Charges: Read (to see a refund or a dispute).

    It starts with rk_test_.

  2. A webhook for your account’s events (Stripe’s help), these six:

    • checkout.session.completed
    • checkout.session.async_payment_succeeded
    • checkout.session.async_payment_failed
    • checkout.session.expired
    • charge.refunded
    • charge.dispute.created

    If Stripe asks for a payload, choose Snapshot. Its type: Webhook endpoint, at https://<your site>/api/advertise/webhook. Once it’s made, its page shows its signing secret, which starts with whsec_.

Both go on your host, each as a Secret:

  • STRIPE_SECRET_KEY ← your restricted key (it starts with rk_test_, or rk_live_). Not your account’s own secret key (sk_…, under Standard keys): it would work, but it can do anything in your Stripe account.
  • STRIPE_WEBHOOK_SECRET ← your webhook’s signing secret (it starts with whsec_).

On Cloudflare Workers, by hand: npx wrangler secret put STRIPE_SECRET_KEY, and the same for the other. In Cloudflare’s dashboard instead, add each as a Secret, never as plain Text, and never copy a key into wrangler.jsonc: Cloudflare suggests that for plain text, and it would put the key in your site’s files on GitHub. As secrets, Cloudflare keeps them encrypted, only your site’s server uses them, and they’re never in your pages or on GitHub.

Check the key’s permissions: sign in to your editor, open Set up your site → Sponsorship payments (/admin/setup.html#sponsorships), and click I’ve added them: check for me. It asks Stripe about each of the four with a harmless request, names any that’s missing, and says whether the key is a test or a live one. A permission missing? Edit your restricted key in Stripe, give it that one, and check again: you don’t need a new key.

  1. The config: in directory.config.json → advertise.checkout, set provider to "stripe". Then check approval ("owner" means you approve each one), leadDays and the packages’ prices.
  2. The label: a sponsorship label in the repository (the setup creates it).
  3. The terms: rewrite the Advertise page’s rules and refund terms in your own words.
  4. Stripe’s email receipts: so each sponsor gets a receipt from Stripe, turn on receipts for successful payments (and refunds) in Stripe (Stripe’s help on receipts). Stripe sends them for live payments only. Your site’s thanks page doesn’t promise one: it gives the sponsor their booking’s reference.
  1. A test booking: book a place on your Advertise page with Stripe’s test card 4242 4242 4242 4242 (any future date, any three digits).
  2. What arrives: a draft placement in your repository labelled sponsorship (in the editor, on the Editorial Workflow board under In Review, with a Sponsored · … badge), a note at the bottom right of your editor, A paid booking is waiting for your approval, with the day to approve it by, and an email to you, sent through your contact form’s service. No email? Look in your form’s Spam folder in Formspree the first time.
  3. Approving it shows the placement on its start date.
  4. A full refund in Stripe’s Dashboard ends the placement.
  5. Go live: run the setup’s Sponsorship payments again, and choose Live mode, with live keys (rk_live_… and a live-mode webhook’s secret).

Run npm run doctor. If Stripe shows the webhook failing, the reason is in your host’s logs, in lines that start [advertise].

These docs describe SixtyList 1.1.x.