InvoicePayment — new fields sourceInvoiceId and relatedPaymentId
Summary
The GraphQL type InvoicePayment (returned under Invoice.payments) now exposes two read-only linkage fields:
sourceInvoiceId— the invoice this payment draws from or applies to (a payment-on-account invoice or a credit note).nullwhen the payment is not linked.relatedPaymentId— the paired payment on the linked invoice, so both sides of the same transaction stay linked.nullwhen not linked.
These mirror the existing relatedPayment field on InvoiceRefund, giving partners a symmetric way to trace payment-on-account drawdowns and credit-note applications without internal API access.
This release is additive: existing invoice and invoices calls behave as before. If you do not request the new fields, behaviour and performance are unchanged.
Population rules:
sourceInvoiceIdandrelatedPaymentIdare bothnullfor unlinked payments (e.g. cash, card viapayInvoice, manual payments).- For payment-on-account drawdowns,
sourceInvoiceIdpoints to the POA invoice (type: paymentOnAccount) andrelatedPaymentIdpoints to the matching payment on that POA invoice. - For credit-note applications,
sourceInvoiceIdpoints to the credit note invoice (type: creditNote) andrelatedPaymentIdpoints to the matching payment on that credit note.
Query example
query InvoicePaymentLinkage($id: ID!) {
invoice(id: $id) {
id
payments {
id
paymentSource
paymentAmount
sourceInvoiceId
relatedPaymentId
}
}
}
The invoices connection supports the same nested selection on each item in data.
Integration guidance
- Optional fields: Add
sourceInvoiceIdandrelatedPaymentIdonly when your integration needs to trace POA or credit-note relationships; omit them otherwise. - Handle nulls: Expect both fields to be
nullfor most payments. - Follow the link: Use
sourceInvoiceIdto fetch the source invoice (check itstypeto distinguish POA from credit note), andrelatedPaymentIdto identify the paired payment on that invoice.
If something breaks after this change
Problems are unlikely unless you use strict schema validation that rejects unknown fields on InvoicePayment. Refresh your schema snapshot, regenerate clients, and extend your InvoicePayment types to include optional sourceInvoiceId and relatedPaymentId.
See also
- API reference:
InvoicePayment - API reference:
InvoiceRefund— existingrelatedPaymentfield