7

I can provide a disconnect option on my app, as described here: https://stripe.com/docs/connect/getting-started#revoked-access

But if a user revokes access to my app through his account settings, how can I know about that?

Maxim Zubarev
  • 2,403
  • 2
  • 29
  • 48

1 Answers1

9

You need to setup a webhook endpoint URL for your connect app where you listen for the event account.application.deauthorized to detect that the user has disconnected your application.

When you go and try to retrieve the event to ensure it's valid with the Retrieve Event API you will get an error because your application is not authorized anymore:

Stripe::AuthenticationError: (Status 401) Expired API key provided: sk_********. Application access may have been revoked.

You can rely on the fact that you get a 401 status code in that case to ensure that the event is valid otherwise you would get a different error

koopajah
  • 23,792
  • 9
  • 78
  • 104
  • Thank you so much for the tip about the expired api key message. I was really stumped on how to verify this webhook. – jessica Oct 29 '15 at 03:04