allocatePayment
Requires at least one of the permissions payments:payment:allocate or purchase:payment:allocate.
Applies a payment's unallocated balance to one or more invoices of the same customer or supplier. At least one allocation is required. The payment must still be allocatable (a voided, reversed or refunded payment is refused), the payment and each invoice must share a currency, and the total cannot exceed the payment's unallocated amount or an invoice's outstanding amount.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation AllocatePayment($input: AllocatePaymentInput!) {
allocatePayment(input: $input) {
id
checkNumber
currencyCode
paymentNumber
referenceNumber
status
allocations {
id
invoiceNumber
paymentNumber
createdAt
amount
appliedFromAdvance
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AllocatePayment($input: AllocatePaymentInput!) {\n allocatePayment(input: $input) {\n id\n checkNumber\n currencyCode\n paymentNumber\n referenceNumber\n status\n allocations {\n id\n invoiceNumber\n paymentNumber\n createdAt\n amount\n appliedFromAdvance\n }\n }\n}",
"variables": {
"input": {
"allocations": [
{
"amount": 0,
"invoiceId": "id"
}
],
"paymentId": "id"
}
}
}
EOF
Variables:
{
"input": {
"allocations": [
{
"amount": 0,
"invoiceId": "id"
}
],
"paymentId": "id"
}
}
Response:
{
"data": {
"allocatePayment": {
"id": "id",
"checkNumber": "string",
"currencyCode": "string",
"paymentNumber": "string",
"referenceNumber": "string",
"status": "APPROVED",
"allocations": [
{
"id": "id",
"invoiceNumber": "string",
"paymentNumber": "string",
"createdAt": "2025-01-15T00:00:00Z",
"amount": 0,
"appliedFromAdvance": true
}
]
}
}
}
Allocate a payment across invoices:
- GraphQL
- cURL
mutation AllocatePayment($input: AllocatePaymentInput!) {
allocatePayment(input: $input) {
id
paymentNumber
status
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AllocatePayment($input: AllocatePaymentInput!) {\n allocatePayment(input: $input) {\n id\n paymentNumber\n status\n }\n}",
"variables": {
"input": {
"paymentId": "PAYMENT_ID",
"allocations": [
{
"invoiceId": "INVOICE_ID",
"amount": 200
}
]
}
}
}
EOF
Variables:
{
"input": {
"paymentId": "PAYMENT_ID",
"allocations": [
{
"invoiceId": "INVOICE_ID",
"amount": 200
}
]
}
}
Response:
{
"data": {
"allocatePayment": {
"id": "PAYMENT_ID",
"paymentNumber": "PAYMENT_NUMBER",
"status": "PAID"
}
}
}
allocatePayment(
input: AllocatePaymentInput!
): Payment!
Arguments
allocatePayment.input ● AllocatePaymentInput! non-null input
The payment and the invoices to allocate it to.
Type
Payment object
A payment made out to a vendor or a collection received from a customer, with its allocations to invoices.