Skip to content

Conversation

@vincent-pochet
Copy link
Collaborator

Context

Some PaymentProviders::Stripe::RegisterWebhookJob are failing with a Stripe::AuthenticationError error.
The error message is:

This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys.

Since this error cannot be handled by Lago, but must be addressed by the Lago organization admin, we need to inform the admin about it by sending a webhook and silent the error.

Description

The PR refactors the stripe webhook endpoint creation by:

  • Moving the registration logic from the generic PaymentProviders::StripeService into a dedicated PaymentProviders::Stripe::RegisterWebhookService
  • Handling Stripe::AuthenticationError
    • Delivering a payment_provider.error
    • Returning an empty result

@vincent-pochet vincent-pochet force-pushed the fix-register-webhook-stripe-errors branch from eb2d444 to f1a424f Compare May 14, 2024 07:33
Copy link
Contributor

@julienbourdeau julienbourdeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the refactor to a dedicated service and moving the list to the model 🫶

@vincent-pochet vincent-pochet force-pushed the fix-register-webhook-stripe-errors branch from f1a424f to 57e66a7 Compare May 14, 2024 07:39
@vincent-pochet vincent-pochet merged commit bd1058c into main May 14, 2024
@vincent-pochet vincent-pochet deleted the fix-register-webhook-stripe-errors branch May 14, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants