wire docs

Object schemas

Wire API-ийн бүх объектын талбарын бүтэц — нэг хуудсанд.

API-ийн буцаадаг болон хүлээж авдаг бүх объектын талбарын бүтэц — нийт 23 объект. Заавал баганын ✓ нь тухайн талбар заавал байхыг заана. Хүсэлт, хариу бүрийн бодит жишээг API reference-ийн endpoint хуудсаас үз.

ListBase

Envelope of every paginated list.

ТалбарТөрөлЗаавалТайлбар
object"list"✓Always list.
urlstring✓The path this list was read from.
has_moreboolean✓true when more objects exist after this page — request again with starting_after = the last id.

Deleted

Returned by delete endpoints.

ТалбарТөрөлЗаавалТайлбар
idstringId of the deleted object.
objectstringType of the deleted object (webhook_endpoint, operator_connection).
deletedtrueAlways true.

Error

Error envelope returned with every non-2xx status.

ТалбарТөрөлЗаавалТайлбар
errorobject

PaymentIntentCreate

ТалбарТөрөлЗаавалТайлбар
amountinteger✓Amount to collect in MNT — whole tögrög, no fractional part (15000 = 15,000 ₮). 1 to 1,000,000,000. An operator may enforce its own minimum.
currency"MNT"Currency. Only MNT is supported; omit it or send MNT.
descriptionstringTransaction description shown to the payer (e.g. on the invoice / bank statement). Optional; at most 500 bytes (UTF-8 — Cyrillic letters take 2 bytes each).
automatic_operatorbooleantrue (default): at confirm, Wire routes to the best eligible operator. false: the first entry of allowed_operators is used unless /confirm names an operator — so with false you must send allowed_operators or an explicit operator.
allowed_operatorsstring[]Optional. Restricts which operators may be used for this intent. Omit it to allow every operator switched on for your project (recommended). Values are operator ids enabled on your account, as shown on the dashboard's Connectors page. An unknown id → 400 operator_unknown with param allowed_operators[i] naming the offending value; more than 10 entries is also refused.
metadataobjectYour own key/value strings (e.g. your order id), returned on every read. Up to 50 keys; keys 1–40 characters; values up to 500 characters. Violations → 400 metadata_invalid.

PaymentIntentConfirm

Optional body for confirm. An empty body (or no body) is valid.

ТалбарТөрөлЗаавалТайлбар
operatorstringOperator id to use. Optional — when omitted, routing (or the first allowed_operators entry) decides. Must be in allowed_operators if that list is set.
return_urlstringWhere the operator should send the buyer after a redirect-type payment. Passed to the operator; ignored by operators that don't redirect.

PaymentIntent

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix pi_.
object"payment_intent"Always payment_intent.
amountintegerAmount in MNT (whole tögrög).
currencystringAlways MNT.
descriptionstringTransaction description shown to the payer. Empty string when not set.
status"new" | "requires_payment_method" | "requires_action" | "requires_capture" | "processing" | "succeeded" | "canceled"- requires_payment_method — created, waiting to be confirmed (initial state; also returned to after a failed attempt). - requires_action — confirmed; the buyer must act on next_action (scan the QR, approve in a bank app, follow a redirect). - processing — the operator reported the payment; settling. - succeeded — paid. Final. - canceled — canceled by you or expired unpaid. Final. - requires_capture, new — reserved; not produced by current operators.
client_secretstringRandom secret generated for the intent (cs_…). Not needed by any /v1 call; do not expose it publicly.
automatic_operatorbooleanWhether routing chooses the operator at confirm (see PaymentIntentCreate).
allowed_operatorsstring[]The operator restriction you set; [] means every operator enabled on the project.
selected_operatorstring | nullThe operator chosen at confirm; null until confirmed.
next_actionobjectWhat the buyer must do next. Set when status is requires_action, otherwise null.
metadataobjectYour key/value strings; {} when none.
livemodebooleanAlways true on this API (the object was created with a live key).
createdintegerCreation time, Unix seconds (UTC).
expires_atinteger | nullWhen an unpaid intent expires, Unix seconds (UTC). By default 10 minutes after creation; confirm may replace it with the operator invoice's own expiry. Expired unpaid intents are canceled automatically.

NextAction

Operator-agnostic instruction for the buyer. Read type, then the field of the same name.

