Skip to main content

Add product to cart

Last updated: 30-May-2023
Rate this article:


Use this method to add products to cart, during the current cart session.


This method requires you to set a specific partner using setPartner.


Parameter Type/Description
sessionID Required (string)
  Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect.
productId Required (integer)
  Unique product identifier from the 2Checkout system.
pricingListCode Required (string)
  The unique identifier of a partner price list.
quantity Optional (integer)

Defines the amount of product units to be ordered. If no quantity info is provided, the minimum available number of units is included in the order.


If the quantity provided is not available for purchase, such as in the case of volume discounts, en error message is displayed.


When NULL, quantity = 1 is added automatically.

priceOptions Optional (StringArray)

Array of price options codes. If no price options info is provided, the default, required pricing options of the product are ordered. These identifiers mark the individual options inside pricing options configuration groups.


Can be NULL.


Parameter Type/Description
Result Boolean
  True or false



require ('PATH_TO_AUTH');  // Authentication example:
require ('PATH_TO_SET_PARTNER'); // setPartner example:

$productId = 'YOUR_PRODUCT_ID';
$pricingListCode = 'YOUR_PRICING_LIST_CODE';
$priceOptions = array(

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addProduct',
'params' => array($sessionID, $productId, $quantity, $priceOptions, $pricingListCode)

var_dump (callRPC((Object)$jsonRpcRequest, $host));


Error Description


No partner is set.


Invalid product ID.


There are no pricing lists with the provided code.


There is no active product with the specified product ID in the given pricing list.


Quantity is not available for purchase.


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