AlmondTill/G3N API

On this page

agentChannelCheckoutComplete

mutation · in the family Selling

What it does

Pay and place an agent checkout as the platform would — the buyer’s payment instrument (a Google Pay card token through Stripe) is charged for the full quote and the sale is placed.

THE AGENT CHECKOUT — complete: pay and place a ready_for_complete checkout with the ONE selected instrument — the mint of the PLACED sale from the draft (the fee in the money · the seats copied · the ecom reservation · real tax at the origin) → the card hold through the advertised handler (Google Pay via Stripe; a tok_/pm_ credential) → the draft's own draft → accepted flip → status completed with order { id, sysId } + the display-safe payment echo. A decline cancels the pending sale and answers the checkout ready_for_complete with a recoverable payment_failed message; insufficient stock answers incomplete + out_of_stock; a lapsed validity answers canceled; a completed/canceled checkout refuses CONFLICT/REF_STATE (the door speaks checkout_closed); a pending mint (the crash window) reads complete_in_progress and RESUMES here. An instrument naming a handler this business does not advertise refuses VALIDATION/INVALID.

What happens

Mints a placed sale from the draft (tax computed, stock reserved, the shipping fee in the money), takes a card hold for the total, and marks the checkout completed; a declined card leaves the checkout ready for another try with the attempt recorded.

Who may call it

Capability area: Selling — Ringing sales, serving customers and issuing invoices.

Arguments

NameTypeRequiredNotes
agentChannelIdID ID!yesNo further notes.
orderIdID ID!yesNo further notes.
inputAgentCheckoutCompleteInput AgentCheckoutCompleteInput!yesNo further notes.
linkedConsumerIdIDnoNo further notes.

Returns

AgentCheckout AgentCheckout! — THE AGENT CHECKOUT VIEW: the draft Order as a UCP checkout session at NOW — status ∈ incomplete | requires_escalation | ready_for_complete | complete_in_progress | completed | canceled (the status rule) over its lines, buyer, consent, fulfillment offer, totals, discounts and messages.

Example request

mutation ExampleAgentChannelCheckoutComplete($agentChannelId: ID!, $orderId: ID!, $input: AgentCheckoutCompleteInput!, $linkedConsumerId: ID) {
  agentChannelCheckoutComplete(agentChannelId: $agentChannelId, orderId: $orderId, input: $input, linkedConsumerId: $linkedConsumerId) {
    orderId
    revision
    revisionNum
    agentChannelId
    organizationId
    platformProfileUrl
    consumerId
    currency
    orderStatus
    status
    validUntil
  }
}

Variables:

{
  "agentChannelId": "01900000-0000-7000-8000-d23fae740000",
  "orderId": "01900000-0000-7000-8000-f6d8263a0000",
  "input": {
    "instrument": {
      "id": "<id>",
      "handlerId": "<handler id>",
      "type": "<type>",
      "credential": {
        "type": "<type>",
        "token": "<your session token>"
      },
      "display": {
        "brand": "<brand>"
      }
    }
  },
  "linkedConsumerId": "01900000-0000-7000-8000-2aa003e10000"
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "agentChannelCheckoutComplete": {
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "revisionNum": 1,
      "agentChannelId": "01900000-0000-7000-8000-d23fae740000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "platformProfileUrl": "https://example.com/hook",
      "consumerId": "01900000-0000-7000-8000-6e8c92ec0000",
      "currency": "USD",
      "orderStatus": "<order status>",
      "status": "<status>",
      "validUntil": "<valid until>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer