Webhook Confirmation
This is how you'll confirm if a transfer charge has successfully processed
Introduction
Webhook Verification
Steps
require 'sinatra'
require 'openssl'
post '/webhook' do
signature_token = ENV['SIGNATURE_TOKEN']
body = request.body.read
hook_signature = request.env['HTTP_X_TRANSFERS_SIGNATURE']
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), signature_token, body)
is_valid = Rack::Utils.secure_compare(signature, hook_signature)
if is valid
#do something with token
end
endResponding to a Webhook Request
Webhook Request Body
Last updated
Was this helpful?