Skip to content
Select theme
Light
Dark
Auto
Select language
English
فارسی

Cart

Object

A delivery company.

String!

A stable code: IRAN_POST, TIPAX, CHAPAR, ALOPEYK, SNAPP_BOX.

String!

The carrier’s name in the current locale.

Image

The carrier’s mark.

Object

A buyer’s basket.

Long-lived and recoverable: the id is what a theme persists in a cookie or in local storage, and a cart survives a browser restart. It expires eventually (expiresAt), at which point every operation on it returns EXPIRED and the theme should create a new one.

It also ends when checkout turns it into an order, or when it is given up. cart(id) then answers null, a mutation on it is refused as INVALID_STATE, and the theme creates a new one exactly as it does for an expired cart.

Prices are recomputed on every read. A cart is a set of intentions, not a quotation — a merchant who changes a price changes it for carts already holding the item, and the PRICE_CHANGED warning is how a theme learns to say so.

ID!

A globally unique, opaque identifier. Never parse or construct one.

URL!

Where to send the buyer to pay.

Single-use in spirit and short-lived in practice — mint it when the buyer clicks, not when the cart page renders. Opening it starts hosted checkout, which owns everything from payment method selection onward.

CartLineConnection!

The lines, in the order they were added.

ArgumentTypeMeaning
firstIntNo description.
afterStringNo description.
lastIntNo description.
beforeStringNo description.

Int!

Total units across every line — the number for the header badge.

Distinct from the line count: three of one thing is one line and three units.

CartCost!

What the cart costs, broken out.

String

A note the buyer left for the merchant.

[Attribute!]!

Arbitrary key/value data the theme attached — a gift message, a referrer, an Instagram post id.

Carried onto the order and shown to the merchant. Not secret: it round-trips through a public API and a buyer can read and change it.

CartBuyerIdentity!

Who is buying.

[CartDiscountCode!]!

Codes the buyer entered, each marked with whether it actually applied.

A code that did not apply is kept rather than dropped so the theme can say why — silently discarding it looks like a bug to the buyer who typed it.

[CartDiscountAllocation!]!

Every discount now reducing the total, from a code or applied automatically.

CartDelivery!

Where it is going and how.

InvoiceRequest

Whether the buyer has asked for an official invoice — فاکتور رسمی — and the legal identity to issue it to.

Null until asked for. Requesting one commits the merchant to filing an electronic invoice through سامانه مودیان, so the fields it needs are collected here rather than discovered at the tax deadline.

[PaymentOption!]!

What this cart can be paid with, and why anything is unavailable.

Authoritative, unlike Shop.paymentOptions: it accounts for the total, the destination, and what is in the basket. Cash on delivery outside a courier’s range is absent here and present there.

DateTime!

When the buyer started it.

DateTime!

When it last changed.

Moves on every mutation, and on a price change the buyer never made — a cart is repriced on read, so this is not a safe cache key for its contents.

DateTime!

When the cart stops working.

Extended by activity. A theme that shows a persistent basket should handle EXPIRED by making a new cart, not by showing an error.

Object

Who is buying.

String

Mobile number, 09xxxxxxxxx.

The primary identifier here, not email: authentication is SMS-OTP, order notifications are SMS, and the courier calls this number.

String

Email, when the buyer gave one. Optional, and frequently absent.

Customer

The signed-in buyer, or null for a guest.

Set by passing a customer access token from the Customer Account API to cartBuyerIdentityUpdate. Signing in mid-checkout attaches the cart to the account rather than replacing it.

Input

Who is buying.

String

The buyer’s telephone number. The one identifier an Iranian checkout actually needs; email is optional and often absent.

String

Their email, when the theme collected one.

String

A customer access token from the Customer Account API.

Attaches the cart to that account. Never echoed back on CartBuyerIdentity.

Object

What the cart costs.

Shipping and tax are null until enough is known to compute them — there is no delivery cost before there is a destination. Null means unknown, never zero; a theme that renders a null as “رایگان” has promised free delivery.

Money!

Every line’s subtotal, before cart-level discounts.

Money!

Everything taken off, cart-level and line-level together.

Money

Delivery, once an address and an option are chosen. Null before that.

