Build your first Qeersh app
Qeersh API reference · v1An app is a web service you host. Merchants install it from the app store; it then uses the Qeersh API on their store with the permissions they approved.
1. Register the app
In the developer portal, create an app, copy its client secret, add your redirect URL and the permissions you need, then create a development store to try it.
2. Send the merchant to approve
Redirect the store owner to the install URL. After they approve, Qeersh sends them back to your redirect URL with code, state and shop.
https://qeersh.com/oauth/authorize?client_id=qapp_…&shop=STORE&redirect_uri=https://your-app.example/callback&state=RANDOM
3. Exchange the code for a token
Within 10 minutes, exchange the code (once) from your server. Keep the access token on your server and call the API on the store's address.
$response = Http::asForm()->post('https://qeersh.com/oauth/token', [
'grant_type' => 'authorization_code',
'client_id' => 'qapp_…', 'client_secret' => 'qcs_…',
'code' => $request->query('code'), 'redirect_uri' => 'https://your-app.example/callback',
]);
// { "access_token": "qsk_…", "scope": "orders:read,…", "shop": "STORE", "token_type": "Bearer" }
4. Show your page in the admin
Set an admin page URL. Qeersh opens it with ?shop=…&session=… where session is a one-minute token signed with your client secret. Verify it before showing anything.
[$header, $payload, $signature] = explode('.', $request->query('session'));
$expected = rtrim(strtr(base64_encode(hash_hmac('sha256', "$header.$payload", $clientSecret, true)), '+/', '-_'), '=');
abort_unless(hash_equals($expected, $signature), 401);
$claims = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
abort_unless($claims['aud'] === 'qapp_…' && $claims['exp'] >= time(), 401);
5. Listen for events
Subscribe to webhooks with your token (needs the webhooks permission). When a merchant removes your app, we POST app/uninstalled to your events URL and the token stops working.
POST https://STORE.qeersh.com/api/v1/webhooks
{"topic": "orders/paid", "url": "https://your-app.example/webhooks"}
6. Submit for review
Complete the listing in both languages, add a privacy policy and support email, and submit. We check security, performance, right-to-left layout, translations and permissions.