Stripe\Plan::all PHP Method

all() public static method

public static all ( array | null $params = null, array | string | null $opts = null ) : Collection
$params array | null
$opts array | string | null
return Collection of Plans
    public static function all($params = null, $opts = null)
    {
        return self::_all($params, $opts);
    }

Usage Example

 function get_plans(WP_REST_Request $data)
 {
     $this->set_api_key();
     $data = $data->get_params();
     try {
         $args = array('limit' => 10);
         if (isset($data['starting_after'])) {
             $args['starting_after'] = $data['starting_after'];
             $plans = \Stripe\Plan::all($args);
         } elseif (!isset($data['starting_after']) && !isset($data['id'])) {
             $plans = \Stripe\Plan::all(array('limit' => 10));
         } elseif (isset($data['id'])) {
             $plans = \Stripe\Plan::retrieve($data['id']);
         }
         return new WP_REST_Response($plans, 200);
     } catch (Stripe_AuthenticationError $e) {
         $body = $e->getJsonBody();
         $err = $body['error'];
         return new WP_Error($err['type'], __($err['message']), array('status' => 403));
     } catch (Stripe_Error $e) {
         $body = $e->getJsonBody();
         $err = $body['error'];
         return new WP_Error($err['type'], __($err['message']), array('status' => 403));
     } catch (\Stripe\Error\Base $e) {
         $body = $e->getJsonBody();
         $err = $body['error'];
         return new WP_Error($err['type'], __($err['message']), array('status' => 403));
     }
 }
All Usage Examples Of Stripe\Plan::all