Creates a new credit memo and returns its full payload.
Body
| Field | Type | Default | Description |
|---|---|---|---|
creditmemo_data | object | — | Required. The credit memo, see below |
comment | string | — | Optional comment stored on the memo |
notify_customer | bool | false | Email the customer. For a refund handling this sends the refund receipt instead of the credit memo email |
include_comment | bool | false | Put comment in the email body. Has no effect on visibility |
is_visible_on_front | bool | false | Show comment to the customer in their account |
creditmemo_data
creditmemo_data| Field | Description |
|---|---|
customer_id / company_id | The account the credit belongs to. At least one is required, unless a linked invoice supplies the owner. A guest (ownerless) memo is allowed only together with a refund handling |
store_id | Defaults to the store of the source invoice, or the default store |
creditmemo_type | 1 Items (default) or 2 Amount. An Amount memo may not include items or a fee_amount |
memo_amount | Credit amount for an Amount memo |
shipping_amount, tax_amount, discount_amount, payment_surcharge_amount, fee_amount | Header amounts. fee_amount is for Items memos only |
adjustment_amount | Adjustment applied to the total. A memo whose grand total nets to 0 is created already Applied |
created_at | Optional credit memo date. It may not be later than today in the store's timezone |
items[] | Credit lines, see below |
source_entity_links[] | Optional { "linked_entity_type": 2, "linked_entity_id": <bill_id> } rows. If omitted they are derived from items[] |
credit_handling | credit (default), refund_offline or refund_online. An unknown value is rejected; it never falls back to credit |
refund | { "method_code", "method_code_comment" }. Only allowed with refund_offline, where method_code must be an offline payment method |
items[]
items[]Each line must be one of these two kinds:
- Invoice line: either
unique_item_idas"2_<bill_id>_<bill_item_id>", or all three oflinked_entity_type: 2,linked_entity_idandlinked_entity_item_id. A partial reference is rejected, so an invoice line can't quietly turn into a standalone credit. Leaving outqtycredits the line's full remaining creditable quantity. - Standalone line:
product_idwith no invoice reference. The price comes from the product's final price.
Optional on either kind: qty (always units, never packages), back_to_stock (return the quantity to inventory), location_id (inventory location) and ignore_packaging (bool, deliberately break a sold package).
Ignored fields
The server always creates a new memo. creditmemo_id, entity_id, increment_id, state, key and qty_entered_in_packages are ignored on the header, and so are item_id, entity_id and parent_id on items.
Response
{ success, creditmemo, notify_customer }, plus a refund object when a refund handling was used:
| Field | Description |
|---|---|
refund.increment_id | Refund transaction increment id |
refund.capture_case | online / offline |
refund.method_code, refund.method_code_comment | How the refund was paid |
refund.total, refund.base_total | Refunded amount |
refund.payment_increment_id | The payment refunded. null for a ledger-only refund, e.g. when the source invoice was paid by credit |
A refund failure, including a gateway decline, saves nothing. If the memo is saved but building the full response fails, the response is still success: true with only the increment ids, so the client must not retry in that case.
Variant: Create (standalone product)
Standalone Items memo: credits a product that isn't tied to an invoice line. The owner (customer_id and/or company_id) is required and the price comes from the product's final price.
See Create (from invoice lines) for the full field reference.
Variant: Create (flat amount)
Amount memo (creditmemo_type: 2): a flat credit of memo_amount with no line items. items and fee_amount are rejected on this type.
See Create (from invoice lines) for the full field reference.
Variant: Create + offline refund
Creates the memo and immediately pays all of its credit out as an offline refund in the same step. refund.method_code must be an offline payment method. notify_customer sends the refund receipt.
For a gateway refund use credit_handling: refund_online and leave out refund (sending it is rejected).
See Create (from invoice lines) for the full field reference.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