Money

VAT — مالیات بر ارزش افزوده — once computable. Null before that.

Money!

What the buyer will pay, as far as is currently known.

Still moves after this, in two ways: a delivery option not yet chosen is not yet in it, and neither is any payment surcharge — that is knowable only once a method is picked, in hosted checkout. Read Cart.paymentOptions.surcharge to show it on a cart page.

Object

Where the cart is going, and how.

Address

The destination. Null until the buyer supplies one.

CartDeliveryGroupConnection!

The cart split into groups that ship together.

Usually one. More when the quote priced some lines under different rules — furniture and a shirt genuinely ship as two parcels, frequently by two carriers — or when some are digital and need no delivery at all.

A group does not name a location. The grouping is by the rules that priced it, and where the goods sit is decided when stock is held, which is after the buyer has chosen. A theme that read a warehouse out of a group would be reading something no part of the platform puts there.

ArgumentTypeMeaning
firstIntNo description.
afterStringNo description.
Object

A set of lines that will be delivered together.

ID!

A globally unique, opaque identifier. Never parse or construct one.

CartLineConnection!

The lines in this group.

ArgumentTypeMeaning
firstIntNo description.
afterStringNo description.

Address

Where this group is going.

[CartDeliveryOption!]!

What is on offer for this group.

Empty until there is an address — no carrier quotes a price without a destination. Empty with an address means nothing delivers there, which a theme must surface rather than treat as a loading state.

CartDeliveryOption

What the buyer chose, or null before they choose.

Object

A page of delivery groups.

[CartDeliveryGroupEdge!]!

Each CartDeliveryGroup with its cursor. Use this when you need to page.

[CartDeliveryGroup!]!

The CartDeliveryGroups themselves, unwrapped. Use this when you do not.

PageInfo!

Whether there is more, and the cursors to ask with.

Object

One delivery group, with its cursor.

String!

This position in the current ordering. Pass it as after or before.

CartDeliveryGroup!

The CartDeliveryGroup at this position.

Object

One way a group can be delivered.

String!

The stable handle to send back to select it.

String!

What to call it — “پست پیشتاز”, “تیپاکس”, “پیک موتوری”.

Merchant and carrier data; safe to render.

String

A sentence of detail the merchant wrote.

Money!

What it costs. Zero for free delivery, which is not the same as null.

For a cart spanning more than one shipping profile — a sofa and a shirt — this is the sum of what each profile charges, because they ship as separate parcels and that is what the merchant is charged. profileBreakdown has the parts.

[DeliveryProfileCharge!]!

What each shipping profile contributed, when the cart spans more than one.

Empty for the ordinary single-profile cart, which is almost all of them. A theme that ignores this shows one delivery line and is correct; one that renders it can explain why a sofa and a shirt cost more to deliver than either alone, which is the question that otherwise arrives as an abandoned cart.

Boolean!

Whether this price is a reused quote rather than a live one.

True when the carrier did not answer and the last successful quote for this zone and weight band was used instead. The buyer can still check out; a theme should say «تخمینی» rather than presenting it as exact, and the final charge may differ slightly.

Always false for rates the merchant priced themselves, which is most of them.

Carrier

The carrier behind it, when there is a named one.

DeliveryWindow

When it should arrive.

DeliveryMethodType!

How it is delivered — for grouping options in the UI.

PickupLocation

Where to collect, when method is PICKUP.

Input

One group’s chosen delivery option.

ID!

The group being chosen for.

String!

The option’s handle, from that group’s deliveryOptions.

Object

One discount, and how much of the cart it took off.

Money!

How much came off.

String

The merchant’s name for the discount — تخفیف نوروزی.

Merchant data; safe to render. Null for a discount the merchant did not name.

String

The code that triggered it, or null when it applied automatically.

DiscountTargetType!

What it applied to.

Object

A code the buyer entered.

String!

As typed, normalized to the case the merchant defined.

Boolean!

Whether it is actually reducing the total.

False for a real code the cart does not qualify for as well as for one that does not exist — the two are not distinguished, because saying “that code exists but you cannot use it” is how a discount meant for one segment leaks to everyone.

Input

