This video is available to students only

How to Use the Stripe Deauthorize Function in React

We'll discuss a small change that can be made to fully disconnect a user from our Stripe Connect account when they've disconnected from Stripe in our app.

Disconnecting from Stripe & Revoking Access#

Stripe Documentation on revoking access of connected accounts can be found - here.

We built the disconnectStripe mutation to allow a user the ability to disconnect their Stripe "wallet" from our platform (or in other words, to remove their Stripe credentials kept in the database). However, when they've ever disconnected, we haven't built functionality focused on removing the connected account within the TinyHouse Stripe Connect account.

To facilitate this, we can use the oauth.deauthorize() function available from a stripe client instance as documented in the Revoked and revoking access section of the Stripe documentation on Using Connect with Standard accounts. The oauth.deauthorize() function accepts an options object that accepts a client_id of the application that we'd like the connected account to disconnect from and a stripe_user_id of the connected account we want to disconnect. With that said, we can create a disconnectStripe() function in the Stripe object instance we have in the src/lib/api/Stripe.ts to facilitate this.

Start a new discussion. All notification go to the author.