AlmondTill/G3N API

createTokenPurchase

mutation · in the family Token purchase

What it does

Buy kernels — top up your group’s prepaid balance.

Settlement is the webhook's. Requires the unrestricted capability. Template class A16_BILLING (hand-derived v23).

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Billing and the wallet — Your platform bill, token purchases and the usage and cost reads.

Roles that may call it:

What happens

Charges your billing method and credits the balance in one recorded purchase.

Careful

Real money for platform credits.

Arguments

NameTypeRequiredNotes
inputNewTokenPurchaseInput NewTokenPurchaseInput!yesCreate-input for a TokenPurchase.

Returns

TokenPurchase TokenPurchase! — A TokenPurchase — buying platform tokens with real money: $ → tokens at the volume tier (tier_1 | tier_2 | tier_3 | tier_4 — server-computed, never client-asserted), loaded into the group's TokenAccount as a purchase TokenEntry when the webhook settles. **AT/stack charging the merchant** — the platform account's OWN PaymentIntent. **non-refundable**. The birth op mints the test PaymentIntent api-side with the load-bearing metadata {at_kind, tokenPurchaseId, rootId}. The real-money gate = classification × Stripe mode. Purchase-abandon reconciliation beyond canceled = deferral 14a. NOT searchable. Template class A16_BILLING (hand-derived v23).

Example request

graphql
mutation ExampleCreateTokenPurchase($input: NewTokenPurchaseInput!) {
  createTokenPurchase(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    usdAmountCents
    tokensPurchased
    volumeTierCode
    rateCardVersion
    stripePaymentIntentId
    settledAt
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "usdAmountCents": 1
  }
}

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

Example response

json
{
  "data": {
    "createTokenPurchase": {
      "id": "01900000-0000-7000-8000-b3215f990000",
      "sysId": "TP-EXMP-0000-000F",
      "type": "TokenPurchase",
      "caption": "Blue jeans",
      "status": "created",
      "parentId": "01900000-0000-7000-8000-b0839b1d0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "usdAmountCents": 1,
      "tokensPurchased": 1,
      "volumeTierCode": "BJ-001",
      "rateCardVersion": 1,
      "stripePaymentIntentId": "<stripe payment intent id>",
      "settledAt": "2027-01-31T00:00:00.000Z"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in