Skip to content

feat(billing): restrict Rewardful commissions to KiloClaw purchases#1037

Open
jeanduplessis wants to merge 3 commits intomainfrom
jdp/rewardful
Open

feat(billing): restrict Rewardful commissions to KiloClaw purchases#1037
jeanduplessis wants to merge 3 commits intomainfrom
jdp/rewardful

Conversation

@jeanduplessis
Copy link
Contributor

Summary

Restricts Rewardful affiliate commissions to KiloClaw purchases only by adding rewardful: 'false' to Stripe metadata on all non-KiloClaw checkout sessions. Also fixes the referral cookie max-age to 60 days (5184000s) to match the affiliate program T&Cs.

Changes:

  • Cookie duration: max-age corrected from 90 days to 60 days in the Rewardful inline script (layout.tsx)
  • Commission suppression: Added rewardful: 'false' to payment_intent_data.metadata (payment-mode) or subscription_data.metadata (subscription-mode) on 5 checkout flows: credit top-ups, auto top-up setup, org auto top-up setup, org seat subscriptions, and Kilo Pass subscriptions
  • KiloClaw earlybird checkout is unchanged — commissions apply there as intended
  • Added rewardful as an optional field to StripeTopupMetadata to satisfy the existing satisfies check

Verification

  • pnpm typecheck — passes

Visual Changes

N/A

Reviewer Notes

  • Per Rewardful docs, rewardful: 'false' in Stripe metadata on Customer, Subscription, Invoice, or Charge causes Rewardful to skip commission. For payment-mode checkouts, payment_intent_data.metadata flows to the Charge; for subscription-mode, subscription_data.metadata flows to both Subscription and Invoices.
  • The client_reference_id is still passed on all checkouts (including non-KiloClaw ones) so Rewardful can link the customer to the affiliate for attribution tracking — the metadata flag only suppresses the commission payout.

Add rewardful: 'false' metadata to all non-KiloClaw Stripe checkout
sessions (top-ups, auto top-ups, seats, Kilo Pass, org auto top-ups)
so Rewardful skips commission on those payments.

Also fix cookie max-age to 60 days (5184000s) matching the affiliate
program T&Cs.
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 11, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

No new inline issues on diff lines.

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
src/routers/kilo-pass-router.ts 766 scheduleChange() builds phase metadata without rewardful: 'false', so scheduled Kilo Pass plan changes can drop the Rewardful skip flag and make later renewals commissionable again.
Files Reviewed (5 files)
  • src/app/layout.tsx - 0 issues
  • src/lib/organizations/organization-auto-top-up.ts - 0 issues
  • src/lib/stripe.ts - 0 issues
  • src/routers/kilo-pass-router.test.ts - 0 issues
  • src/routers/kilo-pass-router.ts - 1 issue

Reviewed by gpt-5.4-20260305 · 924,513 tokens

Rewardful checks Customer, Subscription, Invoice, or Charge metadata
for the rewardful=false flag — not PaymentIntent metadata. For
payment-mode checkout sessions, move the flag from
payment_intent_data.metadata to invoice_creation.invoice_data.metadata
so it lands on the Invoice object that Rewardful actually inspects.
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.

1 participant