Everything a cart can be created with. Every member is optional.

[CartLineInput!]

The lines to start with. A cart may be created empty.

String

The buyer’s note for the merchant.

[AttributeInput!]

Cart-level key/value data. Not secret; the buyer can read it.

CartBuyerIdentityInput

Who is buying, as far as the theme knows at this point.

[String!]

Codes to try immediately — a campaign link that opens with one already applied.

Object

One merchandise line.

ID!

A globally unique, opaque identifier. Never parse or construct one.

ProductVariant!

What is being bought. Always a variant.

Int!

How many. At least one; a line at zero is removed rather than kept.

[Attribute!]!

Line-level key/value data — a monogram, a chosen delivery date.

CartLineCost!

What this line costs, before and after its discounts.

[CartDiscountAllocation!]!

The discounts reducing this line specifically.

Object

A page of cart lines.

[CartLineEdge!]!

Each CartLine with its cursor. Use this when you need to page.

[CartLine!]!

The CartLines themselves, unwrapped. Use this when you do not.

PageInfo!

Whether there is more, and the cursors to ask with.

Object

What one line costs.

Money!

Unit price at the moment of reading.

Money!

amountPerQuantity × quantity, before discounts.

Money!

After this line’s discounts.

Money

The unit’s compare-at price, when it has one.

Object

One cart line, with its cursor.

String!

This position in the current ordering. Pass it as after or before.

CartLine!

The CartLine at this position.

Input

A line to add.

ID!

The variant to buy. Not a product id — a product is not purchasable.

Int!

How many. At least one.

[AttributeInput!]

Line-level key/value data.

Input

A change to an existing line.

quantity is absolute, not a delta. Setting three means three, whatever it was. A delta would make every retry of a dropped request add stock the buyer did not ask for, and on a connection that drops requests routinely that is not a hypothetical.

ID!

The line to change.

Int

The new quantity. Zero removes the line.

ID

A different variant — how a size change is made without losing the line.

[AttributeInput!]

Replaces the line’s attributes entirely.

Object

What every cart mutation returns.

One payload type rather than one per mutation, because every cart mutation returns exactly these three things and nothing suggests any of them will diverge. A mutation that later needs to return something else gets its own type then; inventing eleven identical types now would only make the schema longer to read.

cart is populated even when userErrors is not empty — it is the cart as it now stands, unchanged. A theme should re-render from it either way.

Cart

The cart after the operation, or null when it could not be found at all.

[UserError!]!

Why the operation declined. Empty on success.

[CartWarning!]!

What the platform changed on the buyer’s behalf. May be non-empty on success.

Object

Where to send the buyer to pay.

Hosted by Kaladan on the shop’s own domain, so the buyer never appears to leave the merchant. It collects the payment method, redirects to the PSP, and handles the return leg — verification, reconciliation, and order creation.

URL!

Send the buyer here.

String!

The opaque token identifying this attempt.

Hold it: hosted checkout returns the buyer to returnUrl with an order token, and this is what ties an abandoned attempt back to the cart it came from.

DateTime!

When the handoff stops working.

Short — minutes, not hours — because it reserves stock. An expired handoff is restarted, not resumed.

Object

What cartCheckoutStart returns.

CheckoutHandoff

The handoff, or null when the cart cannot proceed to payment.

Cart

The cart as it now stands.

[UserError!]!

Why checkout could not start.

INVALID_STATE when something required is missing — no address, no delivery option chosen, no contact number. INSUFFICIENT_STOCK when the basket no longer fits what is on hand. UNAVAILABLE when a line stopped being sellable.

[CartWarning!]!

What the platform changed on the buyer’s behalf while starting checkout. May be non-empty on success.

The most consequential warnings in this API arrive here. This is the last call before the buyer is handed to payment, and a quantity trimmed to stock or a line dropped for going unpurchasable means the total they are about to pay is not the total they agreed to. Show them and let the buyer confirm before following checkout.url; sending them straight on is how a shop takes money for a basket nobody approved.

Object

A signed-in buyer, as much of one as a storefront needs.

Deliberately thin. Order history, the address book, wishlists, and anything else tied to an authenticated buyer live in the Customer Account API, behind that API’s own token — reachable from a public storefront token they must not be.

