Spaces:
Paused
Paused
File size: 633 Bytes
1fe7075 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import { Controller, HttpCode, Post, UseGuards } from '@nestjs/common';
import type Stripe from 'stripe';
import { StripeEvent } from './stripe-event.decorator.js';
import { StripeWebhookGuard } from './stripe-webhook.guard.js';
import { WebhooksService } from './webhooks.service.js';
@Controller('webhooks')
export class WebhooksController {
constructor(private readonly webhooks: WebhooksService) {}
@Post('stripe')
@HttpCode(200)
@UseGuards(StripeWebhookGuard)
async stripe(@StripeEvent() event: Stripe.Event): Promise<{ received: true }> {
await this.webhooks.handle(event);
return { received: true };
}
}
|