0

My current setup: I have a Stripe webhook that listens for checkout success events. After payment success, my koa.js server will fire off a async task that does more processing and immediately returns status 200 to Stripe. Stripe would redirect the user to the /payment_success endpoint.

Here's what I want to achieve: Once the async task finishes, I would like to notify the user (who should be waiting on /payment_success) about the status of this task.

Here's how I plan on implementing this:

  1. In the /success handler on the server, I would create a redis subscriber that listens for a task completion event using redis streams. The topic would be based on the customer id. Once this event happens, I would send a Server Sent Event to the client.
  2. The async task would publish the task completion event to redis streams once it finishes.

My questions are:

  1. How would you design the system to satisfy the requirements?
  2. Is there anything you would change about my design?
varimax
  • 111
  • 1
  • 13
  • For Step 1. You can listen to Stripe Webhook[1]. If you are using Stripe Checkout you can listen to checkout.session.completed. Also depending on the payload of your events you can choose between RabbitMq or Kafka, they could be good options too. Also you can set a push notification system to your frontend in order to notify your Customer once the async task is finished. [1] https://stripe.com/docs/payments/checkout/fulfill-orders – os4m37 Feb 10 '23 at 09:11

0 Answers0