forked from LiveCarta/PayPal-PHP-SDK
More Webhook API Changes
- Updated API Models with Fixes - Updated Samples - Additional Functional Tests
This commit is contained in:
24
sample/notifications/DeleteAllWebhooks.php
Normal file
24
sample/notifications/DeleteAllWebhooks.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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) {
|
||||
ResultPrinter::printError("Deleted all Webhooks", "WebhookList", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Delete all Webhook, as it may have exceed the maximum count.", "WebhookList", null, null, null);
|
||||
|
||||
return $output;
|
||||
Reference in New Issue
Block a user