Xero: Allows you to create an Allocation for prepayments
Xero accounting.createPrepaymentAllocations: arguments, response, policy and SDK examples.
← Accounting operations · Get started
Operation xero.createprepaymentallocations
Provider route: PUT /api.xro/2.0/Prepayments/{PrepaymentID}/Allocations. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/xero with npm, or alter-sdk-xero with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { XeroIntegration } from "@alter-ai/xero";
async function execute(input: Parameters<XeroIntegration["accounting"]["createPrepaymentAllocations"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new XeroIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.accounting.createPrepaymentAllocations(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_xero import XeroIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = XeroIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.accounting.create_prepayment_allocations(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.PrepaymentID | string | Required within parent | Format: uuid |
query | object | Optional | Additional keys: not allowed |
query.summarizeErrors | boolean | Optional | Default: false |
headers | object | Required within parent | Additional keys: not allowed |
headers.xero-tenant-id | string | Required within parent | |
headers.Idempotency-Key | string | Optional | |
body | Model | Required within parent | Expand Creates allocation for a specific credit note — request body — body |
Referenced models: Creates allocation for a specific credit note — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Creates allocation for a specific credit note — response body |
Referenced models: Creates allocation for a specific credit note — response body
Schemas
Section titled “Schemas”45 more schemas are linked from the tables above, on the schema pages.
Creates allocation for a specific credit note — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Allocations | array | Optional | |
Allocations[] | Model | Each item | Expand Creates allocation for a specific credit note — request body — body Allocations item |
Referenced models: Creates allocation for a specific credit note — request body — body Allocations item
Creates allocation for a specific credit note — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Allocations | array | Optional | |
Allocations[] | Model | Each item | Expand Deletes an Allocation from a Prepayment — response body |
Referenced models: Deletes an Allocation from a Prepayment — response body
Creates allocation for a specific credit note — request body — body Allocations item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
AllocationID | string | Optional | Xero generated unique identifier Format: uuid |
Amount | number | Required within parent | the amount being applied to the invoice Format: double |
CreditNote | Model | Optional | Expand Creates a single payment for invoice or credit notes — request body — body Credit Note |
Date | string | Required within parent | the date the allocation is applied YYYY-MM-DD. |
Invoice | Model | Required within parent | Expand Creates a single payment for invoice or credit notes — request body — body Invoice |
IsDeleted | boolean | Optional | A flag that returns true when the allocation is succesfully deleted Read only: true |
Overpayment | Model | Optional | Expand Creates a single payment for invoice or credit notes — request body — body Overpayment |
Prepayment | Model | Optional | Expand Creates a single payment for invoice or credit notes — request body — body Prepayment |
StatusAttributeString | string | Optional | A string to indicate if a invoice status |
ValidationErrors | array | Optional | Displays array of validation error messages from the API |
ValidationErrors[] | Model | Each item | Expand Retrieves journals — response body — Warnings item |
Referenced models: Creates a single payment for invoice or credit notes — request body — body Credit Note, Creates a single payment for invoice or credit notes — request body — body Invoice, Retrieves journals — response body — Warnings item, Creates a single payment for invoice or credit notes — request body — body Overpayment, Creates a single payment for invoice or credit notes — request body — body Prepayment
Deletes an Allocation from a Prepayment — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
AllocationID | string | Optional | Xero generated unique identifier Format: uuid |
Amount | JSON | Required within parent | |
Amount (anyOf 1) | number | Alternative | the amount being applied to the invoice Format: double |
Amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
CreditNote | Model | Optional | Expand Deletes an Allocation from a Prepayment — response body — Credit Note |
Date | string | Required within parent | the date the allocation is applied YYYY-MM-DD. |
Invoice | Model | Required within parent | Expand Deletes an Allocation from a Prepayment — response body — Invoice |
IsDeleted | boolean | Optional | A flag that returns true when the allocation is succesfully deleted Read only: true |
Overpayment | Model | Optional | Expand Deletes an Allocation from a Prepayment — response body — Overpayment |
Prepayment | Model | Optional | Expand Deletes an Allocation from a Prepayment — response body — Prepayment |
StatusAttributeString | string | Optional | A string to indicate if a invoice status |
ValidationErrors | array | Optional | Displays array of validation error messages from the API |
ValidationErrors[] | Model | Each item | Expand Retrieves journals — response body — Warnings item |
Referenced models: Deletes an Allocation from a Prepayment — response body — Credit Note, Deletes an Allocation from a Prepayment — response body — Invoice, Deletes an Allocation from a Prepayment — response body — Overpayment, Deletes an Allocation from a Prepayment — response body — Prepayment, Retrieves journals — response body — Warnings item
Retrieves journals — response body — Warnings item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Message | string | Optional | Validation error message |
Creates a single payment for invoice or credit notes — request body — body Overpayment
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Allocations | array | Optional | See Allocations |
Allocations[] | Model | Each item | Expand Creates allocation for a specific credit note — request body — body Allocations item |
AppliedAmount | number | Optional | The amount of applied to an invoice Format: double |
Attachments | array | Optional | See Attachments |
Attachments[] | Model | Each item | Expand Creates a single payment for invoice or credit notes — request body — body Invoice Attachments item |
Contact | Model | Optional | Expand Creates contacts to a specific contact group — request body — body Contacts item |
CurrencyCode | Model | Optional | Expand Create a new currency for a Xero organisation — request body — body Code |
CurrencyRate | number | Optional | The currency rate for a multicurrency overpayment. If no rate is specified, the XE.com day rate is used Format: double |
Date | string | Optional | The date the overpayment is created YYYY-MM-DD |
HasAttachments | boolean | Optional | boolean to indicate if a overpayment has an attachment Default: false Read only: true |
LineAmountTypes | string | Optional | Line amounts are exclusive of tax by default if you don’t specify this element. See Line Amount Types One of: Exclusive, Inclusive, NoTax |
LineItems | array | Optional | See Overpayment Line Items |
LineItems[] | Model | Each item | Expand Creates a single payment for invoice or credit notes — request body — body Invoice Line Items item |
OverpaymentID | string | Optional | Xero generated unique identifier Format: uuid |
Payments | array | Optional | See Payments |
Payments[] | Model | Each item | Expand Creates a single payment for invoice or credit notes — request body — body |
Reference | string | Optional | An optional description for Overpayment |
RemainingCredit | number | Optional | The remaining credit balance on the overpayment Format: double |
Status | string | Optional | See Overpayment Status Codes One of: AUTHORISED, PAID, VOIDED |
SubTotal | number | Optional | The subtotal of the overpayment excluding taxes Format: double |
Total | number | Optional | The total of the overpayment (subtotal + total tax) Format: double |
TotalTax | number | Optional | The total tax on the overpayment Format: double |
Type | string | Optional | See Overpayment Types One of: RECEIVE-OVERPAYMENT, SPEND-OVERPAYMENT, AROVERPAYMENT |
UpdatedDateUTC | string | Optional | UTC timestamp of last update to the overpayment Read only: true |
UpdatedDateUTCString | string | Optional | UTC ISO-8601 formatted timestamp of last update to the overpayment Read only: true |
Referenced models: Create a new currency for a Xero organisation — request body — body Code, Creates allocation for a specific credit note — request body — body Allocations item, Creates a single payment for invoice or credit notes — request body — body Invoice Attachments item, Creates contacts to a specific contact group — request body — body Contacts item, Creates a single payment for invoice or credit notes — request body — body Invoice Line Items item, Creates a single payment for invoice or credit notes — request body — body
Creates contacts to a specific contact group — request body — body Contacts item Balances Accounts Payable
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Outstanding | number | Optional | Format: double |
Overdue | number | Optional | Format: double |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.createprepaymentallocations. Catalog operation: createPrepaymentAllocations. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.