Skip to content

Handle webhook permission errors

JonGold requested to merge JonGold/stripe:more-error-handling into master

I was running 5.3.2 and ran into a similar problem with error handling not bubbling up on system checks - similar to this commit. However, in my case the issue is that the API key is valid, but lacks endpoint permissions. I got this error:

The provided key 'rk_live_********************O0YT' does not have the required permissions for this endpoint on account 'acct_1CZkiAHA8ztj9Qpg'. Having the 'rak_webhook_read' permission would allow this request to continue.

I'm proposing this as an alternative, since the error is of class \Stripe\Error\Permission, not \Stripe\Error\Authentication, and to display the specific error passed back from Stripe. I know that's not as nice as a prettier error message, but Stripe's messages are fairly readable, and this will handle other unknown errors more gracefully.

I left the "Stripe - API Key" title alone, since I can't think of an instance where it wouldn't be tied to the API key somehow.

Merge request reports