samedi 25 avril 2015

How to deauthorize/disconnect Stripe Connect accounts in Rails


I was looking for quite a long time for a good example on how to de-authorize / disconnect a Stripe Connect account in my Rails app. Perhaps for those that are well versed in making external POST requests, this is trivial, but I'm new and this seemed so hard for someone new to manually crafting POST requests. :)

I'm using the omniauth-stripe-connect gem, which is excellent for connecting an account with Stripe connect. It doesn't appear to have built-in functionality for disconnecting accounts.

Stripe's own documentation says to simply do a POST to their deauthorize URL. But their example is a cURL command, which you can't use natively in Rails. Or rather, it's not advised.

curl http://ift.tt/1b1lNAy \
   -u {YOUR_SECRET_KEY}: \
   -d client_id=ca_5ry8QONyVRqZAJcezVxwUWlGcJAR7cW1 \
   -d stripe_user_id=acct_llriadrqho6HXC

What's the best way to perform that POST in Rails?


Aucun commentaire:

Enregistrer un commentaire