Start here
Getting started
1. Get keys
Your storefront is an app on the merchant's store with two keys. During the beta, Storepecker sets the app up with the merchant and sends you the keys (later merchants will do this themselves in their dashboard):
| Key | Looks like | Use it |
|---|---|---|
| Publishable | sp_pk_live_… | In the browser. Works only from the websites the merchant allowed for your app. |
| Secret | sp_sk_live_… | On your server only. Never in browser code, a mobile app or a public repo. |
Test keys (sp_pk_test_…, sp_sk_test_…) work only against the staging API; live keys only against production. Tell us every website that will call the API from a browser (for example https://shop.example.com and http://localhost:3000); they become the app's allowed websites.
2. Make your first call
curl https://storefront-api.storepecker.com/v1/store \
-H "Authorization: Bearer sp_sk_live_…"
{
"id": "st_3kTMd2N8x0aQb9LmZcY1Pf",
"name": "Rareyna",
"currency": { "code": "INR", "symbol": "₹" },
"login_methods": ["phone_otp", "email_otp"],
"checkout": { "guest_checkout_enabled": true, "cash_on_delivery_enabled": true, "…": "…" }
}
Every request carries the key in Authorization: Bearer …. The key alone decides which store you talk to.
3. Use the SDK (recommended)
npm install @storepecker/storefront-sdk
import { createStorefrontClient, formatMoney } from '@storepecker/storefront-sdk';
const client = createStorefrontClient({ apiKey: process.env.STOREPECKER_SECRET_KEY! });
const { data } = await client.products.list({ sort: 'price_asc', limit: 12 });
data.forEach((p) => console.log(p.name, formatMoney(p.price_range.min)));
The SDK is typed from the API's own spec, has no dependencies, and runs in browsers, Node 18+ and edge runtimes.
4. Or start from the starter storefront
starter/ in this repo is a complete Next.js store built only on the SDK: home page with the merchant's banners and Instagram reels, product pages, cart, OTP login, account, checkout and order tracking, styled from the merchant's dashboard.
cp starter/.env.example starter/.env.local # STOREPECKER_SECRET_KEY, STOREPECKER_API_URL
npm install && npm run dev # http://localhost:3000
Environments
| Base URL | Keys | |
|---|---|---|
| Production | https://storefront-api.storepecker.com | sp_*_live_* |
| Staging | provided with your test keys | sp_*_test_* |