A Ko-fi shop item can hand out a code too - #82
McCal-Codes wants to merge 1 commit into
Conversation
POOLS keeps a shop section for the item's direct_link_code, and the README says how to make the item, price it against a month of Coffee, and check it once by buying it. A code starts its month when it's redeemed, so the item never goes stale in the shop.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18f3176265
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| The least work for the most cover: a shop item anyone can buy, with no membership and no thinking about amounts. | ||
|
|
||
| 1. **Ko-fi › Shop › Add item.** Name it what it is, for example "Folio early access, one month". Price it at $3, the | ||
| same as a month of Coffee, so nobody can buy access cheaper than a member gets it. No shipping, no stock limit. |
There was a problem hiding this comment.
Limit orders to one unit or fulfill every purchased unit
When a buyer orders more than one unit, Ko-fi supplies the count as shop_items[].quantity, but poolFor returns only one pool and the webhook calls claimCode only once per message_id. A two-unit order is therefore charged twice while receiving only one one-month code. The listing must prevent multi-unit orders, or the worker must fulfill the requested quantity.
Useful? React with 👍 / 👎.
| The least work for the most cover: a shop item anyone can buy, with no membership and no thinking about amounts. | ||
|
|
||
| 1. **Ko-fi › Shop › Add item.** Name it what it is, for example "Folio early access, one month". Price it at $3, the | ||
| same as a month of Coffee, so nobody can buy access cheaper than a member gets it. No shipping, no stock limit. |
There was a problem hiding this comment.
Avoid unlimited sales against the finite code pool
When the m1 pool is exhausted, claimCode returns no code and the webhook records a problem and returns 200, so Ko-fi considers the order handled while this unlimited listing remains available. Subsequent buyers can keep paying without receiving the advertised code; the shop availability needs to be bounded or replenishment/fulfillment must prevent sales from continuing after the pool empties.
Useful? React with 👍 / 👎.
| Say so in the item's description: what it opens (the Market, Keyd, Beta Features), that it lasts a month, that Folio | ||
| is free and open source either way, and that the code arrives by email straight after paying. |
There was a problem hiding this comment.
Condition the immediate-email promise on working mail
In the documented supported configuration where RESEND_KEY is omitted, or whenever Resend returns a non-success response, email() returns false and the webhook still responds successfully; the code then requires manual delivery. Telling sellers to promise that it arrives by email immediately after payment is therefore false for those configurations and should be conditional on verified mail setup and delivery handling.
Useful? React with 👍 / 👎.
A shop item is the least work for the most cover: someone buys it, Ko-fi calls the worker, the worker emails a code. No membership, and nobody has to think about amounts.
POOLSinwrangler.tomlkeeps ashopsection, ready for the item'sdirect_link_code.POOLS, deploy, then buy it once to see the whole path.Config and documentation only; the worker's code is unchanged and its tests still pass.