Stripe error 503 - illegal IP 127.0.0.1 webhook problems
I am working on setting up a webhook from Stripe. Basically because this is a subscription model and I need to know if I will be renewing a month or not. I would like to do this through the "invoice.payment_succeeded" event.
When I test the webhook url in the stripe, I get this:
host localhost:3000 resolves to illegal IP 127.0.0.1
my full endpoint:
localhost:3000/hooks/receiver
Route:
get 'hooks/receiver' => "hooks#receiver"
and the hook controller looks like this:
class HooksController < ApplicationController
require 'json'
Stripe.api_key
def receiver
data_json = JSON.parse request.body.read
p data_json['data']['object']['customer']
if data_json[:type] == 'invoice.payment_succeded'
make_active(data_event)
end
if data_json[:type] == 'invoice.payment_failed'
# something make_inactive(data_event)
end
end
def make_active(data_event)
@user = User.find_by_customer_token(data['data']['object']['customer'])
@status = @user.statuses.pluck(:list_id).presence || -1
Resque.enqueue(ScheduleTweets, @user.token, @user.id, @status)
end
def make_inactive(data_event)
end
end
Does anyone know how to fix this?
+3
source to share