L
L
lightseeker2021-11-11 11:29:21
Payment systems
lightseeker, 2021-11-11 11:29:21

How to handle invoice.payment_* events in Stripe API?

The point is that before these events should use information from the database, but during these webhooks, the information is not yet stored in the database, hence the error.

async handle(event: any): Promise<void> {
    // вот здесь подписка уже должен быть сохранен в базе данных, но webhook срабатывает раньше чем задумано
    const subscription = await this.subscriptionService.getForEvent(
        event.data.object.subscription,
        SUBSCRIPTION_STATUS_PENDING, 
      );
  }


The question is how to deal with it? How to write the logic of this section?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question