Paypal Rest api: How to delete a billing plan?

paypal

Solution

There is a way to DELETE a Billing Plan.

If you see the samples in the REST-PHP-SDK, there is a file named DeletePlan.php which has the code to delete the billing plan.

It goes something like this:

$createdPlan = require 'CreatePlan.php';

use PayPal\Api\Plan;

try {
    $result = $createdPlan->delete($apiContext);
} catch (Exception $ex) {
    ResultPrinter::printError("Deleted a Plan", "Plan", $createdPlan->getId(), null, $ex);
    exit(1);
}

ResultPrinter::printResult("Deleted a Plan", "Plan", $createdPlan->getId(), null, null);

return $createdPlan;

This worked for me. Hope this helps.

Problem

The paypal developer documentation explains the steps to create and activate a Billing plan. Is there a way to delete a billing plan?

Original source