dimanche 28 juillet 2019

How read paypal plans with different state

Looking at this doc http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/ListPlans.html in my laravel 5.8 app using "paypal/rest-api-sdk-php": "*", I read all my paypal plans with :

$params   = array('page_size' => '20');
$planList = Plan::all($params, $this->apiContext);

I read all paypal plans with

State = “CREATED”

But paypal plans which were activated before are not in lists above:

In file : vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/Plan.php I see function :

public static function all($params, $apiContext = null, $restCall = null)
{
    ArgumentValidator::validate($params, 'params');
    $payLoad = "";
    $allowedParams = array(
        'page_size' => 1,
        'status' => 1,
        'page' => 1,
        'total_required' => 1
    );
    $json = self::executeCall(
        "/v1/payments/billing-plans/" . "?" . http_build_query(array_intersect_key($params, $allowedParams)),
        "GET",
        $payLoad,
        null,
        $apiContext,
        $restCall
    );
    $ret = new PlanList();
    $ret->fromJson($json);
    return $ret;
}

I tried to set state parameter to return all paypal plans, like :

$params   = array('page_size' => '20', 'state'=>'ACTIVE');
$planList = Plan::all($params, $this->apiContext);
return $planList;

but failed, anyway only

State = “CREATED”

are returned?

How to get listing of all paypal plans ( or only activated ) ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire