How to test Web Hooks in Development Cheddarplan

marin.purgar's Avatar

marin.purgar

06 Jun, 2012 02:06 PM

Hi,

I tried to test Web Hooks under Development Cheddarplan but didn't succeeded.

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?

In the Activity -> Hooked Events there are no entries only the "No Events Hooked" message!?

Please advise how to simulate Web Hooks from the Development Cheddarplan.

Bye, Marin

  1. Support Staff 1 Posted by Marc Guyer on 06 Jun, 2012 02:27 PM

    Marc Guyer's Avatar

    Hi Marin -- I see a hook in your hooked events activity from just a few minutes ago. Are you still seeing a problem?

  2. 2 Posted by marin.purgar on 06 Jun, 2012 02:49 PM

    marin.purgar's Avatar

    Hi Marc,

    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.

    But even with the "bill 1 month after signup" the new customer was created and there was no "newCustomer" Web Hook sent.

    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.

    Bye, Marin

  3. Support Staff 3 Posted by Marc Guyer on 06 Jun, 2012 03:01 PM

    Marc Guyer's Avatar

    Hi Marin -- We're looking into the missing newSubscription hook.

    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:

    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......
    

    Can you confirm?

  4. 4 Posted by marin.purgar on 06 Jun, 2012 03:13 PM

    marin.purgar's Avatar

    Hi Marc,

    this is the excerpt from the $_SERVER variable dump (in PHP) of the headers received with the Web Hook HTTP Request:

    [HTTP_USER_AGENT] => CheddarGetter Hook
    [HTTP_X_CG_TOKEN] => f6e40008694b66b6a6c2611c52495755
    [HTTP_X_CG_SIGNATURE] => f8191be6e418adee7834a62929ab2e4a45431190b7986150009e9c40d64f29e9
    

    Bye, Marin

  5. Support Staff 5 Posted by Marc Guyer on 06 Jun, 2012 03:34 PM

    Marc Guyer's Avatar

    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:

        $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header));
        if (isset($_SERVER[$temp])) {
            return $_SERVER[$temp];
        }
    

    Thanks for bringing that to our attention. I've updated the KB article accordingly.

  6. Support Staff 6 Posted by Marc Guyer on 07 Jun, 2012 01:34 PM

    Marc Guyer's Avatar

    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.

  7. Marc Guyer closed this discussion on 04 Jul, 2012 02:11 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM