This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/sample/notifications/DeleteAllWebhooks.php
Jay Patel ab334918b0 Sample ResultPrinter Not to be Used
- Comment everywhere the ResultPrinter is used to not use outside sample
2015-04-23 23:34:24 -05:00

27 lines
992 B
PHP

<?php
// # Delete All Webhook Sample
// This is a sample helper method, to delete all existing webhooks, because of limited number of webhooks that are allowed per app.
// To properly use the sample, change the clientId and Secret from bootstrap.php file with your own app ClientId and Secret.
// ## Get Webhook Instance
/** @var \PayPal\Api\WebhookList $webhookList */
$webhookList = require 'ListWebhooks.php';
// ### Delete Webhook
try {
foreach ($webhookList->getWebhooks() as $webhook) {
$webhook->delete($apiContext);
}
} catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Deleted all Webhooks", "WebhookList", null, null, $ex);
exit(1);
}
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Delete all Webhook, as it may have exceed the maximum count.", "WebhookList", null, null, null);
return $output;