Upsert a credit memo

Request

Creates or updates (upserts) a credit memo with a specified ID.

Security
SecretApiKey or JWT
Path
idstring, <= 50 characters^[@~\-\.\w]+$required

ID of the resource.

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 resource.

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"
curl -i -X PUT \
  'https://www.rebilly.com/_mock/catalog/all/credit-memos/{id}' \
  -H 'Content-Type: application/json' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE' \
  -d '{
    "allocations": {
      "transactions": [
        {
          "transactionId": "txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0",
          "amount": 0.1,
          "currency": "USD"
        }
      ],
      "invoices": [
        {
          "invoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT",
          "amount": 0.1,
          "currency": "USD"
        }
      ]
    },
    "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"
  }'

Responses

Credit memo updated.

Headers
X-RateLimit-Limitinteger

Total number of rate limit tokens for this request within a rate limit period. For more information, see Rate limits.

Example:3600
X-RateLimit-Remaininginteger

Remaining number of rate limit tokens for this request within the rate limit period. For example, in the sandbox environment, rate limits for non-GET endpoints are set at 3000 requests per 10 minutes.

Example:3600
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 a quote. If the customer approves the quotation, the credit memo changes to the issued state.

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 resource.

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"
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", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "_links": [ {} ], "_embedded": { "customer": {} } }