10-Minute Quickstart
Issue an API key, query a store with @devhelp/shop, and verify your first webhook.
This guide takes you from zero to a working integration in under ten minutes.
1. Create API keys
In the merchant dashboard (app.devhelp.pk), open Settings → API keys:
- Create a Publishable key (
dh_pk_live_…) for storefront/browser reads and add your allowed origins (for examplehttp://localhost:3000). - Create a Secret key (
dh_sk_live_…) for server-side Admin API access.
Plaintext keys are shown once at creation. Store secret keys in environment variables and never expose them in client-side code.
2. Install the SDK
pnpm add @devhelp/shop3. Read products from the Storefront API
Use createShopClient anywhere fetch is available (browser, Node, or edge):
import { createShopClient, formatMoney, paisa } from "@devhelp/shop";
const shop = createShopClient({
baseUrl: "https://api.devhelp.pk",
publishableKey: process.env.NEXT_PUBLIC_DEVHELP_PUBLISHABLE_KEY!,
});
const { items } = await shop.products.list({ limit: 12 });
for (const product of items) {
const firstVariant = product.variants[0];
const priceLabel = firstVariant
? formatMoney(paisa(firstVariant.pricePaisa))
: "No variants";
console.log(product.title, priceLabel);
}4. Query orders from the Admin API
Use createAdminClient on your backend server only (it throws if called in a browser):
import { createAdminClient } from "@devhelp/shop/server";
const admin = createAdminClient({
baseUrl: "https://api.devhelp.pk",
secretKey: process.env.DEVHELP_SECRET_KEY!,
});
const { items: orders } = await admin.orders.list({ limit: 20 });
console.log(`Fetched ${orders.length} orders`);5. Receive and verify a webhook
In Settings → Webhooks, add an HTTPS endpoint URL and subscribe to order.placed. Copy the signing secret (whsec_…) and verify deliveries with @devhelp/shop/webhooks:
import {
verifyWebhook,
WebhookVerificationError,
} from "@devhelp/shop/webhooks";
export async function POST(request: Request) {
const rawBody = await request.text();
try {
const event = await verifyWebhook({
body: rawBody,
headers: request.headers,
secret: process.env.DEVHELP_WEBHOOK_SECRET!,
});
if (event.type === "order.placed") {
// Deduplicate using event.id before processing
console.log("New order:", event.id, event.data);
}
return new Response("ok", { status: 200 });
} catch (error) {
if (error instanceof WebhookVerificationError) {
return new Response("Invalid signature", { status: 401 });
}
throw error;
}
}You now have live catalog reads, authenticated admin writes, and verified real-time events. Continue to Core Concepts or jump straight into the API Reference.