Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if user disconnected from my Stripe Connect app?

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?

like image 588
Maxim Zubarev Avatar asked Feb 01 '15 13:02

Maxim Zubarev


1 Answers

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

like image 53
koopajah Avatar answered Sep 22 '22 09:09

koopajah