List All Products

In this use case, we will show you how to retrieve products, plans, and prices from Zuora.

A product represents a product or service that your company sells. The pricing is described as plans. A plan represents a collection of prices that your customers may incur when buying your product. When a customer purchases a product, they can pick from one of the available plans.

You can use the "List all products" operation to retrieve all products in your tenant. The List all products operation returns an array of products (paginated, 10 per call), without plans and prices information by default. The response may contain a next_page field, which is the index to the next product that cannot be displayed on the current page. To fetch the next page of the list, set this index as the value of the cursor query parameter in the subsequent request.

To retrieve all plans and prices related to each product, set the value of the expand[] query parameter to plans.prices.

The following example retrieves all products with plans and prices:

cURLJavaNode
Copy
Copied
curl -X GET "https://rest.apisandbox.zuora.com/v2/products?expand[]=plans.prices"
     -H "Authorization: Bearer 72db3da461ba40c69fb1c2dc440ad204"
     -H "Content-Type: application/json"
Copy
Copied
List expandParameters = new ArrayList();
expandParameters.add("plans.prices");

ProductListResponse productsWithPlansAndPrices = zuoraClient.products().getProducts(null, expandParameters, null);
System.out.println(expandParameters);
Copy
Copied
const products = await zuoraClient.products.getProducts(({
    expand: ['plans.prices']
}));
console.log(products);