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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With