Using Stripe webhooks with Rails

℡╲_俬逩灬. 提交于 2019-12-05 07:36:09
barancw

There's a nice gem for this: https://github.com/integrallis/stripe_event.

It looks to be well written and maintained.

In your gemfile you can simply add the line -

gem 'stripe_event'

There's clear doc in the readme on github.

Most all payment gateways, including stripe, have some way of telling the client (your webapp) whether the charge went through or not.

For stripe, their docs show how to receive a webhook notification from them.

The flow is:

  1. Create a controller and method in your app to receive the webhook calls from stripe. Note that the calls will come in as POSTs, not GETs
  2. Register the url with stripe using their dashboard. This is a manual step that you do once.
  3. When your method is called from stripe, use the event info to update your models which track the status of your users' subscriptions.

Any questions?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!