diff options
| author | Frank <[email protected]> | 2026-04-18 17:33:26 -0400 |
|---|---|---|
| committer | Frank <[email protected]> | 2026-04-18 17:33:28 -0400 |
| commit | 54b3b3fe05fd66f8f3b479ec438b53d38dbc6d0d (patch) | |
| tree | bcdee7401ce0c10677e8c3fe6674bdc0263eb549 /packages/console/app | |
| parent | 9d012b062186ef9900cc2673b77c446d38ebd789 (diff) | |
| download | opencode-54b3b3fe05fd66f8f3b479ec438b53d38dbc6d0d.tar.gz opencode-54b3b3fe05fd66f8f3b479ec438b53d38dbc6d0d.zip | |
zen: redeem go
Diffstat (limited to 'packages/console/app')
| -rw-r--r-- | packages/console/app/src/routes/stripe/webhook.ts | 7 | ||||
| -rw-r--r-- | packages/console/app/src/routes/workspace/[id]/billing/index.tsx | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/packages/console/app/src/routes/stripe/webhook.ts b/packages/console/app/src/routes/stripe/webhook.ts index 0d8cf61cf..c28d9ebbb 100644 --- a/packages/console/app/src/routes/stripe/webhook.ts +++ b/packages/console/app/src/routes/stripe/webhook.ts @@ -9,6 +9,7 @@ import { Actor } from "@opencode-ai/console-core/actor.js" import { Resource } from "@opencode-ai/console-resource" import { LiteData } from "@opencode-ai/console-core/lite.js" import { BlackData } from "@opencode-ai/console-core/black.js" +import { User } from "@opencode-ai/console-core/user.js" export async function POST(input: APIEvent) { const body = await Billing.stripe().webhooks.constructEventAsync( @@ -109,6 +110,8 @@ export async function POST(input: APIEvent) { if (type === "lite") { const workspaceID = body.data.object.metadata?.workspaceID const userID = body.data.object.metadata?.userID + const userEmail = body.data.object.metadata?.userEmail + const coupon = body.data.object.metadata?.coupon const customerID = body.data.object.customer as string const invoiceID = body.data.object.latest_invoice as string const subscriptionID = body.data.object.id as string @@ -156,6 +159,10 @@ export async function POST(input: APIEvent) { id: Identifier.create("lite"), userID: userID, }) + + if (userEmail && coupon === LiteData.firstMonth100Coupon) { + await Billing.redeemCoupon(userEmail, "GOFREEMONTH") + } }) }) } diff --git a/packages/console/app/src/routes/workspace/[id]/billing/index.tsx b/packages/console/app/src/routes/workspace/[id]/billing/index.tsx index fb4848535..11185436b 100644 --- a/packages/console/app/src/routes/workspace/[id]/billing/index.tsx +++ b/packages/console/app/src/routes/workspace/[id]/billing/index.tsx @@ -25,9 +25,9 @@ export default function () { <Show when={billingInfo()?.customerID}> <ReloadSection /> <MonthlyLimitSection /> + <RedeemSection /> <PaymentSection /> </Show> - <RedeemSection /> </Show> </div> </div> |
