Skip to main content

Search products

Last updated: 04-Jul-2018
Rate this article:

Overview

Use the searchProducts method to extract information about the subscription plan/products you configured for your account.

Pagination

Use pagination to decrease the request loading time, while better handling the returning responses.

Pagination works on all the search methods existing on 2Checkout API 5.0. The default pagination behavior is to display page 1 with 10 results. The maximum number of items displayed on a single page is 200.

To use pagination, include the Pagination object inside the search method call, using the parameters below:

Parameters Type/Description
Pagination Object
  Details below.
  Page Int
    Set the number of pages that should be returned.
  Limit Int
    Set a limit for the number of results that should be returned.

 

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

SearchOptions

Object

 

Name

Optional (string)

 

Product name. Can be NULL.

 

Codes

Optional (StringArray)

 

Array of product codes.

 

Types

Optional (StringArray)

 

Array of the values representing the type of products. Possible values:

  • REGULAR
  • BUNDLE

Leave empty to have all product types returned to the search.

Can be NULL. If NULL, 2Checkout returns both regular and bundle products.

 

Enabled

Optional (boolean)

 

True or false. Can be NULL.

 

GroupName

Optional (string)

 

The name of the group that the product is associated with.

Can be NULL.

 

Limit

Optional (integer)

 

Number of results (products) displayed per page. Default value is 10.

Can be NULL.

 

Page

Optional (integer)

 

A specific page of search results. Default value is 1.

Can be NULL.

 

OrderBy

Object

 

Defines the order of the returned results.

 

Field

Optional (string)

 

The name of the field to order the results by. Allowed values: 'ProductStatus', 'ProductName', 'ProductCode', 'UpdateDatetime', 'AvangateId'. Can be NULL.

 

Direction

Optional (string)

 

Sort results ascending or descending. Allowed values:

  • asc
  • desc (default)

Can be NULL (defaults to desc).

 

Response

Parameter Type/Description

Product

Object

Request

<?php

require ('PATH_TO_AUTH');

$SearchOptions = new stdClass();
$SearchOptions->Name = '2Checkout Subscription'; //Product name
$SearchOptions->Types = array ('REGULAR', 'BUNDLE'); //product type (standalone), regular or bundle
$SearchOptions->Enabled = True;
//$SearchOptions->GroupName = '';
$SearchOptions->Limit = '10';
$SearchOptions->Page = '10';

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'searchProducts',
'params' => array($sessionID, $SearchOptions)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

?>
Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo