Skip to Content
devhelp shopDocs

Core Concepts

Tenancy, integer paisa currency, global E.164 phones, country-aware addresses, hierarchical shipping zones, and Cash on Delivery.

devhelp shop is built Pakistan-first with full international shipping and diaspora buyer support. Several domain primitives are first-class across the API and SDK.

Organizations and stores

An Organization owns one or more Stores. Every API key (dh_pk_live_… or dh_sk_live_…) and every OAuth 2.1 app/MCP grant is bound to a single store, so requests are automatically isolated to that store's catalog, customers, orders, and settings.

Money is integer paisa

All monetary values are integer paisa (1 PKR = 100 paisa), never floating-point numbers and never pre-formatted strings. On the wire, money uses:

{
  "amount": 250000,
  "currency": "PKR"
}

That represents Rs. 2,500. Use formatMoney and paisa from @devhelp/shop when formatting or constructing amounts.

Global E.164 phone numbers

  • Universal E.164 validation: Every phone field accepts any valid international E.164 number (/^\+[1-9]\d{6,14}$/), with Pakistan-first +92 UX (supporting both 10-digit mobiles +923XXXXXXXXX and Pakistani landlines/UAN) as well as UAE (+971), UK (+44), US/Canada (+1), Saudi Arabia (+966), Australia (+61), and all other ISO countries.
  • Customer resolution: Shoppers can check out as guests without creating an account, or sign in via the store-scoped Customer Portal. Customers are resolved per store by email first, then phone.

Country-aware addresses, separate billing & recipient delivery

Shipping addresses carry an ISO 3166-1 alpha-2 country (default "PK"), a country-adaptive province / region ("punjab", "sindh", "US-CA", "AE-DU", or free text where applicable), city, area / line1 / line2, and optional/country-adaptive postalCode.

  • Separate billing address: Online payment checkouts support an optional separate billing address so diaspora buyers can pay with foreign cards while shipping to Pakistan.
  • Deliver to someone else: Carts and orders support distinct recipientName and recipientPhone fields alongside the buyer's own contact details.

Hierarchical shipping zones & geo-restrictions

Shipping zones use a deterministic 3-level hierarchy (city > region > country) with both include and exclude rules and optional weight brackets (minWeightGrams / maxWeightGrams):

  • City-level rules override region-level rules, which override country-level rules; exclude wins ties at equal specificity.
  • Zones support optional DDU customs/duties notes (customsNote) and an export tax exemption toggle (chargeTax: false), which zero-rates sales tax cleanly.
  • PublicStore.shippingCoverage exposes derived country, region, and city restrictions so storefronts narrow address inputs cleanly and block uncovered destinations before order placement (422 shipping_not_available).

Cash on Delivery (COD) and RTO

Cash on Delivery is first-class across the order lifecycle:

  1. Order placed (order.placed): COD orders enter checkout without an online payment step.
  2. Confirmation (order.confirmed): Merchants confirm COD orders by phone or WhatsApp (or shoppers self-confirm via the Customer Portal) before dispatch.
  3. Fulfillment (fulfillment.dispatched → fulfillment.delivered or fulfillment.rto): Undelivered COD parcels return to origin (rto), feeding into customer risk signals and courier claims.
  4. Online payments: Stores can connect Safepay on their own merchant account (payment.succeeded, payment.failed, payment.refunded). devhelp never holds or routes buyer funds.

Taxes

Each store configures its own taxRateBps, pricesIncludeTax, tax classes, and optional NTN/STRN. The totals engine computes tax strictly from the store's configuration and the matched shipping zone's chargeTax flag.

On this page