tag:support.getcheddar.com,2009-06-01:/discussions/questions/1826-how-to-test-web-hooks-in-development-cheddarplanCheddar: Discussion 2018-04-11T18:02:31Ztag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-06T14:06:27Z2012-06-06T14:08:52ZHow to test Web Hooks in Development Cheddarplan<div><p>Hi,</p>
<p>I tried to test Web Hooks under Development Cheddarplan but
didn't succeeded.</p>
<p>I have configure the Service Hooks -> Custom URL. Added
"Desciroptoin Name", "URL" and checked out all of the Web Hooks
types and "Active" check-box. Then I added a new customer, added a
subscription, canceled subscription, deleted user but no Web Hooks
were triggered?</p>
<p>In the Activity -> Hooked Events there are no entries only
the "No Events Hooked" message!?</p>
<p>Please advise how to simulate Web Hooks from the Development
Cheddarplan.</p>
<p>Bye, Marin</p></div>marin.purgartag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-06T14:27:05Z2012-06-06T14:27:05ZHow to test Web Hooks in Development Cheddarplan<div><p>Hi Marin -- I see a hook in your hooked events activity from
just a few minutes ago. Are you still seeing a problem?</p></div>Marc Guyertag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-06T14:49:29Z2012-06-06T14:49:29ZHow to test Web Hooks in Development Cheddarplan<div><p>Hi Marc,</p>
<p>yeah, I have figured it out, my development Pricing Plans were
set to "bill 1 month after signup", after changing it to "bill
immediately on signup" I got the "transaction" WebHook immediately
after simulating preapproval via paypal.</p>
<p>But even with the "bill 1 month after signup" the new customer
was created and there was no "newCustomer" Web Hook sent.</p>
<p>Also, please change the documentation at "Web Hooks, Service
Hooks, and Captain Hooks" Knowledge base Article. There it is
stated that Signature Verification Token is sent via X-CG-SIGNATURE
HTTP header. By dumping all of the headers of the Web Hook request
I found out that in fact the header in question is
HTTP_X_CG_SIGNATURE.</p>
<p>Bye, Marin</p></div>marin.purgartag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-06T15:01:20Z2012-06-06T15:01:20ZHow to test Web Hooks in Development Cheddarplan<div><p>Hi Marin -- We're looking into the missing newSubscription
hook.</p>
<p>Regarding the header: I think your app may be adding the HTTP_
to the header names and converting dashes to underscores. I've
never seen that before and it strikes me as odd. Here's the raw
POST from our log:</p>
<pre>
<code>POST /api/notification/cheddargetter HTTP/1.1
Host: development.cloud.xxxxxxxxxxxx.com
Connection: close
Accept-encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
User-Agent: CheddarGetter Hook
X-CG-TOKEN: d7408d3af2ca9311b7ff909c041e542f
X-CG-SIGNATURE: 251132a7fc718b84e60eb3eadfbc72a470df96ff248a09513bb2275934f60dc0
Content-Length: 3889
activityType=transaction&activityDatetime=2012-06-06T14%3A22%3A46%2B00%3A0......</code>
</pre>
<p>Can you confirm?</p></div>Marc Guyertag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-06T15:13:09Z2012-06-06T15:13:09ZHow to test Web Hooks in Development Cheddarplan<div><p>Hi Marc,</p>
<p>this is the excerpt from the $_SERVER variable dump (in PHP) of
the headers received with the Web Hook HTTP Request:</p>
<pre>
<code>[HTTP_USER_AGENT] => CheddarGetter Hook
[HTTP_X_CG_TOKEN] => f6e40008694b66b6a6c2611c52495755
[HTTP_X_CG_SIGNATURE] => f8191be6e418adee7834a62929ab2e4a45431190b7986150009e9c40d64f29e9</code>
</pre>
<p>Bye, Marin</p></div>marin.purgartag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-06T15:34:03Z2012-06-06T15:34:03ZHow to test Web Hooks in Development Cheddarplan<div><p>Ah, I see. I had forgotten that PHP does that in the _SERVER
super global. We're using PHP as well but we reference the headers
via the ZF request object in our tests. Funny, ZF, converts it
back:</p>
<pre>
<code> $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header));
if (isset($_SERVER[$temp])) {
return $_SERVER[$temp];
}</code>
</pre>
<p>Thanks for bringing that to our attention. I've updated the KB
article accordingly.</p></div>Marc Guyertag:support.getcheddar.com,2009-06-01:Comment/164573092012-06-07T13:34:57Z2012-06-07T13:34:57ZHow to test Web Hooks in Development Cheddarplan<div><p>Hi Marin -- We just released a hotfix to enable newSubscription
hooks for PayPal subscriptions. FYI, we have a fork of our normal
logic specifically for PayPal. Notably, the NewSubscription email
is sent immediately when the PayPal process is begun. After the
process is complete, the hook fires. Thanks for bringing this to
our attention. Let us know if you have questions.</p></div>Marc Guyer