Customers
auth, customer profile, orders, and addresses resource methods.
Open in
These methods require a logged-in customer (a session token). With the Next.js adapter the session cookie supplies it automatically.
auth
| Method | Description |
|---|---|
auth.requestOtp(input, options?) | Send a login OTP. Input: { phone }. |
auth.verifyOtp(input, options?) | Verify OTP, start a session (token auto-persisted). Input: { phone, otp, guestCartId? }. |
auth.logout(options?) | Invalidate the token and clear the session store. |
auth.getToken() | The current bearer token from the session store. |
await storekit.auth.requestOtp({ phone: "+919999999999" });
const { data } = await storekit.auth.verifyOtp({ phone: "+919999999999", otp: "123456" });
// data → { token, expiresAt?, customer }The Next.js and browser facades take positional args instead —
auth.requestOtp(phone) and auth.verifyOtp(phone, otp) — and manage the
session cookie for you. See Authentication.
customer
customer.get(options?)
The authenticated customer's profile.
const { data: me } = await storekit.customer.get();
// { id, phone, name, email, createdAt, updatedAt }customer.update(input, options?)
Update name / email.
await storekit.customer.update({ name: "Ada Lovelace", email: "[email protected]" });orders
Both endpoints carry a per-store human orderNumber, the full charge breakdown,
and the shipping / billing address, so an order page can itemise totals instead
of deriving a remainder. The single-order endpoint adds payment, refunds, a
status timeline, shipments, and a receipt link — the list omits those to stay
lean.
customer.orders.list(query?, options?)
Order history (keyset pagination). Includes lifetime totalSpent.
const { data } = await storekit.customer.orders.list({ limit: 20, cursor });
// data → { data: Order[], nextCursor, hasMore, totalSpent }customer.orders.get(orderId, options?)
A single order by id, including line items, delivery tracking, and (while
pending) a paymentRedirectUrl.
const { data: order } = await storekit.customer.orders.get(orderId);
order.orderNumber; // per-store human number, e.g. 1042
order.subtotal; // plus taxAmount, deliveryCharge, packagingCharge,
// discountAmount, total — numbers in order.currency
order.deliveryDistanceKm; // number | null
order.shippingAddress; // { firstName, lastName, address, city, state,
order.billingAddress; // zipCode, country, latitude?, longitude? } | null
// billingAddress defaults to shipping at checkout
// detail-only:
order.payment; // { transactionId, providerRef, amount, paidAt,
// method, last4, upiId, reference } | null (null until paid;
// instrument fields are best-effort, any may be null)
order.refunds; // Array<{ id, amount, reason, createdAt }>
order.statusEvents; // Array<{ fromStatus, toStatus, action, createdAt }> (oldest→newest)
order.shipments; // Array<{ awbCode, carrier, trackingUrl, status, items, … }>
order.invoiceUrl; // signed, time-limited link to a printable HTML receiptTypes are exported from the SDK: Order, OrderItem, OrderShippingAddress,
OrderPayment, OrderRefund, OrderStatusEvent, OrderShipment.
addresses
A customer may save up to 10 addresses. The first one — or any created with
isDefault: true — becomes the default.
| Method | Description |
|---|---|
customer.addresses.list(options?) | All saved addresses. |
customer.addresses.create(input, options?) | Create an address. |
customer.addresses.update(addressId, input, options?) | Update an address. |
customer.addresses.delete(addressId, options?) | Delete an address. |
const { data: address } = await storekit.customer.addresses.create({
firstName: "Ada",
address: "1 Market St",
city: "Bengaluru",
state: "KA",
zipCode: "560001",
country: "IN",
isDefault: true,
});In the browser, prefer the useAddresses()
hook — it wraps these methods in a shared store with optimistic create / update /
delete, so the list updates instantly and reconciles in the background.