Merchant API Reference
Everything a store needs to integrate lma39ol: collecting verified reviews, displaying a trust badge, and reading your merchant billing status. Machine-readable spec: /openapi.json (OpenAPI 3.0, importable into Postman/Insomnia).
Authentication
Two credential types exist. Your storefront's backend should use an API key; the merchant dashboard uses a JWT session.
| Credential | Header | Used for |
|---|---|---|
| API key | x-api-key: lma_... | Server-to-server calls from your own store (ratings, review invitations, billing status). |
| JWT session | Authorization: bearer <token> | Dashboard actions: issuing/revoking API keys, checkout, updating your account. |
Generate an API key from an authenticated dashboard session:
curl -X POST http://localhost:3001/merchants/api-keys \
-H "Authorization: bearer <jwt>" -H "Content-Type: application/json" \
-d '{"label":"Storefront backend","scopes":["ratings:read","ratings:write"]}'
The full key is only ever returned once, in this response — store it securely.
Ratings
Every score field is optional and rated 0-5; submit whichever your integration collects. Authenticated merchant submissions are always private buyer-risk ratings, never public self-reviews — see review invitations for collecting public reviews.
/ratingsAPI key: ratings:writeRecord a private rating about a buyer for your own risk screening.
curl -X POST http://localhost:3001/ratings \
-H "x-api-key: lma_..." -H "Content-Type: application/json" \
-d '{"orderReference":"ORD-1042","productQuality":5,"deliveryTime":4,"comment":"Smooth transaction"}'
/ratings?page=1&limit=20API key: ratings:readPaginated list, filterable by from/to date range.
/ratings/buyer-riskAPI key: ratings:readCancellation/return rate and a low/medium/high risk band for a buyer.
/ratings/:ratingId/replyJWT, merchant-owned onlyPublicly reply to a review left about your store.
Review invitations & QR codes
The only way to collect a public, order-linked review: issue a one-time invitation per delivered order, print its QR code on the receipt, and let the buyer scan it later at their own pace.
/review-invitationsAPI key: ratings:writecurl -X POST http://localhost:3001/review-invitations \
-H "x-api-key: lma_..." -H "Content-Type: application/json" \
-d '{"orderReference":"ORD-1042","buyer":{"firstName":"Amina","lastName":"K.","email":"amina@example.com"},"expiresInDays":14}'
Response includes reviewUrl and a printable qrCodeDataUrl (base64 PNG). One invitation per order — reissuing for the same orderReference returns 409.
/review-invitations?page=1&limit=20API key: ratings:read/public/review-invitations/:tokennone — buyer-facing/public/review-invitations/:token/reviewnone — buyer-facingYour storefront never calls these directly — the QR code points buyers straight at the hosted page /review/:token, which calls them for you.
Trust badge
/trust/merchants/:merchantIdnone — public, embeddableFetchable directly from your storefront's frontend (your customers' browsers) — no API key needed. Returns the aggregated overall score, per-dimension breakdown, and a confidence band (limited / growing / established) based on review volume.
/merchants/me/trustJWTThe same data, for your own dashboard.
Billing
/public/payments/plansnonePublic pricing catalog.
/payments/subscriptionAPI key or JWTReturns { planId, status, isActive, currentPeriodEnd, cancelAtPeriodEnd } — useful for gating features in your own integration on plan status.
/payments/checkout-sessionsJWT/payments/portal-sessionsJWTRedirect your dashboard user to the returned URL to subscribe or manage billing via Stripe's hosted pages.
Errors & rate limits
Every response is JSON with a success boolean. Failures include errorCode, a human-readable message, and sometimes a per-field errors object.
{ "success": false, "errorCode": "A0013", "message": "unauthorized !" }
API-key authenticated ratings endpoints are limited to 100 requests/hour per key; exceeding it returns 429.