createCustomerCollection
Requires permission payments:collection:create.
Records money received from a customer, optionally allocating it to invoices. The collection date must be valid, and an idempotency key makes a retry safe. Requires permission to create collections.
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 CreateCustomerCollection($input: CreateCustomerCollectionInput!) {
createCustomerCollection(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 CreateCustomerCollection($input: CreateCustomerCollectionInput!) {\n createCustomerCollection(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": {
"amount": 0,
"collectionDate": "2025-01-15T00:00:00Z",
"collectionMethod": "BANK_TRANSFER",
"currency": "string",
"customerId": "id"
}
}
}
EOF
Variables:
{
"input": {
"amount": 0,
"collectionDate": "2025-01-15T00:00:00Z",
"collectionMethod": "BANK_TRANSFER",
"currency": "string",
"customerId": "id"
}
}
Response:
{
"data": {
"createCustomerCollection": {
"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
}
]
}
}
}
Collect a payment from a customer:
- GraphQL
- cURL
mutation CreateCustomerCollection($input: CreateCustomerCollectionInput!) {
createCustomerCollection(input: $input) {
id
paymentNumber
status
amount
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateCustomerCollection($input: CreateCustomerCollectionInput!) {\n createCustomerCollection(input: $input) {\n id\n paymentNumber\n status\n amount\n }\n}",
"variables": {
"input": {
"customerId": "CUSTOMER_ID",
"amount": 200,
"currency": "CURRENCY_CODE",
"collectionDate": "2025-01-15T00:00:00Z",
"collectionMethod": "BANK_TRANSFER"
}
}
}
EOF
Variables:
{
"input": {
"customerId": "CUSTOMER_ID",
"amount": 200,
"currency": "CURRENCY_CODE",
"collectionDate": "2025-01-15T00:00:00Z",
"collectionMethod": "BANK_TRANSFER"
}
}
Response:
{
"data": {
"createCustomerCollection": {
"id": "PAYMENT_ID",
"paymentNumber": "PAYMENT_NUMBER",
"status": "PENDING",
"amount": 200
}
}
}
createCustomerCollection(
input: CreateCustomerCollectionInput!
): Payment!
Arguments
createCustomerCollection.input ● CreateCustomerCollectionInput! non-null input
The customer, date, method, currency and amount, with optional exchange rate, bank account, reference, notes, allocations and idempotency key.
Type
Payment object
A payment made out to a vendor or a collection received from a customer, with its allocations to invoices.