The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
make invoiceId optional in createPaymentIntent
Steven Tey577236b28264
diff --git a/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts b/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.tsindex 045a3dfa6e..be94710f8f 100644--- a/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts+++ b/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts@@ -82,7 +82,6 @@ export async function processPayoutInvoiceFailure({const { paymentIntent, paymentMethod } = await createPaymentIntent({stripeId: workspace.stripeId,amount: PAYOUT_FAILURE_FEE_CENTS,- invoiceId: invoice.id,description: `Dub Partners payout failure fee for invoice ${invoice.id}`,statementDescriptor: "Dub Partners",});diff --git a/apps/web/lib/stripe/create-payment-intent.ts b/apps/web/lib/stripe/create-payment-intent.tsindex 8535c2b68d..6e97f1afa6 100644--- a/apps/web/lib/stripe/create-payment-intent.ts+++ b/apps/web/lib/stripe/create-payment-intent.ts@@ -11,7 +11,7 @@ export const createPaymentIntent = async ({}: {stripeId: string;amount: number;- invoiceId: string;+ invoiceId?: string; // used for transfer_group (only for partner payouts)description: string;statementDescriptor: string;idempotencyKey?: string;@@ -45,7 +45,7 @@ export const createPaymentIntent = async ({{amount,customer: stripeId,- transfer_group: invoiceId,+ ...(invoiceId ? { transfer_group: invoiceId } : {}),payment_method_types: ["card", "link"],payment_method: paymentMethod.id,currency: "usd",@@ -58,7 +58,7 @@ export const createPaymentIntent = async ({);console.log(- `Payment intent ${paymentIntent.id} created for invoice ${invoiceId} with amount ${currencyFormatter(paymentIntent.amount / 100)}`,+ `Payment intent ${paymentIntent.id} created ${invoiceId ? `for invoice ${invoiceId} ` : ""}with amount ${currencyFormatter(paymentIntent.amount / 100)}`,);return { paymentIntent, paymentMethod };@@ -66,7 +66,7 @@ export const createPaymentIntent = async ({console.error(error);await log({- message: `Failed to create payment intent for the invoice ${invoiceId}.`,+ message: `Failed to create payment intent${invoiceId ? ` for the invoice ${invoiceId}` : ""}. ${JSON.stringify(error, null, 2)}`,type: "errors",mention: true,});