Apply Credit Memo
Applies an existing credit memo to one or more invoices. This works the same way as the Apply subtab on a credit memo in the NetSuite UI: one credit memo can be applied to several invoices in a single request.
Base URL
https://{{accountid}}.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=customscript_prac_api_applycreditmemo&deploy=customdeploy_prac_api_applycreditmemo_v1
HTTP: PUT
Sets how an existing credit memo is applied to one or more transactions.
Required URL Parameters
| Name | Value | Notes |
|---|---|---|
| script | customscript_prac_api_applycreditmemo | |
| deploy | customdeploy_prac_api_applycreditmemo_v1 |
Payload
The payload must be JSON. The applying transaction is the credit memo; the apply to transactions are the invoices. Each one can be identified by its transaction ID (tranId / applyingTranId) or its internal ID (id / applyingId).
Format:
{
"applyingTranId OR applyingId": "transaction ID OR internal ID",
"applyTo": [
{
"tranId OR id": "transaction ID OR internal ID",
"amount": number
}
]
}
| Property | Type | Notes |
|---|---|---|
| applyingTranId | {{string}} | Transaction ID of the credit memo. Use this or applyingId. |
| applyingId | {{integer}} | Internal ID of the credit memo. Use this or applyingTranId. |
| applyTo | {{array}} | One or more transactions to apply the credit memo to. Required; cannot be empty. |
| applyTo[].tranId | {{string}} | Transaction ID of an invoice, e.g. INV17641. Use this or id. |
| applyTo[].id | {{integer}} | Internal ID of the transaction. Use this or tranId. |
| applyTo[].amount | {{number}} | Required. The amount to apply to this transaction. 0 removes (un-applies) an existing application. |
Example:
{
"applyingId": 12669,
"applyTo": [
{
"tranId": "INV17641",
"amount": 25.00
}
]
}
Rules
- Amounts are set, not added. If the credit memo already has $50 applied to an invoice and you send
"amount": 75, the application becomes $75 (not $125). Send0to un-apply. - Only the listed transactions change. Any other applications already on the credit memo are left as they are.
- All or nothing. Every item in
applyTois checked before anything is saved. If any item is invalid, the request fails and nothing is applied. - IDs and transaction IDs can be mixed. For example,
applyingTranIdwith anapplyToitem that usesid. If both are supplied for the same transaction, the internal ID is used. - A transaction can only appear once in
applyTo. - The transaction must be available on the credit memo's Apply list, i.e. an open transaction for the same client.
amountcannot exceed what can be applied to that transaction (its amount due plus anything this credit memo already applies to it), and the total increase across the request cannot exceed the credit memo's unapplied amount.
Journal Entries
A credit memo can also be applied to a journal entry on the client's account, but journal entries must be identified by internal ID (id). tranId can only be used for invoices; a journal entry's transaction ID cannot be used in the apply JSON and will return PRAC_API_TRANID_NOT_FOUND.