fix: log event data for payment_intent.created in stripe webhook handler

This commit is contained in:
Marco Pedone 2026-02-24 14:06:47 +01:00
parent 70736e4aa1
commit baf92787a7
2 changed files with 19 additions and 11 deletions

View file

@ -38,6 +38,7 @@ const handler = async (
// Handle the event
switch (event.type) {
case "payment_intent.created": {
console.log("PaymentIntent failed", event.data);
const paymentIntent = event.data.object;
const { id, metadata } = paymentIntent;

View file

@ -85,6 +85,7 @@ export const whIntentCreatedHandler = async ({
paymentId: PaymentsId;
pm_id: string;
}) => {
try {
const paymentMethod = await stripe.paymentMethods.retrieve(pm_id);
return await db
.updateTable("payments")
@ -96,6 +97,12 @@ export const whIntentCreatedHandler = async ({
.where("id", "=", paymentId)
.returning("id")
.execute();
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: `Error whIntentCreatedHandler: ${(error as Error).message}`,
});
}
};
export const whIntentSucceededHandler = async ({