Create a credit memo

Request

Creates a credit memo.
Security
SecretApiKey or JWT
Bodyapplication/jsonrequired
allocationsobject
Allocations reduce the unused amount of a credit memo.
itemsArray of objects
Items of the credit memo.
reasonstring
Reason for the credit memo.
Enum:"return""product-unsatisfactory""order-change""order-cancellation""chargeback""write-off""waiver""customer-credit""prepayment""other"
descriptionstring
Public description, that is visible to customers, which describes the purpose of the credit memo.
shippingAmountnumber, (double)
Shipping amount of an invoice to credit.
Default:0
customerIdstring, <= 50 characters(CustomerId)required
ID of the customer. An update request cannot change the customer of an existing credit memo. To credit another customer, use the [Void a credit memo](https://www.rebilly.com/catalog/all/credit-memos/postcreditmemovoid) operation, then the [Create a credit memo](https://www.rebilly.com/catalog/all/credit-memos/postcreditmemo) operation for that customer.
Example:"cus_0YV7DDSDD1C8DA64KHH2W33CPF"
currencystring, = 3 characters(CurrencyCode)required
Currency code in ISO 4217 format.
Example:"USD"
invoiceIdstring or null, <= 50 characters
ID of the invoice to which the credit memo is issued.
Example:"in_0YVF9605RKC62BP14NE2R7V2XT"
transactionIdstring or null, <= 50 characters

ID of the transaction associated with the credit memo. Associating a transaction does not change the unused amount of the credit memo. The transaction must be approved and associated with the same customer as the credit memo. Approved transactions of any type are accepted, including refunds and voided sales. If the transaction result changes later, the association is retained. If this field is omitted in an update request, this field retains its current value. To remove the transaction from the credit memo, set this field to null.

Example:"txn_0YVDTQJ8YKC82BP14NE2R7V2XT"
curl -i -X POST \
  https://www.rebilly.com/_mock/catalog/all/credit-memos \
  -H 'Content-Type: application/json' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE' \
  -d '{
    "allocations": {
      "transactions": [
        {
          "transactionId": "txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0",
          "amount": 0.1
        }
      ],
      "invoices": [
        {
          "invoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT",
          "amount": 0.1
        }
      ]
    },
    "items": [
      {
        "invoiceItemId": "ii_0YVFDEQS2KCFTBN9HXWJFY55GV",
        "description": "string",
        "unitPrice": 0.1,
        "quantity": 0,
        "productId": "prod_0YV7DES3WPC5J8JD8QTVNZBZNZ",
        "planId": "plan_0YV7DENSVGDBW9S71XZNNYYQ0X",
        "tax": {
          "amount": 0.1,
          "description": "string",
          "rate": 0,
          "stateAmount": 0.94,
          "countyAmount": 0.04,
          "cityAmount": 0,
          "specialDistrictAmount": 0.38,
          "stateRate": 0,
          "countyRate": 0,
          "cityRate": 0,
          "specialDistrictRate": 0,
          "jurisdictions": {
            "country": "US",
            "state": "CA",
            "county": "LOS ANGELES",
            "city": "LOS ANGELES"
          }
        }
      }
    ],
    "reason": "return",
    "description": "string",
    "shippingAmount": 0,
    "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF",
    "currency": "USD",
    "invoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT",
    "transactionId": "txn_0YVDTQJ8YKC82BP14NE2R7V2XT"
  }'

Responses

Credit memo created.
Headers
Locationstring, (uri)
Location of the related resource.
Example:"https://api.rebilly.com/example"
Rate-Limit-Limitinteger

Maximum number of requests available at one time for this rate limit. For more information, see Rate limits.

Example:500
Rate-Limit-Remaininginteger

Number of requests still available for this rate limit. For more information, see Rate limits.

Example:499
Bodyapplication/json
idstring, <= 50 charactersread-only
ID of the credit memo.
Example:"crmm_0YVCNN22TWC3G8H82QNPNVZCHG"
numberintegerread-only
Auto-incrementing number based on the sequence of credit memos for any particular customer.
allocationsobject
Allocations reduce the unused amount of a credit memo.
itemsArray of objects
Items of the credit memo.
statusstringread-only
Status of the credit memo.
Enum ValueDescription
draft
Credit memo is in process of being created. The full amount of the credit memo is unused, and the customer has not seen it yet.
quotation

Credit memo is associated with an issued quote. When the quote is accepted, the status changes to issued, partially-applied, or applied, based on how much of the credit memo is allocated.

issued
Credit memo is available with a full amount to be applied.
applied
The full amount of the credit memo has been applied. No more credit can be created from it.
partially-applied
A partial amount of the credit memo has been applied. A credit can be created from the remaining amount.
voided
Credit memo has been voided and cannot be used anymore.
reasonstring
Reason for the credit memo.
Enum:"return""product-unsatisfactory""order-change""order-cancellation""chargeback""write-off""waiver""customer-credit""prepayment""other"
descriptionstring
Public description, that is visible to customers, which describes the purpose of the credit memo.
shippingAmountnumber, (double)
Shipping amount of an invoice to credit.
Default:0
taxAmountnumber, (double)read-only
Sum of items tax amount of an invoice to credit.
Default:0
totalAmountnumber, (double)read-only
Total amount of all credits in the credit memo, including items, shipping, and tax.
Default:0
unusedAmountnumber, (double)read-only
Unused credit memo amount that has not been allocated.
Default:0
revisionintegerread-only
Number of times the credit memo has been modified.
customerIdstring, <= 50 characters(CustomerId)required
ID of the customer. An update request cannot change the customer of an existing credit memo. To credit another customer, use the [Void a credit memo](https://www.rebilly.com/catalog/all/credit-memos/postcreditmemovoid) operation, then the [Create a credit memo](https://www.rebilly.com/catalog/all/credit-memos/postcreditmemo) operation for that customer.
Example:"cus_0YV7DDSDD1C8DA64KHH2W33CPF"
currencystring, = 3 characters(CurrencyCode)required
Currency code in ISO 4217 format.
Example:"USD"
invoiceIdstring or null, <= 50 characters
ID of the invoice to which the credit memo is issued.
Example:"in_0YVF9605RKC62BP14NE2R7V2XT"
quoteIdstring or null, <= 50 charactersread-only
ID of the related quote.
Example:"qt_0YVF9605RKC62BP14NE2R7V2XT"
transactionIdstring or null, <= 50 characters

ID of the transaction associated with the credit memo. Associating a transaction does not change the unused amount of the credit memo. The transaction must be approved and associated with the same customer as the credit memo. Approved transactions of any type are accepted, including refunds and voided sales. If the transaction result changes later, the association is retained. If this field is omitted in an update request, this field retains its current value. To remove the transaction from the credit memo, set this field to null.

Example:"txn_0YVDTQJ8YKC82BP14NE2R7V2XT"
createdTimestring, (date-time)(CreatedTime)read-only
Date and time when the resource is created. This value is set automatically when the resource is created.
updatedTimestring, (date-time)(UpdatedTime)read-only
Date and time when the resource is updated. This value is set automatically when the resource is updated.
_embeddedobjectread-only

Embedded objects that are requested by the expand query parameter.

Response
{ "id": "crmm_0YVCNN22TWC3G8H82QNPNVZCHG", "number": 0, "allocations": { "transactions": [ … ], "invoices": [ … ] }, "items": [ { … } ], "status": "draft", "reason": "return", "description": "string", "shippingAmount": 0, "taxAmount": 0, "totalAmount": 0, "unusedAmount": 0, "revision": 0, "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF", "currency": "USD", "invoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT", "quoteId": "qt_0YVF9605RKC62BP14NE2R7V2XT", "transactionId": "txn_0YVDTQJ8YKC82BP14NE2R7V2XT", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "_links": [ { … } ], "_embedded": { "customer": {} } }