Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How Can I use WebHooks? #11

Open
gerfigna opened this issue May 18, 2016 · 1 comment
Open

How Can I use WebHooks? #11

gerfigna opened this issue May 18, 2016 · 1 comment

Comments

@gerfigna
Copy link

I want to handle webhooks using this library.

Can you show me any code sample?

Thanks !

Powerhead13 added a commit to Powerhead13/chargify-sdk-php that referenced this issue Aug 5, 2016
@Powerhead13
Copy link

Powerhead13 commented Aug 5, 2016

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants