Search by

Official PHP SDK for the PriceBell Google Shopping price tracking API.

v0.1.0 2026-12-05 12:47 UTC

This package is auto-updated.

Last update: 2026-12-05 13:11:44 UTC


README

The official PHP SDK for the PriceBell Google Shopping price tracking API.

Track Google Shopping prices in 33 countries with a scheduled watchlist, price history, sellers, cross-country comparison and alerts.

The SDK exposes 14 methods, one per documented endpoint (with array-shape PHPDoc for static analysis), plus clearTargetPrice() and a generic request(). It sends requests through any PSR-18 client and uses Guzzle by default.

Requirements

  • PHP 8.1 or newer

Installation

composer require pricebell/sdk

Get your API key

Sign up for PriceBell or sign in, then copy your API key from the dashboard. The client reads the PRICEBELL_API_KEY environment variable when no key is passed.

Quick start

<?php

require 'vendor/autoload.php';

use PriceBell\Client;

$client = new Client(getenv('PRICEBELL_API_KEY') ?: null);
$response = $client->searchGoogleShopping(['query' => 'airpods pro 2']);
print_r($response->data);

Parameter arrays use the names of the API reference. Unknown names throw a SerializationException; use request() for undocumented parameters.

HTTP methods

Each method uses the HTTP verb of its endpoint. GET and DELETE send parameters in the query string; POST and PATCH send them as a JSON body, except wait on /products/{id}/check, which stays in the query string. Null values are never sent; to remove a product's target price, call $client->clearTargetPrice($id), which sends PATCH /products/{id} with {"target_price": null}.

null values are omitted, false and 0 are sent, and lists repeat the parameter name.

Any endpoint

$response = $client->request('GET', '/account');

Errors

use PriceBell\Exception\ApiException;

try {
    $client->searchGoogleShopping(['query' => 'airpods pro 2']);
} catch (ApiException $exception) {
    echo $exception->status, ': ', $exception->getMessage();
}
Exception When
ConfigurationException Missing API key, invalid options or unsupported method.
SerializationException A required parameter is missing, unknown or can't be sent.
TransportException Network failure or timeout.
ApiException Non-2xx status (status, errorCode, errorMessage, responseBody, rawResponse).
ResponseDecodingException A success response could not be decoded.

errorCode is the API's error.code, such as rate_limited, product_limit or not_found (null when the body has none).

All of them extend PriceBell\Exception\PriceBellException.

Retries

Requests are retried up to 3 times after a network error, a 408, 500, 502, 503 or 504. Other statuses, such as 400, 401, 402, 404 or 429, and client-side timeouts are not retried: the API's rate limits last until the hour (or the day) is over, and on the free plan every retry would count as a request. The delay starts at 1 second and grows 1.5× per retry (capped at 30 seconds); a Retry-After header wins.

$client = new Client(null, ['max_retries' => 5, 'retry_delay' => 0.5]);
$client->searchGoogleShopping(['query' => 'airpods pro 2'], new RequestOptions(maxRetries: 0)); // one request without retries

Batch requests

batch() sends several calls with at most 10 requests in flight ($concurrency), through Guzzle's connection pool, and returns one BatchResult per call in input order. A failing call never stops the others. With a custom PSR-18 client the calls run one after another.

$inputs = ['airpods pro 2', 'nintendo switch 2', 'dyson v15'];
$calls = array_map(static fn(string $value): array => ['searchGoogleShopping', ['query' => $value]], $inputs);

foreach ($client->batch($calls, concurrency: 5) as $result) {
    if ($result->ok()) {
        print_r($result->value->data);
    } else {
        echo $inputs[$result->index], ': ', $result->error->getMessage(), "\n";
    }
}
Constant Default Description
Client::DEFAULT_CONCURRENCY 10 Tasks run at the same time by batch
Client::DEFAULT_TIMEOUT 120.0 Request timeout (seconds)
Client::MAX_RETRIES 3 Retry attempts after a network error, a 408/5xx
Client::RETRY_BACKOFF_FACTOR 1.5 Exponential backoff multiplier
Client::DEFAULT_RETRY_DELAY 1.0 Delay before the first retry (seconds)

Options and custom HTTP clients

$client = new Client(null, [
    'timeout' => 60.0,               // seconds, default 120 (default Guzzle client only)
    'headers' => ['X-Trace' => 'abc'],
    'http_client' => $psr18Client,   // optional: any PSR-18 client
]);

Endpoints

14 methods, generated from the OpenAPI document.

Method HTTP Description
checkProduct() POST /products/{id}/check Asks for a check right away (1 credit), at most once per 5 minutes; earlier calls return the product unchanged. A paused product has to be…
compareRegions() GET /products/{id}/compare The same product tracked in several countries, cheapest first: each country's local price, the price converted into the comparison's curren…
deleteProduct() DELETE /products/{id} Removes the product and its price history.
getAccount() GET /account Your plan, the credits left (monthly allowance and packs), how many products you track and the credits they use per month, the credits each…
getGoogleProductHistory() GET /history Every price PriceBell read for a product ID on a marketplace over the period, whoever tracks it, oldest first, with the lowest, highest and…
getProduct() GET /products/{id} The product's latest state and every price read of the period, oldest first. The history covers every read of this product ID on this marke…
getSellers() GET /products/{id}/sellers The sellers of a tracked product at its latest check, cheapest first: each offer that is the product as sold new (accessories, used, refurb…
leaveComparison() DELETE /products/{id}/compare The product leaves its comparison and stays tracked on its own.
listProducts() GET /products Your watchlist, newest first, with each product's latest state and its recent prices (trend). Filter with google_product_id (and marketplac…
searchGoogleShopping() GET /search Google Shopping search results (sponsored included), to find the product ID of a product. Free, limited to 30 searches per hour.
trackInRegions() POST /products/{id}/compare Tracks the same product in other countries, each one a product of your watchlist (its own checks and credits, within your plan's product li…
trackProduct() POST /products Adds a product ID or a Google Shopping link to your watchlist. A product ID alone works only for a product PriceBell already knows in that…
updateComparison() PATCH /products/{id}/compare The currency prices are converted into, and the "cheaper in another country" alert: an email (and chat channels) when another country's con…
updateProduct() PATCH /products/{id} Target price, drop alerts, check interval, or pause. Send only what changes. On the free plan, alerts (price drop, offered again, target pr…

All PriceBell SDKs

SDK Package Install
Node.js @pricebell/sdk npm install @pricebell/sdk
Python pricebell pip install pricebell
Go pricebell-go go get github.com/pricebelldev/pricebell-go
.NET PriceBell dotnet add package PriceBell
Ruby pricebell gem install pricebell
PHP pricebell/sdk composer require pricebell/sdk
Java pricebell-java build from source, see its README
CLI @pricebell/cli npm install -g @pricebell/cli
MCP server @pricebell/mcp npx -y @pricebell/mcp

Trademarks

Google and Google Shopping are trademarks of Google LLC. PriceBell is not affiliated with, endorsed or sponsored by Google.

License

MIT — see LICENSE.