> ## Documentation Index
> Fetch the complete documentation index at: https://developer.jtl-software.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AssignPaymentTransactionToSalesInvoiceCommandResponse

> Assigns a payment transaction to a sales invoice: the money is recorded as a payment of the invoice. Without 'amount', the ERP records what is open on the document, at most what is left of the transaction (less a cash discount the payment terms allow); when nothing is open on the document, it links the one payment of the document that matches and has no transaction yet, for example a payment from the shop, or else records what is left of the transaction as an overpayment. With 'amount', it always records a new payment of that amount; the document may become overpaid. A transaction of money sent or taken back records a payout (a negative payment). Fees of the payment provider that belong to the transaction are booked as order costs. A document that becomes fully paid starts its workflows. For a split, call it once per document. Errors: PAYMENT_TRANSACTION_NOT_FOUND (the payment transaction was not found); PAYMENT_ACCOUNT_HIDDEN (the payment account is hidden; show it with 'ShowPaymentAccount' first); PAYMENT_TRANSACTION_IGNORED (the transaction is ignored; unignore it first); PAYMENT_TRANSACTION_IS_FEE (the transaction is a fee; fees are attached to the sales order of the transaction they belong to); PAYMENT_TRANSACTION_NOT_COMPLETED (the transaction is not completed yet); NO_OPEN_AMOUNT (nothing of the transaction is left to assign); AMOUNT_NOT_POSITIVE (the amount is not greater than 0); AMOUNT_EXCEEDS_OPEN_AMOUNT (the amount is more than is left of the transaction: more than 'openAmount', for money sent or taken back more than its magnitude); OPEN_AMOUNT_CHANGED (the open amount of the transaction differs from 'expectedOpenAmount'); CURRENCY_MISMATCH (the transaction and the document have different currencies); PAYMENT_TRANSACTION_ALREADY_ASSIGNED_TO_DOCUMENT (the transaction already has a payment on this document; change that payment instead); SALES_INVOICE_NOT_FOUND (the sales invoice was not found); SALES_INVOICE_IS_DRAFT (the sales invoice is a draft); SALES_INVOICE_CANCELLED (the sales invoice is cancelled); SALES_INVOICE_TYPE_NOT_SUPPORTED (the invoice is not a regular sales invoice, for example a collective or a down payment invoice). - Response



**Kind**: `object`

## Fields

**`paymentId`**: `ID!`

The ID of the payment recorded or linked.

---

**`outcome`**: `PaymentTransactionAssignOutcome!`

Whether a payment was recorded or an existing one linked.

---

**`openAmount`**: `Decimal!`

What is left of the transaction afterwards.

---

**`assignmentStatus`**: `PaymentTransactionAssignmentStatus!`

How much of the transaction is assigned afterwards.

---

**`affectedPaymentTransactionIds`**: `[ID!]!`

Other transactions whose assigned and open amounts changed with this call: fee transactions that refer to this transaction and whose fees were booked on or removed from the sales order. Empty in most cases.

