2017-07-01 43 views
0

我使用條紋驗證配置文件之前發生任何事務,所以我想看到webhooks類型account.updated並檢查verification.statusstripe_event 404錯誤的測試數據,搞清楚如何添加條紋帳戶標頭

林接收404 error '(Status 404) (Request req_AwRiJSFxaOn1Jq) No such event: evt_1AaW9jFzjmmh0zTvsNSlfDLv

我知道我需要針對特定​​帳戶,該網絡掛接正在爲由條帶帳戶標頭。我無法弄清楚如何添加帳戶頭到我的stripe.rb代碼。我在帳戶創建數據庫中保存了stripe_account_id,所以我可以將該ID從數據庫中提取出來。令我迷惑的部分是當webhook發送給我的應用程序時,account_id位於webhook中,所以我似乎必須將該部分從webhook中取出並粘貼到stripe.rb中{:stripe_account => CONNECTED_STRIPE_ACCOUNT_ID}。這怎麼可能?

這是從條紋在控制檯(這是測試數據,所以我不介意的人可以看到這導致其越來越刪除很快反正)發送的網絡掛接

enter image description here

enter image description here

stripe.rb

require 'stripe' 
Rails.configuration.stripe = { 
    :publishable_key => ENV["STRIPE_PUBLISHABLE_KEY"], 
    :secret_key => ENV["STRIPE_SECRET_KEY"] 
} 

Stripe.api_key = ENV["STRIPE_SECRET_KEY"] 


StripeEvent.configure do |events| 
    events.all do |event| 
    # target specific events here 
puts "this is working so far" 
    if event.type == 'account.updated' 
    account_event = event.data.object 
    puts "account updated working" 
    puts "#{account_event}" 

end 

    end 
end 

我收到了條紋連接帳戶儀表板和我的應用程序中的webhook安慰。

enter image description here

回答

1

你可能缺少條紋帳戶頭,所以它試圖從您的賬戶獲取事件,而不是從the Stripe Account in which it exists

編輯:對不起,我完全誤解了你的問題。我認爲你需要configure the StripeEvent receiver to use the Stripe Account

+0

我看到帳戶標題是在收費或退款之類的請求上。然而,我知道哪個帳戶是爲了之前,我接收webhook。在我的數據庫中,我爲條形自定義帳戶創建中的每個用戶保存了'stripe_account_id'。因此,在我的stripe.rb代碼中,我如何將賬戶頭添加爲'{:stripe_account => CONNECTED_STRIPE_ACCOUNT_ID}'。 webhook擁有關於它屬於誰的信息,因此在最初添加標題之前,我必須將其從webhook中取出。我對嗎?這怎麼可能? –

+0

@Michael Lombardo道歉;我誤解了。看我的編輯。 – floatingLomas