ID!

A globally unique, opaque identifier. Never parse or construct one.

String

Given name — نام.

String

Family name — نام خانوادگی.

String!

Whatever there is to greet them by: the full name, else the phone number.

Composed here so every theme greets a buyer the same way and none of them has to decide what to do when only half a name was given.

String!

The account’s mobile number.

Non-null because it is the account’s identity: a Kaladan customer is created by verifying a number, so one cannot exist without it.

String

The account’s email, when there is one.

Enum

How a delivery reaches the buyer.

ValueMeaning
SHIPPINGA carrier ships it.
PICKUPThe buyer collects it.
LOCAL_DELIVERYThe merchant delivers it locally, often same-day.
NONENothing ships — a digital product.
Object

What one shipping profile contributed to a delivery option’s price.

A cart holding goods that do not ship alike pays for each parcel. This says which parcel cost what, so a storefront can explain the total instead of presenting a number that looks wrong.

String!

The profile’s name, as the merchant wrote it — «مبلمان».

Money!

What this profile’s rate charged.

Int!

How many of the cart’s lines fall under it.

Boolean!

Whether this profile’s charge was waived by its own free-shipping threshold.

Thresholds apply per profile, against that profile’s own subtotal: two shirts and a sofa do not earn free sofa delivery because the shirts pushed the cart total over the line.

Object

When something should arrive.

Both bounds may be null when the carrier will not commit to an estimate, which several Iranian couriers will not.

DateTime

Earliest expected arrival.

DateTime

Latest expected arrival.

Int

Business days, as the carrier states it.

Alongside the timestamps rather than derived from them, because “۲ تا ۳ روز کاری” is what the carrier promises and what the merchant is held to; the timestamps are this platform’s reading of it against a holiday calendar.

Enum

What a discount reduced.

ValueMeaning
LINE_ITEMOne or more lines.
ORDERThe order total.
SHIPPINGThe delivery cost.
Enum

Who an official invoice is issued to.

The buyer classes سامانه مودیان recognises. FINAL_CONSUMER is the default and covers an ordinary retail sale, where no identifying detail is required at all.

ValueMeaning
FINAL_CONSUMERمصرف‌کننده نهایی — a retail buyer, identified by nothing.
INDIVIDUALشخص حقیقی — an individual, identified by کد ملی.
LEGAL_ENTITYشخص حقوقی — a company, identified by شناسه ملی and کد اقتصادی.
PARTNERSHIPمشارکت مدنی — a civil partnership.
NON_IRANIANاتباع غیرایرانی — a non-Iranian national.
Object

A request for an official invoice — فاکتور رسمی.

The fields are the ones سامانه مودیان needs to accept an electronic invoice, and which of them are required depends on buyerType: an individual is identified by کد ملی, a company by شناسه ملی and کد اقتصادی. The mutation validates the combination and returns REQUIRED against the specific missing field.

Boolean!

Whether one was asked for.

InvoiceBuyerType!

What kind of buyer the invoice is issued to.

String

The name to issue it to — a person’s or a company’s.

String

کد ملی for an individual, شناسه ملی for a legal entity.

String

کد اقتصادی. Legal entities only.

String

شماره ثبت. Legal entities only.

Address

The registered address the invoice is issued to.

Input

A request for an official invoice.

Boolean!

False clears a previous request and every field with it.

InvoiceBuyerType

Whether the invoice is for a person or a company. Decides which of the fields below are required.

String

The name the invoice is issued to — a person’s full name, or the registered company name exactly as ثبت شرکت‌ها holds it.

String

کد ملی for a person, شناسه ملی for a company. Ten digits and eleven respectively; the check digit is validated.

String

کد اقتصادی. Required for a company, meaningless for a person.

String

شماره ثبت. Companies only.

AddressInput

The legal address the invoice is issued to, which need not be where the order is delivered.

Object

Somewhere a buyer can collect an order.

ID!

A globally unique, opaque identifier. Never parse or construct one.

String!

The location’s name.

Address!

Where it is.

String

Opening hours, as the merchant wrote them.

String

Instructions for collection.