Uname: Linux peekpos.com 6.8.0-1060-aws #63~22.04.1-Ubuntu SMP Tue Jun 30 02:32:53 UTC 2026 x86_64
Software: Apache
PHP version: 8.3.25 [ PHP INFO ] PHP os: Linux
Server Ip: 47.130.192.226
Your Ip: 10.3.134.78
User: www (1001) | Group: www (1001)
Safe Mode: OFF
Disable Function:
passthru,putenv,chroot,chgrp,chown,shell_exec,popen,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv

name : RestUpdatePlanRequest.php
<?php
/**
 * PayPal REST Update Plan Request
 */

namespace Omnipay\PayPal\Message;

/**
 * PayPal REST Update Plan Request
 *
 * You can update the information for an existing billing plan. The state
 * of a plan must be active before a billing agreement is created.
 *
 * ### Request Data
 *
 * Pass the billing plan id in the URI of a PATCH call, including the replace
 * operation in the body. Other operations in the patch_request object will
 * throw validation exceptions.
 *
 * ### Example
 *
 * To create the billing plan, see the code example in RestCreatePlanRequest.
 *
 * <code>
 *   // Create a gateway for the PayPal REST Gateway
 *   // (routes to GatewayFactory::create)
 *   $gateway = Omnipay::create('PayPal_Rest');
 *
 *   // Initialise the gateway
 *   $gateway->initialize(array(
 *       'clientId' => 'MyPayPalClientId',
 *       'secret'   => 'MyPayPalSecret',
 *       'testMode' => true, // Or false when you are ready for live transactions
 *   ));
 *
 *   // Update the billing plan
 *   $transaction = $gateway->updatePlan(array(
 *       'transactionReference'     => $plan_id,
 *       'state'                    => $gateway::BILLING_PLAN_STATE_ACTIVE,
 *   ));
 *   $response = $transaction->send();
 *   if ($response->isSuccessful()) {
 *       echo "Update Plan transaction was successful!\n";
 *   }
 * </code>
 *
 * ### Request Sample
 *
 * This is from the PayPal web site:
 *
 * <code>
 * curl -v -k -X PATCH 'https://api.sandbox.paypal.com/v1/payments/billing-plans/P-94458432VR012762KRWBZEUA' \
 *    -H "Content-Type: application/json" \
 *    -H "Authorization: Bearer <Access-Token>" \
 *    -d '[
 *        {
 *            "path": "/",
 *            "value": {
 *                "state": "ACTIVE"
 *            },
 *            "op": "replace"
 *        }
 *    ]'
 * </code>
 *
 * ### Response
 *
 * Returns the HTTP status of 200 if the call is successful.
 *
 * @link https://developer.paypal.com/docs/api/#update-a-plan
 * @see RestCreateSubscriptionRequest
 * @see Omnipay\PayPal\RestGateway
 */
class RestUpdatePlanRequest extends AbstractRestRequest
{
    /**
     * Get the plan state
     *
     * @return string
     */
    public function getState()
    {
        return $this->getParameter('state');
    }

    /**
     * Set the plan state
     *
     * @param string $value
     * @return RestUpdatePlanRequest provides a fluent interface.
     */
    public function setState($value)
    {
        return $this->setParameter('state', $value);
    }

    public function getData()
    {
        $this->validate('transactionReference', 'state');
        $data = array(array(
            'path'      => '/',
            'value'     => array(
                'state'     => $this->getState(),
            ),
            'op'        => 'replace'
        ));

        return $data;
    }

    /**
     * Get transaction endpoint.
     *
     * Billing plans are managed using the /billing-plans resource.
     *
     * @return string
     */
    protected function getEndpoint()
    {
        return parent::getEndpoint() . '/payments/billing-plans/' . $this->getTransactionReference();
    }

    protected function getHttpMethod()
    {
        return 'PATCH';
    }
}
© 2026 GrazzMean