xero.payments.create-payment ​
Creates a single payment for invoice or credit notes
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-xero |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base_url | string | Yes | — | Xero API root, e.g. https://<host>/api |
api_token | string | No | — | Bearer token; omit to use the workflow's token env var |
xero_tenant_id | string | Yes | — | Xero identifier for Tenant |
idempotency_key | string | No | — | This allows you to safely retry requests without the risk of duplicate processing. 128 character max. |
invoice | json | No | — | — |
creditnote | json | No | — | — |
prepayment | json | No | — | — |
overpayment | json | No | — | — |
invoicenumber | string | No | — | Number of invoice or credit note you are applying payment to e.g.INV-4003 |
creditnotenumber | string | No | — | Number of invoice or credit note you are applying payment to e.g. INV-4003 |
batchpayment | json | No | — | — |
account | json | No | — | — |
code | string | No | — | Code of account you are using to make the payment e.g. 001 (note- not all accounts have a code value) |
date | string | No | — | Date the payment is being made (YYYY-MM-DD) e.g. 2009-09-06 |
currencyrate | float | No | — | Exchange rate when payment is received. Only used for non base currency invoices and credit notes e.g. 0.7500 |
amount | float | No | — | The amount of the payment. Must be less than or equal to the outstanding amount owing on the invoice e.g. 200.00 |
bankamount | float | No | — | The amount of the payment in the currency of the bank account. |
reference | string | No | — | An optional description for the payment e.g. Direct Debit |
isreconciled | boolean | No | — | An optional parameter for the payment. A boolean indicating whether you would like the payment to be created as reconciled when using PUT, or whether a payment has been reconciled when using GET |
status | string | No | — | The status of the payment. |
paymenttype | string | No | — | See Payment Types. |
updateddateutc | string | No | — | UTC timestamp of last update to the payment |
updateddateutcstring | string | No | — | UTC ISO-8601 formatted timestamp of last update to the payment |
paymentid | string | No | — | The Xero identifier for an Payment e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
batchpaymentid | string | No | — | Present if the payment was created as part of a batch. |
bankaccountnumber | string | No | — | The suppliers bank account number the payment is being made to |
particulars | string | No | — | The suppliers bank account number the payment is being made to |
details | string | No | — | The information to appear on the supplier's bank account |
hasaccount | boolean | No | — | A boolean to indicate if a contact has an validation errors |
hasvalidationerrors | boolean | No | — | A boolean to indicate if a contact has an validation errors |
statusattributestring | string | No | — | A string to indicate if a invoice status |
validationerrors | list | No | — | Displays array of validation error messages from the API |
warnings | list | No | — | Displays array of warning messages from the API |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base_url | string | Yes | — | Xero API root, e.g. https://<host>/api |
api_token | string | No | — | Bearer token; omit to use the workflow's token env var |
xero_tenant_id | string | Yes | — | Xero identifier for Tenant |
idempotency_key | string | No | — | This allows you to safely retry requests without the risk of duplicate processing. 128 character max. |
invoice | json | No | — | — |
creditnote | json | No | — | — |
prepayment | json | No | — | — |
overpayment | json | No | — | — |
invoicenumber | string | No | — | Number of invoice or credit note you are applying payment to e.g.INV-4003 |
creditnotenumber | string | No | — | Number of invoice or credit note you are applying payment to e.g. INV-4003 |
batchpayment | json | No | — | — |
account | json | No | — | — |
code | string | No | — | Code of account you are using to make the payment e.g. 001 (note- not all accounts have a code value) |
date | string | No | — | Date the payment is being made (YYYY-MM-DD) e.g. 2009-09-06 |
currencyrate | float | No | — | Exchange rate when payment is received. Only used for non base currency invoices and credit notes e.g. 0.7500 |
amount | float | No | — | The amount of the payment. Must be less than or equal to the outstanding amount owing on the invoice e.g. 200.00 |
bankamount | float | No | — | The amount of the payment in the currency of the bank account. |
reference | string | No | — | An optional description for the payment e.g. Direct Debit |
isreconciled | boolean | No | — | An optional parameter for the payment. A boolean indicating whether you would like the payment to be created as reconciled when using PUT, or whether a payment has been reconciled when using GET |
status | string | No | — | The status of the payment. |
paymenttype | string | No | — | See Payment Types. |
updateddateutc | string | No | — | UTC timestamp of last update to the payment |
updateddateutcstring | string | No | — | UTC ISO-8601 formatted timestamp of last update to the payment |
paymentid | string | No | — | The Xero identifier for an Payment e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
batchpaymentid | string | No | — | Present if the payment was created as part of a batch. |
bankaccountnumber | string | No | — | The suppliers bank account number the payment is being made to |
particulars | string | No | — | The suppliers bank account number the payment is being made to |
details | string | No | — | The information to appear on the supplier's bank account |
hasaccount | boolean | No | — | A boolean to indicate if a contact has an validation errors |
hasvalidationerrors | boolean | No | — | A boolean to indicate if a contact has an validation errors |
statusattributestring | string | No | — | A string to indicate if a invoice status |
validationerrors | list | No | — | Displays array of validation error messages from the API |
warnings | list | No | — | Displays array of warning messages from the API |
status_code | integer | No | — | HTTP status code of the completed call |
response | json | No | — | Parsed JSON response body |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_at | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
failed_at_state | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | Waiting to call POST /Payments |
completed | No | Yes | Yes | — | HTTP call succeeded |
failed | No | Yes | No | — | HTTP call failed |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | Perform POST /Payments |
* (any state) | fail | failed | Record the failure reason |
Outcomes ​
| Outcome | Type | Description | State Data Keys |
|---|---|---|---|
completed | SUCCESS | The provider accepted the request | status_code, response |
failed | FAILURE | The provider rejected the request or was unreachable | failure_reason, failure_type, status_code |
Business Errors ​
| Code | Message Template |
|---|---|
HTTP_AUTHENTICATION_FAILED | The provider rejected the credential (HTTP {status_code}) |
HTTP_AUTHORIZATION_FAILED | The credential is not permitted to perform this operation (HTTP {status_code}) |
HTTP_NOT_FOUND | The provider has no resource at {path} (HTTP 404) |
HTTP_RATE_LIMITED | The provider rate-limited this request (HTTP 429) |
HTTP_REQUEST_FAILED | The provider returned HTTP {status_code} for {method} |
HTTP_RESPONSE_SHAPE_UNEXPECTED | The provider response for {method} {path} could not be parsed as JSON |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "xero.payments.create-payment",
"initial_data": {
"base_url": "value",
"xero_tenant_id": "value"
}
}