mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-05-24 00:01:51 -04:00
Merge pull request #572 from timcraft/webhook
Parse webhook payload after verifying the signature header
This commit is contained in:
commit
a19dfed759
@ -7,12 +7,10 @@ module Stripe
|
||||
# This may raise JSON::ParserError if the payload is not valid JSON, or
|
||||
# SignatureVerificationError if the signature verification fails.
|
||||
def self.construct_event(payload, sig_header, secret, tolerance: DEFAULT_TOLERANCE)
|
||||
data = JSON.parse(payload, symbolize_names: true)
|
||||
event = Event.construct_from(data)
|
||||
|
||||
Signature.verify_header(payload, sig_header, secret, tolerance: tolerance)
|
||||
|
||||
event
|
||||
data = JSON.parse(payload, symbolize_names: true)
|
||||
Event.construct_from(data)
|
||||
end
|
||||
|
||||
module Signature
|
||||
|
Loading…
x
Reference in New Issue
Block a user