Skip to content

Feedback wanted: event notification handlers #1835

Description

@xavdid

Feedback wanted: event notification handlers

BLUF: we're piloting a better way to handle events from Stripe and are looking for feedback before it goes GA.


We're iterating on a new and improved way to handle events from Stripe. This project is currently focused on thin events. If you're not yet using thin events in your integration, you can still try some out in a sandbox or use this form to get access to thin events for v1 resources. There's also additional information about the project in this blog post announcing the feature.

The tldr is that we provide a class that handles the verification, parsing, and routing of incoming thin events. All you need to do is provide & register functions that we'll call when the corresponding event arrives. This approach gives much more feedback when building an event destination (e.g. compiler errors instead of runtime errors) and lets you focus more on your business logic.

Prerequisites

These new classes are currently only available in preview SDKs. You need to be on at least one of these versions:

  • public preview (a.k.a beta): v14.2.0b1 or higher
  • private preview: v15.2.0a3 or higher

Setup

There's a step-by-step implementation guide on our docs and a full code example in the repo (on the beta branch).

You'll need to use an instance of StripeClient (docs), which you can use separate from your existing integration (if you're not using it already).

In general, the flow is:

  1. instantiate a StripeClient
  2. in the dashboard, create a thin event destination
  3. in your code, use that client and your webhook secret to instantiate a handler
  4. write a function that takes an event type and does something specific to your business (updates a database row, logs something, etc)
  5. on the handler, call the corresponding .onSomeEvent(...) function to register the callback
  6. in your framework's HTTP endpoint, call handler.handle(...) with the incoming POST body and webhook signature

Feedback

While we're confident in the overall approach, we want to ensure everything feels good to use.

We're open to any feedback you're willing to provide. We also have some questions to get you started, but don't feel like you can only (or have to) answer them. Feel free to copy this block to start your answer:

### How was the in-editor experience of authoring a notification handler?

...

### Do you feel like you had sufficient tools to unit test your handler?

...

### If/when your integration is fully migrated to thin events, do you anticipate using a notification-handler based approach? why or why not?

...

### Anything else?

...

Thank you for taking a look! We're excited to bring these to everyone later this year.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions