AlmondTill/G3N API

Pay the people who sell for you — staff commissions and referral partners

Define how staff commission is computed and read what you owe each seller; set up the partners who refer businesses to you and read what you owe them — ledgers and payout reports on both sides.

Pricing & money · a play in 4 steps.

In the office

Where it starts: the office’s Commission configs page.

Step 1. Define the commission settings for the scope. Open Commission configs.

Step 2. Read what staff earned, entry by entry, and what you owe each seller for the period.

Step 3. Set up a referral partner — an affiliate who earns a share for the businesses they introduce. Open Affiliates.

Step 4. Read the partners’ earnings ledger and what you owe each of them for the period.

For developers — the calls

The steps

  1. Define the commission settings for the scope. — createCommissionConfig
  2. Read what staff earned, entry by entry, and what you owe each seller for the period. — commissionEntryList, commissionPayoutReport
  3. Set up a referral partner — an affiliate who earns a share for the businesses they introduce. — createAffiliate
  4. Read the partners’ earnings ledger and what you owe each of them for the period. — affiliateAccruals, affiliatePayoutReport

The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

createCommissionConfig

createCommissionConfig — mutation · Create a new commission settings — how staff sales commission is computed at your organization.

Example request

graphql
mutation ExampleCreateCommissionConfig($input: NewCommissionConfigInput!) {
  createCommissionConfig(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    appliesToAllSalesInScope
    agentRoleId
    agentUserId
    divisionId
    categoryId
    styleId
    organizationId
    logicalFacilityId
    channel
    enabled
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans"
  }
}

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

Example response

json
{
  "data": {
    "createCommissionConfig": {
      "id": "01900000-0000-7000-8000-d7015f3e0000",
      "sysId": "CG-EXMP-0000-000F",
      "type": "CommissionConfig",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "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",
      "appliesToAllSalesInScope": true,
      "agentRoleId": "01900000-0000-7000-8000-a95bae4e0000",
      "agentUserId": "01900000-0000-7000-8000-d9a011190000",
      "divisionId": "01900000-0000-7000-8000-a5e990060000",
      "categoryId": "01900000-0000-7000-8000-afb3e5910000",
      "styleId": "01900000-0000-7000-8000-5467ec760000",
      "organizationId": "01900000-0000-7000-8000-1971e30a0000",
      "logicalFacilityId": "01900000-0000-7000-8000-10c08c590000",
      "channel": "pos",
      "enabled": true
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

commissionEntryList

commissionEntryList — query · The commission ledger — what staff earned, entry by entry.

Example request

graphql
query ExampleCommissionEntryList($agentUserId: ID) {
  commissionEntryList(agentUserId: $agentUserId) {
    items {
      id
      parentId
      entryType
      entryClass
      amountMinor
      currency
      configId
      orderId
      returnId
      caption
      createdAt
    }
    nextToken
  }
}

Variables:

json
{
  "agentUserId": "01900000-0000-7000-8000-d9a011190000"
}

Example response

json
{
  "data": {
    "commissionEntryList": {
      "items": [
        {
          "id": "01900000-0000-7000-8000-37386ae00000",
          "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
          "entryType": "earn",
          "entryClass": "attributed",
          "amountMinor": 1250,
          "currency": "USD",
          "configId": "01900000-0000-7000-8000-6a12e0e70000",
          "orderId": "01900000-0000-7000-8000-18e782370000",
          "returnId": "01900000-0000-7000-8000-cc01b1df0000",
          "caption": "Blue jeans",
          "createdAt": "2027-01-31T00:00:00.000Z"
        }
      ],
      "nextToken": "<the cursor from the previous page>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

commissionPayoutReport

commissionPayoutReport — query · The commission payout report — what you owe each seller for the period.

Example request

graphql
query ExampleCommissionPayoutReport($from: String!, $to: String!, $agentUserId: ID) {
  commissionPayoutReport(from: $from, to: $to, agentUserId: $agentUserId) {
    items {
      subjectId
      currency
      earnedMinor
      clawedBackMinor
      payableMinor
      entryCount
    }
    nextToken
  }
}

Variables:

json
{
  "from": "<from>",
  "to": "<to>",
  "agentUserId": "01900000-0000-7000-8000-d9a011190000"
}

Example response

json
{
  "data": {
    "commissionPayoutReport": {
      "items": [
        {
          "subjectId": "01900000-0000-7000-8000-a07924ef0000",
          "currency": "USD",
          "earnedMinor": 1250,
          "clawedBackMinor": 1250,
          "payableMinor": 1250,
          "entryCount": 1
        }
      ],
      "nextToken": "<the cursor from the previous page>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

createAffiliate

createAffiliate — mutation · Create a new affiliate — a commission-earning referral partner at your organization.

Example request

graphql
mutation ExampleCreateAffiliate($input: NewAffiliateInput!) {
  createAffiliate(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationIds
    ratePpm
    consumerId
    handle
    bio
    socialLinks
    audienceSize
    nicheTags
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans"
  }
}

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

Example response

json
{
  "data": {
    "createAffiliate": {
      "id": "01900000-0000-7000-8000-c6e63db40000",
      "sysId": "AF-EXMP-0000-000F",
      "type": "Affiliate",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "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",
      "organizationIds": [
        "01900000-0000-7000-8000-1971e30a0000"
      ],
      "ratePpm": 1,
      "consumerId": "01900000-0000-7000-8000-3cbb3ce90000",
      "handle": "<handle>",
      "bio": "<bio>",
      "socialLinks": [
        "<social links>"
      ],
      "audienceSize": 1,
      "nicheTags": [
        "<niche tags>"
      ]
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

affiliateAccruals

affiliateAccruals — query · Your referral earnings ledger — subscription-share and usage-share rows for the businesses you introduced, months your own bill was settled from earnings, and any reversals, with the rate and basis on every row.

Example request

graphql
query ExampleAffiliateAccruals($limit: Int) {
  affiliateAccruals(limit: $limit) {
    id
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    entryType
    ownerOrgGroupId
    periodMonth
    cycle
    ratePercent
    collectedUsdCents
    usageBasisCents
    amountUsdCents
    billingChargeId
  }
}

Variables:

json
{
  "limit": 1
}

Example response

json
{
  "data": {
    "affiliateAccruals": [
      {
        "id": "01900000-0000-7000-8000-37386ae00000",
        "type": "<type>",
        "caption": "Blue jeans",
        "status": "<status>",
        "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
        "rootId": "01900000-0000-7000-8000-a1295a650000",
        "createdAt": "2027-01-31T00:00:00.000Z",
        "updatedAt": "2027-01-31T00:00:00.000Z",
        "revisionNum": 1,
        "revision": "01900000-0000-7000-8000-53c6eea90000",
        "entryType": "<entry type>",
        "ownerOrgGroupId": "01900000-0000-7000-8000-37a36fdd0000",
        "periodMonth": "<period month>",
        "cycle": 1,
        "ratePercent": 1,
        "collectedUsdCents": 1,
        "usageBasisCents": 1,
        "amountUsdCents": 1,
        "billingChargeId": "01900000-0000-7000-8000-142a32780000"
      }
    ]
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

affiliatePayoutReport

affiliatePayoutReport — query · The payout report for affiliates — what you owe each partner for the period.

Example request

graphql
query ExampleAffiliatePayoutReport($from: String!, $to: String!, $affiliateId: ID) {
  affiliatePayoutReport(from: $from, to: $to, affiliateId: $affiliateId) {
    items {
      subjectId
      currency
      earnedMinor
      clawedBackMinor
      payableMinor
      entryCount
    }
    nextToken
  }
}

Variables:

json
{
  "from": "<from>",
  "to": "<to>",
  "affiliateId": "01900000-0000-7000-8000-c6e63db40000"
}

Example response

json
{
  "data": {
    "affiliatePayoutReport": {
      "items": [
        {
          "subjectId": "01900000-0000-7000-8000-a07924ef0000",
          "currency": "USD",
          "earnedMinor": 1250,
          "clawedBackMinor": 1250,
          "payableMinor": 1250,
          "entryCount": 1
        }
      ],
      "nextToken": "<the cursor from the previous page>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}