ТалбарТөрөлЗаавалТайлбар
type"qr" | "redirect_to_url" | "loan_app" | "loan_credit_decision" | "poll"✓- qr — show qr.text as a QR code (or qr.image_url), and offer qr.deeplinks on mobile. - redirect_to_url — send the buyer to redirect_to_url.url. - loan_app — open loan_app.deeplink in the lender's app. - loan_credit_decision — the lender is deciding; just wait. - poll — nothing to show; wait for the result.
qrobject
redirect_to_urlobject
loan_appobject
loan_credit_decisionobject
pollobject

CheckoutSessionCreate

ТалбарТөрөлЗаавалТайлбар
payment_intentstring✓Id of a PaymentIntent in requires_payment_method (pi_…).
success_urlstringOptional. Absolute http(s) URL the buyer returns to after paying. Omit it to show Wire's own completion screen.
cancel_urlstringOptional. Absolute http(s) URL the buyer returns to if they abandon the payment.
allowed_operatorsstring[]Optional. Operator ids to offer on this page; defaults to the intent's allowed_operators, else every operator enabled on the project. Operators without an active connection on the project are never shown.

CheckoutSession

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix cs_.
object"checkout_session"Always checkout_session.
payment_intentstringThe PaymentIntent this page collects.
status"open" | "complete" | "expired"open — buyer can pay; complete — the intent was paid; expired — the intent expired before payment.
urlstringThe hosted payment page. Redirect the buyer here.
success_urlstringAs sent; empty string when not set.
cancel_urlstringAs sent; empty string when not set.
allowed_operatorsstring[]As sent; [] when not set.
createdintegerCreation time, Unix seconds (UTC).

Charge

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix ch_.
object"charge"Always charge.
payment_intentstringThe PaymentIntent this charge belongs to.
operatorstringId of the operator that handled the charge.
operator_charge_idstring | nullThe operator's own reference for this payment (invoice id). Use it when talking to the operator.
status"pending" | "succeeded" | "failed"pending — waiting for the buyer; succeeded — paid (final); failed — not paid (final).
amountintegerAmount in MNT (whole tögrög).
feeintegerFee in MNT recorded on this charge. Currently always 0 — operator fees are not reported through this field.
amount_refundedintegerMNT already refunded or reserved by refunds in progress (including manual_required). Refundable remainder = amount − amount_refunded.
failure_codestring | nullWhy the charge failed; null unless failed.
failure_messagestring | nullHuman-readable failure reason; null unless failed.
livemodebooleanAlways true on this API.
createdintegerCreation time, Unix seconds (UTC).

RefundCreate

ТалбарТөрөлЗаавалТайлбар
chargestring✓The succeeded charge to refund (ch_…). Find it with GET /v1/charges?payment_intent=pi_….
amountintegerMNT to refund. Omit for the full remaining amount. Must not exceed amount − amount_refunded of the charge.
reasonstringOptional free-text reason, at most 500 bytes.

Refund

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix re_.
object"refund"Always refund.
chargestringThe refunded charge.
amountintegerRefunded amount in MNT.
reasonstring | nullThe reason you sent; null when none.
status"pending" | "succeeded" | "failed" | "manual_required"- succeeded — money returned through the operator. - manual_required — the operator does not support API refunds; recorded and completed by Wire operations outside the API. - pending — accepted by the operator, not finished. - failed — the operator refused; the reserved amount was released.
operator_refund_idstring | nullThe operator's reference for the refund; null when none.
livemodebooleanAlways true on this API.
createdintegerCreation time, Unix seconds (UTC).

Event

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix evt_. Deduplicate webhook deliveries on it.
object"event"Always event.
type"payment_intent.succeeded" | "payment_intent.payment_failed" | "payment_intent.canceled" | "charge.refunded"What happened. See the Webhooks section for each type's data.
api_versionstringAPI version the payload was built with.
dataEventData
livemodebooleanAlways true on this API.
createdintegerWhen the event happened, Unix seconds (UTC).

EventData

Snapshot of the affected object. For payment_intent.* events: id, object (payment_intent), status, amount, currency, and charge (not on payment_intent.canceled). For charge.refunded: id (refund), object (refund), charge, amount, status, refunded_total.

