Skip to main content

Add product to cart

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

Overview

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

Requirements

Parameters

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 Avangate 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.

Response

Parameter Type/Description
Result Boolean
  True or false

Request

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner

$productId = 'YOUR_PRODUCT_ID';
$pricingListCode = 'YOUR_PRICING_LIST_CODE';
$quantity = YOUR_QUANTITY;
$priceOptions = array(
'Pricing_options_group_code1',
'Pricing_options_group_code2'
);

try {
    $OrderProduct= $client->addProduct($sessionID, $productId, $quantity, $priceOptions, $pricingListCode);
} catch (SoapFault $e) {
    echo "ProductinCart: " . $e->getMessage();
    exit;
}
var_dump ("ProductinCart ", $OrderProduct);

Errors

Error Description

INVALID_PARTNER

No partner is set.

PRODUCT_ERROR

Invalid product ID.

PARTNER_PRICING_LISTS_NOT_FOUND

There are no pricing lists with the provided code.

PRODUCT_NOT_FOUND

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

INVALID_QUANTITY

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