PayPal\Api\Payment::all PHP Method

all() public static method

List payments that were made to the merchant who issues the request. Payments can be in any state.
public static all ( array $params, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : PaymentHistory
$params array
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return PaymentHistory
    public static function all($params, $apiContext = null, $restCall = null)
    {
        ArgumentValidator::validate($params, 'params');
        $payLoad = "";
        $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1);
        $json = self::executeCall("/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall);
        $ret = new PaymentHistory();
        $ret->fromJson($json);
        return $ret;
    }

Usage Example

 public function getList($count = 10, $index = 0)
 {
     $apiContext = $this->connectionService->getApiContext();
     $dispatcher = $this->connectionService->getDispatcher();
     $dispatcher->dispatch(PaymentEvent::GET_ALL_START);
     $params = array('count' => $count, 'start_index' => $index);
     $payments = Payment::all($params, $apiContext);
     $dispatcher->dispatch(PaymentEvent::GET_ALL_END);
     return $payments->getPayments();
 }
All Usage Examples Of PayPal\Api\Payment::all