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.

reorder ach

Steven Tey1ab99ce15a3f
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 014fe0f9ac..31706ff8a0 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
@@ -15,7 +15,15 @@ export const GET = withWorkspace(async ({ workspace }) => {
customer: workspace.stripeId,
});
- return NextResponse.json(paymentMethods.data);
+ // reorder to put ACH first
+ const ach = paymentMethods.data.find(
+ (method) => method.type === "us_bank_account",
+ );
+
+ return NextResponse.json([
+ ach,
+ ...paymentMethods.data.filter((method) => method.id !== ach?.id),
+ ]);
} catch (error) {
console.error(error);
return NextResponse.json([]);