Catalogue and extras through the API: showing prices on your site and buying SSL or SiteLock

WhatsApp & APIs·· 44 views· 4 min read

The short answer: with catalog:read, the API returns the products on sale, the domain extensions, the currencies and the billing cycles, with prices, in your account currency or the one you ask for in currency. With extras:read you see the account's extras and what is for sale; with extras:write and billing:purchase you buy some of them with credit.

The catalogue

Operation What it returns
GET /v1/catalog/products Products on sale, with the price for each cycle, in pages. Filter group_id.
GET /v1/catalog/tlds Registration, renewal and transfer prices, by number of years. A number of years that does not appear is not available. One extension only: ?extension=com.
GET /v1/catalog/currencies The currencies accepted in currency.
GET /v1/catalog/billing-cycles The cycle names used in prices and services.

Showing prices on your website

1 Your server asks the API for the catalogue, with a key that only has catalog:read.
2 It keeps the answer for a while (an hour, say), instead of asking on every visit.
3 Your web pages read the stored copy, never the API directly.
Do not call the API from the browser. Browsers can only call the API from the documentation itself, so the JavaScript on one of your pages gets a CORS error. And even if it worked, the key would be visible to every visitor. The request always leaves from your server: see the CORS error.

The account's extras

GET /v1/extras returns SSL certificates, SiteLock and other products, radio streaming with its add-ons, and servers' extra IPs and disks, in pages (filter ?kind=ssl). GET /v1/extras/{id} shows one of them. Access details, such as the radio's, never come through the API: you see them in My MozOut, at manage_url.

Buying with credit

GET /v1/extras/catalog returns the products, with periods and prices in the account currency; purchasable says whether it can be bought through the API. Today that means three SSL certificates (RapidSSL, GeoTrust QuickSSL Premium and DigiCert Secure Site) and SiteLock Find, Fix and Defend.

curl https://api.mozout.com/v1/extras/purchase -X POST \
-H "Authorization: Bearer $RLX_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 7a2b9c1d-3e4f-4a5b-8c6d-9e0f1a2b3c4d" \
-d '{"product_id": 96, "billing_cycle": "annually", "site": "yourcompany.com"}'

Product What to give
SiteLock site, the site's domain. Only the periods shown in the catalogue exist: never 3 or 6 months.
Certificates No site. The certificate is set up in My MozOut after purchase, at manage_url, and its status is in certificate.

The purchase is paid only from credit, within the key's spending limit, and needs an Idempotency-Key. If credit is short, the price changes or the account profile is incomplete, nothing is charged. The answer is a 202: the action ends with the payment, and delivery is followed in GET /v1/extras/{id}, with the extra_id from the answer.

What you buy in My MozOut: a server's extra IP and disk (on the server's page), radio streaming and the other catalogue products, which need choices that only exist there. For those, the API answers 422 with portal_only and portal_url. Prices for everything are also on the pricing page.

Want to show our prices on your website or buy extras from your own system? See the API page.

See the API page

SEE ALSO

Sensitive API permissions and the spending limit: paying, buying, reinstalling, cPanel access

Idempotency-Key in our API: repeating a purchase, payment or ticket without doing it twice

Long-running API operations: the 202 answer, the action_id and following the result

The API for resellers and agencies: account, reseller programs and what the API does not cover

CORS error between your front end and your API: how to fix it

Calling a web API from PHP with cURL and reading the JSON reply

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from £5.28/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.