chargify-sdk-php icon indicating copy to clipboard operation
chargify-sdk-php copied to clipboard

How Can I use WebHooks?

Open gerfigna opened this issue 9 years ago • 1 comments

I want to handle webhooks using this library.

Can you show me any code sample?

Thanks !

gerfigna avatar May 18 '16 12:05 gerfigna

I've added PR for this. #14 Once it is approved, you will be able to handle webhooks in this way:

 # Handle webhooks

 $webhook = $chargify->webhook()->handle('webhook.log');

 if($webhook) {
     echo $webhook->getEvent() . PHP_EOL; // payment_success
     echo $webhook->getId()  . PHP_EOL; // 112233
     print_r($webhook->getPayload()); // Array 
 }

 // Generate fake webhook for testing
 $webhook = $chargify->webhook()->handleFake();

Powerhead13 avatar Aug 05 '16 01:08 Powerhead13