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.

only pass chargeId for card payouts

Steven Teya7ebd01c4023
diff --git a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/queue-stripe-payouts.ts b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/queue-stripe-payouts.ts
index 957b1ebe3a..96044eb23a 100644
--- a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/queue-stripe-payouts.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/queue-stripe-payouts.ts
@@ -9,9 +9,9 @@ const stripeChargeMetadataSchema = z.object({
});
export async function queueStripePayouts(
- invoice: Pick<Invoice, "id" | "stripeChargeMetadata">,
+ invoice: Pick<Invoice, "id" | "paymentMethod" | "stripeChargeMetadata">,
) {
- const { id: invoiceId, stripeChargeMetadata } = invoice;
+ const { id: invoiceId, paymentMethod, stripeChargeMetadata } = invoice;
// Find the id of the charge that was used to fund the transfer
const parsedChargeMetadata =
@@ -51,7 +51,11 @@ export async function queueStripePayouts(
body: {
invoiceId,
partnerId,
- chargeId,
+ // only pass chargeId if payment method is card
+ // this is because we're passing chargeId as source_transaction for card payouts since card payouts can take a short time to settle fully
+ // we omit chargeId/source_transaction for other payment methods (ACH, SEPA, etc.) since those settle via charge.succeeded webhook after ~4 days
+ // x-slack-ref: https://dub.slack.com/archives/C074P7LMV9C/p1758776038825219?thread_ts=1758769780.982089&cid=C074P7LMV9C
+ ...(paymentMethod === "card" && { chargeId }),
},
});
console.log(
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/payouts/payout-stats.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/payouts/payout-stats.tsx
index 9eb1b0af51..b1f4641021 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/payouts/payout-stats.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/payouts/payout-stats.tsx
@@ -13,7 +13,7 @@ import { PayoutStatusBadges } from "@/ui/partners/payout-status-badges";
import { PAYOUT_STATUS_DESCRIPTIONS } from "@/ui/partners/payout-status-descriptions";
import { AlertCircleFill } from "@/ui/shared/icons";
import { PayoutStatus } from "@dub/prisma/client";
-import { Tooltip } from "@dub/ui";
+import { Button, Tooltip } from "@dub/ui";
import {
cn,
CONNECT_SUPPORTED_COUNTRIES,
@@ -92,14 +92,14 @@ function PayoutStatsCard({
<>{amount > 0 ? currencyFormatter(amount / 100) : "$0.00"}</>
)}
</span>
- {/* {label === "Processed" && amount > 0 && (
+ {label === "Processed" && amount > 0 && (
<Button
variant="secondary"
text="Pay out now"
className="ml-2 h-7 px-2 py-1"
onClick={() => setShowForceWithdrawalModal(true)}
/>
- )} */}
+ )}
</div>
) : (
<div className="h-5 w-20 animate-pulse rounded bg-neutral-200 sm:h-7 sm:w-24" />