Skip to content

feat(affiliate): attribute verified payment conversions across plugins - #366

Merged
olliethedev merged 4 commits into
mainfrom
feat/issue-346-integration
Nov 6, 2026
Merged

olliethedev merged 4 commits into
mainfrom
feat/issue-346-integration

Conversation

@olliethedev

Copy link
Copy Markdown
Collaborator

Summary

browser referral → private checkout snapshot → verified paid webhook
                                            → idempotent Affiliate commission

Capture referral identifiers during Ecommerce checkout, School paid enrollment and Calendar paid booking. Affiliate-owned typed hooks use the stored payment snapshot after signature and payment matching; Ecommerce revenue is subtotal minus discount, excluding tax and shipping. Generated stacks compose Affiliate and Analytics callbacks when both are selected.

Closes #346.

Evidence

  • Before: three real HTTP referral-to-checkout regressions fail because the click is not retained for the later webhook. After: signed webhook tests create one commission, reject invalid signatures, retry failed observers, preserve original prices and handle School completion before the retry.
  • Passed 290 targeted tests across Affiliate, Ecommerce, School, Calendar and CLI; affected typechecks, dependency/owner builds, docs build, registry generation and Biome. Full local suite is left to CI.
  • Exact built npm archives pass eight ESM/CommonJS HTTP cases, 36 generated backend declaration checks across all three frameworks, nine Affiliate/Analytics callback compositions and four standalone import cases. Matching archive integrity and source commits are recorded. Untouched Media, Form Builder and Newsletter use actual published 1.0 packages; changed owners and Core/CMS/Analytics/CLI use unpublished candidate archives.
  • The School retry test now requires a published lesson, completed enrollment before retry and callback states enrolled → completed, with one commission. Its earlier incomplete local proof is explicitly preserved as superseded. Local payment-provider network calls are mocked; the memory database, HTTP handlers, signed payload verification and public package APIs execute.

Merge Danger

Door: two-way

Attribution stays in existing private payment JSON, with no new database column. Existing pending checkouts without captured attribution retain that absence. Source plugins remain independently installable. Prepared Affiliate 1.1, Ecommerce 1.1, School 2.1 and Calendar 1.2 match the generated hook APIs; Core and CLI remain 6.1. Package publication is outside this change.

Blast Radius: checkout

Touches capture, payment recovery and paid-hook context for the three payment owners, plus optional generated configuration. Final refresh must preserve concurrent authoring changes and reconcile their overlapping unpublished release notes.

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
better-stack-docs Ready Ready Preview Nov 6, 2026 2:49pm UTC
better-stack-playground Ready Ready Preview Nov 6, 2026 2:49pm UTC

Request Review

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact candidate ceee9307765cf0e95cf5f83c7c6af22110fc6a8c on merged payments 0c17e00e. Local standards/spec and required Safeguard security review are clear. Real referral → checkout → signed payment → commission tests pass, including actual course completion before a retry; both JavaScript module formats and all three generated backends pass built-package checks. Fresh exact-head CI/deployments are pending. Parent will coordinate the final refresh with concurrent authoring PRs and retains merge authority.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T14:51:03.689227Z ceee930 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: ceee930776

ℹ️ 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".

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Bundle size

7 of 195 bundles changed.

Module Gzip base → PR Gzip change Minified change
@btst/codegen 1637353 → 1637653 B +300 B (+0.0%) +714 B (+0.0%)
@btst/plugin-affiliate/api 106280 → 106565 B +285 B (+0.3%) +838 B (+0.2%)
@btst/codegen/lib 51207 → 51440 B +233 B (+0.5%) +678 B (+0.4%)
@btst/plugin-calendar/api 106088 → 106201 B +113 B (+0.1%) +148 B (+0.0%)
@btst/plugin-ecommerce/api 109964 → 110032 B +68 B (+0.1%) +347 B (+0.1%)
@btst/plugin-school/api 107877 → 107924 B +47 B (+0.0%) +142 B (+0.0%)
@btst/codegen/meta 6820 → 6825 B +5 B (+0.1%) 0 B (0.0%)

0c17e00 → ceee930. Standalone costs; rows overlap. Moved paths appear as new/removed entries, not application savings.

Measured 22 packed archives separately; full report includes their compressed bytes without installed dependencies.

Full report and measurements

@olliethedev
olliethedev merged commit ff1409a into main Nov 6, 2026
62 checks passed

This branch was successfully deployed

2 active deployments
Preview – better-stack-docs — ceee9307 Deployed Nov 6, 2026 by vercel[bot]
Preview – better-stack-playground — ceee9307 Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Affiliate: conversion attribution bridge across Ecommerce, School, and Calendar + CLI auto-wiring

1 participant