Przejdź do treści
Garanify

Add the mandatory displays with one API

With the Garanify API you register your shop and products and show the notice on the legal guarantee and the GARAN label on any website. The graphics are always the official files of the European Commission.

The API is built and tested. Hosting at api.garanify.com is in preparation; until then it runs locally. Keys are available on request.

Five steps from zero to a label, in test mode first. Not legal advice.

1. Get test keys

Every shop has a shop ID, a secret key for your server and a publishable key for the browser. A test shop (gfy_sk_test_…) has every feature without a licence and is separate from your live shop. Until self-service in the customer account is ready, we send you keys on request to hello@qadsoft.dev. You see the secret key only once. More in test mode.

{
  "shop": "shp_4kq8Zt2mWc9x",
  "secretKey": "gfy_sk_test_…",
  "publishableKey": "gfy_pk_test_4kq8Zt2mWc9x_…"
}

2. Install an SDK

The SDKs for Node.js and PHP retry failed requests, set idempotency keys and verify webhook signatures. Without an SDK, everything works with curl. Store the secret key as the environment variable GARANIFY_SECRET_KEY, never in your frontend or your repository.

export GARANIFY_SECRET_KEY=gfy_sk_test_…
curl https://api.garanify.com/v1/me -H "Authorization: Bearer $GARANIFY_SECRET_KEY"
# not on npm yet; until then from the repository
npm install ./packages/sdk-js

export GARANIFY_SECRET_KEY=gfy_sk_test_…
# not on Packagist yet; until then as a path repository
composer config repositories.garanify path ./packages/sdk-php
composer require garanify/sdk:@dev guzzlehttp/guzzle

export GARANIFY_SECRET_KEY=gfy_sk_test_…

3. Register a product

A PUT on the SKU creates or replaces the product. The model identifier on the label is the MPN, otherwise the SKU, never the EAN. The GARAN label only appears for a producer guarantee of more than 2 years with brand and model.

curl -X PUT "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Washing machine W1","brand":"Miele","mpn":"WCR 870 WPS","categories":["Household > Washing machines"],"garan":{"years":10}}'
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const product = await garanify.products.upsert('WCR870', {
  name: 'Washing machine W1',
  brand: 'Miele',
  mpn: 'WCR 870 WPS',
  categories: [
    'Household > Washing machines'
  ],
  garan: {
    years: 10
  }
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$product = $garanify->products->upsert('WCR870', [
    'name' => 'Washing machine W1',
    'brand' => 'Miele',
    'mpn' => 'WCR 870 WPS',
    'categories' => [
        'Household > Washing machines',
    ],
    'garan' => [
        'years' => 10,
    ],
]);
import os, requests

res = requests.put(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
    json={
        "name": "Washing machine W1",
        "brand": "Miele",
        "mpn": "WCR 870 WPS",
        "categories": [
            "Household > Washing machines",
        ],
        "garan": {
            "years": 10,
        },
    },
    timeout=10,
)
res.raise_for_status()
data = res.json()

4. Check the result

The resolution tells you which label applies and why, like in the admin of the plugins.

curl "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870/resolve?lang=de" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY"
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const resolution = await garanify.products.resolve('WCR870', {
  lang: 'de'
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$resolution = $garanify->products->resolve('WCR870', 'de');
import os, requests

res = requests.get(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870/resolve?lang=de",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
    timeout=10,
)
res.raise_for_status()
data = res.json()

5. Show it in your shop

One line on the product page. The snippet loads the label from the API and inserts notice and label after the buy button. Headless or server-rendered also works without the snippet, see Embed with the API. Once everything looks right, repeat steps 3 to 5 with your live keys.

<script src="https://cdn.garanify.com/garanify.min.js" defer
        data-garanify-key="gfy_pk_test_4kq8Zt2mWc9x_…"
        data-sku="WCR870"></script>

Basics

  • Base URL https://api.garanify.com (hosting in preparation), every path starts with /v1.
  • JSON in UTF-8, times in ISO 8601 (UTC). Errors as application/problem+json.
  • The complete description is the OpenAPI 3.1 file; the reference is generated from it.
  • Free shows the notice without limit and the GARAN label for up to 25 products. Pro and Agency: unlimited, rules, bulk upserts.