Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update route.ts

Kiran K697a4d880103
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts
index a9505268db..d7242eb6e6 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts
@@ -5,6 +5,11 @@ import { APP_DOMAIN } from "@dub/utils";
import { NextResponse } from "next/server";
import { z } from "zod";
+const addPaymentMethodSchema = z.object({
+ method: z.enum(["card", "us_bank_account"]).optional(),
+});
+
+// GET /api/workspaces/[idOrSlug]/billing/payment-methods - get all payment methods
export const GET = withWorkspace(async ({ workspace }) => {
if (!workspace.stripeId) {
return NextResponse.json([]);
@@ -30,10 +35,7 @@ export const GET = withWorkspace(async ({ workspace }) => {
}
});
-const addPaymentMethodSchema = z.object({
- method: z.enum(["card", "us_bank_account"]).optional(),
-});
-
+// POST /api/workspaces/[idOrSlug]/billing/payment-methods - add a payment method for the workspace
export const POST = withWorkspace(async ({ workspace, req }) => {
if (!workspace.stripeId) {
return NextResponse.json({ error: "Workspace does not have a Stripe ID" });