<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73821#M45773</link>
    <description>&lt;P&gt;Yes, the failure only occurs when it is active and processing automated notifications. My program is capturing and logging the full headers and body from the request, and running the algorithm, and logging the results, and they don't match with live transactions, only on the static transaction sent when using test webhook button in 'inactive' mode.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like I'm not the only one asking about this. This post shows the exact same logic in node.js, getting the same behavior:&amp;nbsp;&lt;A href="https://community.developer.authorize.net/t5/Integration-and-Testing/Verify-webhook-payload/m-p/73758/highlight/true#M45729" target="_blank" rel="noopener"&gt;https://community.developer.authorize.net/t5/Integration-and-Testing/Verify-webhook-payload/m-p/73758/highlight/true#M45729&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2020 04:01:37 GMT</pubDate>
    <dc:creator>FirmRecJV20</dc:creator>
    <dc:date>2020-11-02T04:01:37Z</dc:date>
    <item>
      <title>Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73814#M45769</link>
      <description>&lt;P&gt;I am having trouble with the authentication of webhook notifications. Please note that all testing is currently taking place in the sandbox environment. We are not live yet with this application, but planning to go into production on Nov. 6th 2020.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my node.js function to validate the API call as originating from Authorize.net. This logic works perfectly when I use the "Test Webhook" button in the merchant portal. But it fails every time when webhook notifications are sent automatically by normal operations of our merchant application. Why would it work fine with the bogus transaction sent to my API from the Test Webhook button, but fail on automated notifications, when both are originating from the authorize.net sandbox? Please let me know if anyone sees a flaw in my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI – the entire request object is passed into this function as soon as it is received. I'm using crypto with this statement:&lt;/P&gt;&lt;P&gt;const crypto = require('crypto');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/**
 * -----------------------------------------------------------------------------------------
 * Compares x-anet-signature hash sent by authorize.net (x-anet-signature), with computed 
 * hash based on webhook notification body (json payload stringified), using hex signature-key 
 * stored in authnet_connect.js (auth.api_info.signature_key).
 * 
 * Returns true if they match, false if they don't match.
 * If they don't match, this notification will be rejected as not sent by Authorize.net
 */
function authenticate_webhook ( req ) {

    // Get signature sent in request header 
    let req_signature = req.headers['x-anet-signature'];
    req_signature = req_signature.substr(7); // remove 'sha512=' from beginning of hash sent

    // Generate keyed-hash message authentication code based on merchant's signature key
    let hmac = crypto.createHmac('sha512', auth.api_info.signature_key);
    let data = hmac.update(JSON.stringify(req.body));
    let gen_hmac= data.digest('hex').toUpperCase();

    utils.log(`hash sent:\n`, req_signature);
    utils.log(`hash computed:\n`, gen_hmac);

    return (req_signature == gen_hmac);
}&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Oct 2020 17:03:52 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73814#M45769</guid>
      <dc:creator>FirmRecJV20</dc:creator>
      <dc:date>2020-10-31T17:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73815#M45770</link>
      <description>&lt;P&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/41813"&gt;@FirmRecJV20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you have it in active mode?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Nov 2020 11:09:04 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73815#M45770</guid>
      <dc:creator>Renaissance</dc:creator>
      <dc:date>2020-11-01T11:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73821#M45773</link>
      <description>&lt;P&gt;Yes, the failure only occurs when it is active and processing automated notifications. My program is capturing and logging the full headers and body from the request, and running the algorithm, and logging the results, and they don't match with live transactions, only on the static transaction sent when using test webhook button in 'inactive' mode.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like I'm not the only one asking about this. This post shows the exact same logic in node.js, getting the same behavior:&amp;nbsp;&lt;A href="https://community.developer.authorize.net/t5/Integration-and-Testing/Verify-webhook-payload/m-p/73758/highlight/true#M45729" target="_blank" rel="noopener"&gt;https://community.developer.authorize.net/t5/Integration-and-Testing/Verify-webhook-payload/m-p/73758/highlight/true#M45729&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 04:01:37 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/73821#M45773</guid>
      <dc:creator>FirmRecJV20</dc:creator>
      <dc:date>2020-11-02T04:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/75963#M47422</link>
      <description>&lt;P&gt;Hello, Were you able to find the solution.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 19:19:52 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/75963#M47422</guid>
      <dc:creator>faisalsami</dc:creator>
      <dc:date>2021-04-24T19:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/83832#M52866</link>
      <description>&lt;P&gt;Hello, did you ever resolve this issue? I am unfortunately at a loss for days with the same problem&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 17:50:41 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/83832#M52866</guid>
      <dc:creator>three60sb</dc:creator>
      <dc:date>2022-08-18T17:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Node.js Webhook auth works fine with Test Webhook button, but fails on actual transactions</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/84767#M53377</link>
      <description>&lt;P&gt;did the webhook authentication worked for anyone please respond&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 08:13:21 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Node-js-Webhook-auth-works-fine-with-Test-Webhook-button-but/m-p/84767#M53377</guid>
      <dc:creator>DivyaArun</dc:creator>
      <dc:date>2022-11-04T08:13:21Z</dc:date>
    </item>
  </channel>
</rss>