ТалбарТөрөлЗаавалТайлбар
idstringId of the PaymentIntent (pi_…) or Refund (re_…).
object"payment_intent" | "refund"Type of id.
statusstringThe object's status when the event happened.
amountintegerPaymentIntent amount, or refunded amount, in MNT.
currencystringMNT (payment_intent events only).
chargestringThe related charge (ch_…). Absent on payment_intent.canceled.
refunded_totalintegerCharge's total refunded MNT so far (charge.refunded only).

WebhookEvent

Body Wire POSTs to your webhook endpoint. Signed with the WirePayment-Signature: t=<unix>,v1=<hex> header — v1 = hex(HMAC_SHA256(whsec_secret, t + "." + raw_body)). Verify against the raw bytes before parsing.

ТалбарТөрөлЗаавалТайлбар
idstring✓Event id (evt_…) — same as GET /v1/events/{id}.
object"event"✓Always event.
typestring✓Event type.
createdinteger✓When the event happened, Unix seconds (UTC).
dataEventData✓

WebhookEndpointCreate

ТалбарТөрөлЗаавалТайлбар
urlstring✓Public http(s) URL that receives events. Not localhost or a private / loopback IP.
enabled_events"*" | "payment_intent.succeeded" | "payment_intent.payment_failed" | "payment_intent.canceled" | "charge.refunded"[]Events to receive. Defaults to ["*"] (all events).

WebhookEndpointUpdate

Send only the fields to change.

ТалбарТөрөлЗаавалТайлбар
urlstringNew URL. On a verified endpoint it is staged until the new URL passes verification in the dashboard.
enabled_events"*" | "payment_intent.succeeded" | "payment_intent.payment_failed" | "payment_intent.canceled" | "charge.refunded"[]Replaces the subscribed events.
status"enabled" | "disabled"disabled pauses delivery; enabled resumes it (an unverified endpoint still receives nothing).

WebhookEndpoint

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix we_.
object"webhook_endpoint"Always webhook_endpoint.
urlstringWhere events are delivered.
enabled_eventsstring[]Subscribed event types; ["*"] = all.
status"pending" | "enabled" | "disabled"pending — created, not verified yet, receives nothing; enabled — verified and receiving; disabled — paused.
livemodebooleanAlways true on this API.
createdintegerCreation time, Unix seconds (UTC).

WebhookEndpointWithSecret

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix we_.
object"webhook_endpoint"Always webhook_endpoint.
urlstringWhere events are delivered.
enabled_eventsstring[]Subscribed event types; ["*"] = all.
status"pending" | "enabled" | "disabled"pending — created, not verified yet, receives nothing; enabled — verified and receiving; disabled — paused.
livemodebooleanAlways true on this API.
createdintegerCreation time, Unix seconds (UTC).
secretstringSigning secret (whsec_…), returned only at creation. Use it to verify the WirePayment-Signature header.

OperatorConnectionCreate

ТалбарТөрөлЗаавалТайлбар
operatorstring✓Operator id, as shown on the dashboard's Connectors page.
mode"byo" | "reseller"Must be byo (your own operator credentials). reseller connections are provisioned by Wire through the dashboard and are refused here with operator_connection_invalid.
credentialsobject✓Operator-specific credential key/value pairs (must not be empty). Encrypted at rest; never returned.

OperatorConnection

ТалбарТөрөлЗаавалТайлбар
idstringUnique id, prefix opc_.
object"operator_connection"Always operator_connection.
operatorstringOperator id.
mode"byo" | "reseller"byo — your credentials; reseller — provisioned by Wire.
status"active" | "inactive"active — can carry payments (if also switched on for the project); inactive — cannot.
capabilitiesstring[]What the operator supports, e.g. refund.full, refund.partial, loan.flow.
createdintegerCreation time, Unix seconds (UTC).

OperatorConnectionTest

ТалбарТөрөлЗаавалТайлбар
object"operator_connection_test"Always operator_connection_test.
operatorstringOperator id.
status"ok" | "unreachable"ok — the connection is now active; unreachable — the operator did not answer; nothing changed.
capabilitiesstring[]The operator's capabilities.

RoutingPreview

ТалбарТөрөлЗаавалТайлбар
object"routing_preview"Always routing_preview.
selectedstringThe operator routing would pick.
reasonstringHuman-readable explanation of the choice.
fallback_chainstring[]All eligible operators, best first ([0] = selected).
scoredobject[]Score breakdown per eligible operator.

On this page