josh edgar
Joined
Activity
Posted in Stripe connect managed accounts
Ended up removing the stripe_event gem and set up webhooks manually. Was very easy...
created a webhooks_controller.rb and new post route
begin
payload = JSON.parse(request.body.read)
# Verify the event by fetching it from Stripe
if payload['account'].present?
# This is for connected accounts
event = Stripe::Event.retrieve(payload['id'], stripe_account: payload['account'])
@stripe_object = event.data.object
@stripe_account_update = StripeAccount.where(stripe_id: payload['account']).first!
# update verification status etc in db
u = @stripe_account_update.update_attributes(
verification_status: @stripe_object.legal_entity.verification.status,
verification_details: @stripe_object.verification.fields_needed
)
else
# Normal events not using stripe_event
Stripe::Event.retrieve(payload['id'])
end
rescue Stripe::StripeError => e
# Handle this however you prefer
raise ActiveRecord::RecordNotFound.new(e)
end
Only thing I need to figure out is how to read the event type "account_created", "account_updated" etc. Haven't looked into it yet. But I'm sure there's nothing to it.
Posted in Stripe connect managed accounts
I'm trying to add webhooks to stripe using stripe connect and managed accounts https://stripe.com/docs/connect/webhooks
I'm using the stripe_events plugin and have followed your stripe webhooks video. I nearly have it working but I have to add an "account" attribute somewhere?!?! I've been looking at the screen to long. Can you please help!
#initializers/strip.rb
Stripe.api_key = Rails.configuration.stripe[:secret_key]
class RecordAccount
def call(event)
event = event.data.object
account = event.account
#Look up StripeAccount in our database
stripe_account = StripeAccount.where(stripe_id: account).last
#Record Verification details, status in StripeAccount
u = stripe_account.update_attributes(verification_status: event.legal_entity.verification.status, verification_details: event.legal_entity.verification.details)
u.save
end
end
StripeEvent.configure do |events|
events.subscribe 'account.updated', RecordAccount.new
end
Posted in How do drag and drop builders work?
Awesome guys, thank you. It's a great start. Might have to start brushing up on my Javascript.
Posted in How do drag and drop builders work?
So many website builders, form builders etc are comming to market. How do these actually work and is it possible to build something like this in rails?
I'm assuming you drag an element onto a canvas using jquery or something but does it then populate a hidden form or set variables?!? could probably hack my way through to a working project but would love to know the best practice?