Skip to content

Commit

Permalink
troubleshoot stripe event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dallen4 committed Sep 23, 2023
1 parent 745a0ed commit bc20088
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions web/api/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const client = new Stripe(process.env.STRIPE_SECRET_KEY!, {
});

export function buildEvent(request: NextApiRequest) {
console.log(request.headers)
const sig = request.headers['stripe-signature']!;

const event = client.webhooks.constructEvent(
Expand Down
3 changes: 2 additions & 1 deletion web/pages/api/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default async function stripeWebhook(
res: NextApiResponse,
) {
await runMiddleware(req, res, cors);

console.log('BUILDING EVENT')
console.log(req);
const event = buildEvent(req);

if (event.type === 'checkout.session.completed') {
Expand Down

0 comments on commit bc20088

Please sign in to comment.