The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
remove payment_method.attached
Steven Tey5868a2266fc4
diff --git a/apps/web/app/api/stripe/webhook/payment-method-attached.ts b/apps/web/app/api/stripe/webhook/payment-method-attached.tsdeleted file mode 100644index 581fddb969..0000000000--- a/apps/web/app/api/stripe/webhook/payment-method-attached.ts+++ /dev/null@@ -1,19 +0,0 @@-import { prisma } from "@dub/prisma";-import Stripe from "stripe";--export async function paymentMethodAttached(event: Stripe.Event) {- const { id, customer, type } = event.data.object as Stripe.PaymentMethod;-- if (type !== "us_bank_account") {- return;- }-- await prisma.project.update({- where: {- stripeId: customer as string,- },- data: {- payoutMethodId: id,- },- });-}diff --git a/apps/web/app/api/stripe/webhook/route.ts b/apps/web/app/api/stripe/webhook/route.tsindex cd673e08f9..e4fd4d2ca6 100644--- a/apps/web/app/api/stripe/webhook/route.ts+++ b/apps/web/app/api/stripe/webhook/route.ts@@ -7,11 +7,9 @@ import { checkoutSessionCompleted } from "./checkout-session-completed";import { customerSubscriptionDeleted } from "./customer-subscription-deleted";import { customerSubscriptionUpdated } from "./customer-subscription-updated";import { invoicePaymentFailed } from "./invoice-payment-failed";-import { paymentMethodAttached } from "./payment-method-attached";const relevantEvents = new Set(["charge.succeeded",- "payment_method.attached","checkout.session.completed","customer.subscription.updated","customer.subscription.deleted",@@ -45,9 +43,6 @@ export const POST = async (req: Request) => {case "charge.succeeded":await chargeSucceeded(event);break;- case "payment_method.attached":- await paymentMethodAttached(event);- break;case "checkout.session.completed":await checkoutSessionCompleted(event);break;diff --git a/packages/prisma/schema/workspace.prisma b/packages/prisma/schema/workspace.prismaindex 3963892aa8..5e3fd83821 100644--- a/packages/prisma/schema/workspace.prisma+++ b/packages/prisma/schema/workspace.prisma@@ -10,7 +10,7 @@ model Project {billingCycleStart Int // day of the month when the billing cycle startspaymentFailedAt DateTime?stripeConnectId String? @unique // for Stripe Integration- payoutMethodId String? // for Stripe Connect payouts+ payoutMethodId String? // for Stripe Connect payouts (TODO: remove soon)shopifyStoreId String? @unique // for Shopify IntegrationinvoicePrefix String? @unique // The prefix for the customer used to generate unique invoice numbers