Tax and Moadian
CommodityCodeInput
Section titled “CommodityCodeInput”One line’s commodity code.
Exactly one of orderLineId and lineId. A line that came from the sale is
named by its order line; one that came from no order line — the delivery
charge — by MoadianInvoiceLine.id. Both, or neither, is INVALID.
orderLineId
Section titled “orderLineId”ID
No description.
lineId
Section titled “lineId”ID
No description.
commodityCode
Section titled “commodityCode”String!
No description.
MoadianBatchPayload
Section titled “MoadianBatchPayload”What a bulk filing returns.
Job
The job doing the filing. Poll it, or wait for its completion event.
queuedCount
Section titled “queuedCount”Int!
How many invoices were queued.
userErrors
Section titled “userErrors”[UserError!]!
No description.
MoadianInvoice
Section titled “MoadianInvoice”An electronic invoice — صورتحساب الکترونیکی.
The record of what is owed to the tax system for one order, and of every attempt to file it.
ID!
No description.
Order!
No description.
String
شماره منحصر به فرد مالیاتی — assigned when a submission is accepted.
Null until then, which is why it cannot be used as this object’s identity.
status
Section titled “status”MoadianInvoiceStatus!
No description.
invoiceType
Section titled “invoiceType”MoadianInvoiceType!
الگوی صورتحساب — the legal pattern. Type 1 is the ordinary retail sale.
Distinct from subject below, and conflating them was a real defect: the tax
system asks two separate questions and this schema answered them with one
field.
subject
Section titled “subject”MoadianInvoiceSubject!
موضوع صورتحساب — what this filing does to the record.
اصلی for an original, اصلاحی to correct one, ابطالی to cancel one, برگشتی for a sales return. A correction of a type-1 retail sale is still type 1; only the subject changes. Filing it as a different type is a rejection.
buyerType
Section titled “buyerType”InvoiceBuyerType!
Who it is issued to.
buyerLegalName
Section titled “buyerLegalName”String
No description.
buyerNationalIdMasked
Section titled “buyerNationalIdMasked”String
کد ملی or شناسه ملی, masked.
buyerEconomicCode
Section titled “buyerEconomicCode”String
No description.
[MoadianInvoiceLine!]!
No description.
totalBeforeTax
Section titled “totalBeforeTax”Money!
No description.
totalTax
Section titled “totalTax”Money!
No description.
totalAmount
Section titled “totalAmount”Money!
No description.
submissions
Section titled “submissions”[MoadianSubmission!]!
Every attempt to file it, newest first.
Plural because rejection is normal: a mistyped identifier produces a rejection with a code, the merchant corrects it, and a second submission goes out. A merchant asking “why has this not been accepted” is asking to read this list.
DateTime
When it must be filed by.
Computed from the order date and the regulated window. An admin should sort by it and shout before it passes, because the penalty lands on the merchant and the platform is what they will blame.
correctsInvoice
Section titled “correctsInvoice”MoadianInvoice
The accepted invoice this supersedes, cancels or returns against.
Null for an original. Required for every other subject, and the tax system refuses a correction that does not name what it corrects.
supersededBy
Section titled “supersededBy”[MoadianInvoice!]!
Filings made against this one — corrections, a cancellation, returns.
The other direction, and the one an accountant actually reads: given an invoice, what happened to it afterwards. An accepted invoice with a return filed against it is not the same as an accepted invoice, and nothing but this said so.
createdAt
Section titled “createdAt”DateTime!
No description.
MoadianInvoiceConnection
Section titled “MoadianInvoiceConnection”A page of electronic invoices.
[MoadianInvoiceEdge!]!
No description.
[MoadianInvoice!]!
No description.
pageInfo
Section titled “pageInfo”PageInfo!
No description.
totalCount
Section titled “totalCount”Int
How many match across every page — when this page is the whole result. Null otherwise: the service behind this list does not count, and a number made up here would be a wrong one that looks right.
MoadianInvoiceCorrectionInput
Section titled “MoadianInvoiceCorrectionInput”Corrections to an invoice before it is resubmitted.
buyerType
Section titled “buyerType”InvoiceBuyerType
No description.
buyerLegalName
Section titled “buyerLegalName”String
No description.
buyerNationalId
Section titled “buyerNationalId”String
No description.
buyerEconomicCode
Section titled “buyerEconomicCode”String
No description.
commodityCodes
Section titled “commodityCodes”[CommodityCodeInput!]
Commodity codes for lines that lacked one, each naming its line by the order line it came from or by its own id.
MoadianInvoiceEdge
Section titled “MoadianInvoiceEdge”One invoice, with its cursor.
cursor
Section titled “cursor”String!
No description.
MoadianInvoice!
No description.
MoadianInvoiceFilter
Section titled “MoadianInvoiceFilter”A filter on the invoice list.
status
Section titled “status”[MoadianInvoiceStatus!]
No description.
invoiceType
Section titled “invoiceType”[MoadianInvoiceType!]
No description.
subject
Section titled “subject”[MoadianInvoiceSubject!]
Filter by what a filing does — originals, corrections, returns.
orderId
Section titled “orderId”ID
No description.
issuedAfter
Section titled “issuedAfter”DateTime
No description.
issuedBefore
Section titled “issuedBefore”DateTime
No description.
overdue
Section titled “overdue”Boolean
Invoices whose filing deadline has passed or is close.
The queue that matters. Everything else on this screen is history.
needsCorrection
Section titled “needsCorrection”Boolean
Invoices rejected and not yet corrected.
MoadianInvoiceLine
Section titled “MoadianInvoiceLine”One line of an electronic invoice.
ID!
This line of the filing, as a correction names it.
The only way to name a line that came from no order line — the delivery charge, which no product’s category classifies and which takes its commodity code by hand.
orderLine
Section titled “orderLine”OrderLine
The order line it came from. Null for a line added by hand.
description
Section titled “description”String!
No description.
commodityCode
Section titled “commodityCode”String
شناسه کالا/خدمت — the tax system’s own commodity code.
Required, and the field most likely to be missing: it comes from the product’s taxonomy mapping, and a product nobody classified has none.
quantity
Section titled “quantity”Float!
No description.
unitPrice
Section titled “unitPrice”Money!
No description.
discount
Section titled “discount”Money!
No description.
taxRate
Section titled “taxRate”Float!
No description.
taxAmount
Section titled “taxAmount”Money!
No description.
totalAmount
Section titled “totalAmount”Money!
No description.
MoadianInvoicePayload
Section titled “MoadianInvoicePayload”What the invoice mutations return.
invoice
Section titled “invoice”MoadianInvoice
No description.
userErrors
Section titled “userErrors”[UserError!]!
No description.
MoadianInvoiceStatus
Section titled “MoadianInvoiceStatus”Where an invoice stands with the tax system.
| Value | Meaning |
|---|---|
DRAFT | Owed, not yet queued. The state that accrues quietly. |
QUEUED | Waiting to be sent. |
SUBMITTED | Sent. No verdict yet — inquiry is a separate call. |
ACCEPTED | No description. |
REJECTED | Refused. The latest submission carries the code and the message. Not terminal: correct and resubmit. |
CANCELLED | Withdrawn after acceptance, by a cancellation filing. |
MoadianInvoiceSubject
Section titled “MoadianInvoiceSubject”موضوع صورتحساب — what this filing does to the tax record.
Orthogonal to MoadianInvoiceType. A correction to a retail sale is type 1,
subject اصلاحی. Filing it as its own type is rejected, which is the mistake
conflating the two would have produced on every correction a merchant ever
filed.
| Value | Meaning |
|---|---|
ORIGINAL | اصلی — an original filing. |
CORRECTIVE | اصلاحی — corrects an accepted invoice. Replaces it: the corrected invoice supersedes the original, which stays on file. Used for a mistyped identifier or a wrong rate. |
VOID | ابطالی — cancels an accepted invoice outright. For a sale that did not happen. Distinct from a return, where it did happen and the goods came back. |
RETURN | برگشتی — برگشت از فروش, a sales return. What an accepted invoice needs when its order is later refunded: MoadianInvoiceStatus.ACCEPTED is terminal, so a refund afterwards is filed as a return. |
MoadianInvoiceType
Section titled “MoadianInvoiceType”الگوی صورتحساب — which legal pattern this invoice follows.
The tax system’s own typing, and it answers “what sort of transaction is this”,
not “what is this filing doing”. The second question is MoadianInvoiceSubject.
| Value | Meaning |
|---|---|
TYPE_1_SALE | نوع ۱ — فروش. The ordinary retail sale, and almost everything a shop files. |
TYPE_2_AGGREGATE | نوع ۲ — a sale to a buyer with no شناسه, filed in aggregate. Declared because a shop selling to walk-in buyers without collecting a national id files these, and a model that could not express one would send the merchant back to a spreadsheet at exactly the wrong moment. |
TYPE_3_GOLD | طلا و جواهر — gold and jewellery, which are taxed on the wage, not the metal. |
TYPE_4_EXPORT | صادرات — an export sale, zero-rated. |
TYPE_5_CONTRACT | قرارداد پیمانکاری — a contracting agreement. |
MoadianMode
Section titled “MoadianMode”How invoices reach the tax system.
| Value | Meaning |
|---|---|
DIRECT | The merchant files directly, holding their own certificate. |
INTERMEDIARY | Through a شرکت معتمد — a trusted intermediary. What most merchants do. |
MoadianReturnInput
Section titled “MoadianReturnInput”What is coming back, for a برگشت از فروش filing.
[MoadianReturnLineInput!]
The lines returned, and how many of each.
Empty returns the whole invoice, which is the common case for a cancelled order — and wrong for a buyer who sent back one of three items.
refundId
Section titled “refundId”ID
The refund this return accounts for, so the two records agree.
reason
Section titled “reason”String
No description.
MoadianReturnLineInput
Section titled “MoadianReturnLineInput”One line coming back.
orderLineId
Section titled “orderLineId”ID!
No description.
quantity
Section titled “quantity”Float!
No description.
MoadianSubmission
Section titled “MoadianSubmission”One attempt to file an invoice.
ID!
No description.
referenceNumber
Section titled “referenceNumber”String
The reference the tax system returned for this attempt.
status
Section titled “status”MoadianSubmissionStatus!
No description.
submittedAt
Section titled “submittedAt”DateTime!
When it went.
lastInquiryAt
Section titled “lastInquiryAt”DateTime
When the platform last asked what became of it.
inquiryAttempts
Section titled “inquiryAttempts”Int!
No description.
errorCode
Section titled “errorCode”String
The tax system’s own error code and message, untranslated.
A pass-through of somebody else’s error rather than this API’s taxonomy: it is actionable only by the merchant or their accountant, and translating it would lose the code they will be asked to quote.
errorMessage
Section titled “errorMessage”String
No description.
errorField
Section titled “errorField”String
Which field the error names, when it names one.
MoadianSubmissionStatus
Section titled “MoadianSubmissionStatus”Where one filing attempt stands.
| Value | Meaning |
|---|---|
PENDING | Sent; the tax system has not answered. |
ACCEPTED | No description. |
REJECTED | No description. |
TIMED_OUT | The tax system did not respond at all. Retried by the platform. Distinct from REJECTED: a rejection needs the merchant, a timeout needs patience. |
TaxCertificateInput
Section titled “TaxCertificateInput”An electronic seal certificate to install.
stagedUploadId
Section titled “stagedUploadId”ID!
A staged upload of the certificate file — .p12 or .pfx.
passphrase
Section titled “passphrase”String!
The passphrase protecting it.
Write-only: no field returns it, and it is stored encrypted beside the key it protects. A merchant who loses it re-uploads.
TaxConfiguration
Section titled “TaxConfiguration”The shop’s tax settings.
vatEnabled
Section titled “vatEnabled”Boolean!
Whether the merchant charges VAT — مالیات بر ارزش افزوده.
vatRate
Section titled “vatRate”Float!
The rate, as a fraction. 0.09 for nine per cent.
A single rate, because that is what Iranian retail charges. Per-category rates are a later problem and would change this to a list.
pricesIncludeTax
Section titled “pricesIncludeTax”Boolean!
Whether displayed prices already include VAT.
Almost always true here: an Iranian shop shows the price the buyer pays. It changes how every total is computed, so it is a shop-level fact rather than a per-product one.
moadianEnabled
Section titled “moadianEnabled”Boolean!
Whether official invoices are filed with سامانه مودیان at all.
moadianMode
Section titled “moadianMode”MoadianMode
How invoices reach the tax system.
Direct requires the merchant to hold their own certificate and memory-unit id. Through a trusted intermediary — شرکت معتمد — is what most merchants do.
memoryUnitIdMasked
Section titled “memoryUnitIdMasked”String
شناسه یکتای حافظه مالیاتی — the memory-unit id.
Nothing can be filed without it. Masked on read.
intermediaryName
Section titled “intermediaryName”String
The intermediary, when filing through one.
certificateStatus
Section titled “certificateStatus”VerificationState!
Whether the electronic seal certificate is present and unexpired.
Its expiry is the failure nobody notices until filings start bouncing, so it is surfaced with a date rather than a boolean alone.
certificateExpiresAt
Section titled “certificateExpiresAt”DateTime
No description.
filingDeadlineDays
Section titled “filingDeadlineDays”Int!
How long after a sale an invoice must be filed.
Set by regulation and carried here so an admin can count down rather than making every merchant remember it.
TaxConfigurationInput
Section titled “TaxConfigurationInput”Changes to the shop’s tax settings. Partial.
vatEnabled
Section titled “vatEnabled”Boolean
No description.
vatRate
Section titled “vatRate”Float
No description.
pricesIncludeTax
Section titled “pricesIncludeTax”Boolean
No description.
moadianEnabled
Section titled “moadianEnabled”Boolean
No description.
moadianMode
Section titled “moadianMode”MoadianMode
No description.
memoryUnitId
Section titled “memoryUnitId”String
Write-only. Never returned; stored encrypted.
intermediaryName
Section titled “intermediaryName”String
No description.
TaxConfigurationPayload
Section titled “TaxConfigurationPayload”What the tax-configuration mutation returns.
taxConfiguration
Section titled “taxConfiguration”TaxConfiguration
No description.
userErrors
Section titled “userErrors”[UserError!]!
No description.