Upsert a credit memo

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

SecuritySecretApiKey or JWT
Request
path Parameters
id
required
string <= 50 characters ^[@~\-\.\w]+$

ID of the resource.

Request Body schema: application/json
customerId
required
string (CustomerId) <= 50 characters

Customer resource ID.

currency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

object

Allocations reduce the unused amount of a credit memo.

Array of objects

List of transactions (typically refunds, credits, and chargebacks) that are allocated to reduce the unused amount of a credit memo.

  • To delete transaction allocations, send an empty transaction allocation array in the request.
  • To modify transaction allocations, send a modified transaction allocation array in the request.
  • If you do not want to modify or delete transaction allocations, do not send a transaction allocation array in the request.
Array
transactionId
string <= 50 characters

ID of the transaction to which the credit memo is allocated.

amount
number <double>

Amount of credit that is allocated from the credit memo to the transaction. If the amount value is not supplied or exceeds the unused amount of the credit memo or the transaction amount, the lesser of the following two values is used:

  • The unused amount of the credit memo.
  • The transaction amount.
Array of objects

List of invoices that the credit memo is allocated to.

  • To delete invoice allocations, send an empty invoice allocation array in the request. Paid invoices cannot be modified or deleted.
  • To modify invoice allocations, send a modified invoice allocation array in the request.
  • If you do not want to modify or delete invoice allocations, do not send an invoice allocation array in the request.
Array
invoiceId
string <= 50 characters

ID of invoice to which the credit memo is allocated.

amount
number <double>

Amount of credit that is allocated from the credit memo to the invoice. If the amount value is not supplied or exceeds the unused amount of the credit memo or the invoice due amount, the lesser of the following two values is used:

  • The unused amount of the credit memo.
  • The invoice due amount.
Array of objects

Items of the credit memo.

Array
unitPrice
required
number <double>

Price of the credit memo item.

quantity
required
integer

Quantity of the credit memo item.

invoiceItemId
string or null <= 50 characters

ID of the invoice item to which the credit item is referenced.

description
string

Description of the credit memo item.

productId
string <= 50 characters

ID of the related product.

planId
string <= 50 characters

ID of the related plan.

object or null

Credit memo item tax.

reason
string

Reason for the credit memo.

Enum: "return" "product-unsatisfactory" "order-change" "order-cancellation" "chargeback" "write-off" "waiver" "customer-credit" "other"
description
string

Public description, that is visible to customers, which describes the purpose of the credit memo.

shippingAmount
number <double>
Default: 0

Shipping amount of an invoice to credit.

invoiceId
string or null <= 50 characters

ID of the invoice to which the credit memo is issued.

Responses
200

Credit memo updated.

Response Schema: application/json
customerId
required
string (CustomerId) <= 50 characters

Customer resource ID.

currency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

id
string <= 50 characters

ID of the credit memo.

number
integer

Auto-incrementing number based on the sequence of credit memos for any particular customer.

object

Allocations reduce the unused amount of a credit memo.

Array of objects

List of transactions (typically refunds, credits, and chargebacks) that are allocated to reduce the unused amount of a credit memo.

  • To delete transaction allocations, send an empty transaction allocation array in the request.
  • To modify transaction allocations, send a modified transaction allocation array in the request.
  • If you do not want to modify or delete transaction allocations, do not send a transaction allocation array in the request.
Array
transactionId
string <= 50 characters

ID of the transaction to which the credit memo is allocated.

amount
number <double>

Amount of credit that is allocated from the credit memo to the transaction. If the amount value is not supplied or exceeds the unused amount of the credit memo or the transaction amount, the lesser of the following two values is used:

  • The unused amount of the credit memo.
  • The transaction amount.
currency
string = 3 characters

Currency code in ISO 4217 format.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects

List of invoices that the credit memo is allocated to.

  • To delete invoice allocations, send an empty invoice allocation array in the request. Paid invoices cannot be modified or deleted.
  • To modify invoice allocations, send a modified invoice allocation array in the request.
  • If you do not want to modify or delete invoice allocations, do not send an invoice allocation array in the request.
Array
invoiceId
string <= 50 characters

ID of invoice to which the credit memo is allocated.

amount
number <double>

Amount of credit that is allocated from the credit memo to the invoice. If the amount value is not supplied or exceeds the unused amount of the credit memo or the invoice due amount, the lesser of the following two values is used:

  • The unused amount of the credit memo.
  • The invoice due amount.
currency
string = 3 characters

Currency code in ISO 4217 format.

createdTime
string <date-time>

Date and time at which a credit memo is allocated.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects

Items of the credit memo.

Array
unitPrice
required
number <double>

Price of the credit memo item.

quantity
required
integer

Quantity of the credit memo item.

id
string <= 50 characters

ID of the credit memo item.

invoiceItemId
string or null <= 50 characters

ID of the invoice item to which the credit item is referenced.

description
string

Description of the credit memo item.

price
number <double>

Total price of the credit memo item.

productId
string <= 50 characters

ID of the related product.

planId
string <= 50 characters

ID of the related plan.

object or null

Credit memo item tax.

status
string

Status of the credit memo.

Enum: Description
issued

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

reason
string

Reason for the credit memo.

Enum: "return" "product-unsatisfactory" "order-change" "order-cancellation" "chargeback" "write-off" "waiver" "customer-credit" "other"
description
string

Public description, that is visible to customers, which describes the purpose of the credit memo.

shippingAmount
number <double>
Default: 0

Shipping amount of an invoice to credit.

taxAmount
number <double>
Default: 0

Sum of items tax amount of an invoice to credit.

totalAmount
number <double>
Default: 0

Total amount of all credits in the credit memo, including items, shipping, and tax.

unusedAmount
number <double>
Default: 0

Unused credit memo amount that has not been allocated.

revision
integer

Number of times the credit memo has been modified.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects

Related links.

Array
href
string

Link URL.

rel
string

Type of link.

Enum: "self" "customer" "invoice"
invoiceId
string or null <= 50 characters

ID of the invoice to which the credit memo is issued.

201

Credit memo created.

Response Headers
Location
string <uri>

Location of the related resource.

Example: "https://api.rebilly.com/example"
Response Schema: application/json
customerId
required
string (CustomerId) <= 50 characters

Customer resource ID.

currency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

id
string <= 50 characters

ID of the credit memo.

number
integer

Auto-incrementing number based on the sequence of credit memos for any particular customer.

object

Allocations reduce the unused amount of a credit memo.

Array of objects

List of transactions (typically refunds, credits, and chargebacks) that are allocated to reduce the unused amount of a credit memo.

  • To delete transaction allocations, send an empty transaction allocation array in the request.
  • To modify transaction allocations, send a modified transaction allocation array in the request.
  • If you do not want to modify or delete transaction allocations, do not send a transaction allocation array in the request.
Array
transactionId
string <= 50 characters

ID of the transaction to which the credit memo is allocated.

amount
number <double>

Amount of credit that is allocated from the credit memo to the transaction. If the amount value is not supplied or exceeds the unused amount of the credit memo or the transaction amount, the lesser of the following two values is used:

  • The unused amount of the credit memo.
  • The transaction amount.
currency
string = 3 characters

Currency code in ISO 4217 format.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects

List of invoices that the credit memo is allocated to.

  • To delete invoice allocations, send an empty invoice allocation array in the request. Paid invoices cannot be modified or deleted.
  • To modify invoice allocations, send a modified invoice allocation array in the request.
  • If you do not want to modify or delete invoice allocations, do not send an invoice allocation array in the request.
Array
invoiceId
string <= 50 characters

ID of invoice to which the credit memo is allocated.

amount
number <double>

Amount of credit that is allocated from the credit memo to the invoice. If the amount value is not supplied or exceeds the unused amount of the credit memo or the invoice due amount, the lesser of the following two values is used:

  • The unused amount of the credit memo.
  • The invoice due amount.
currency
string = 3 characters

Currency code in ISO 4217 format.

createdTime
string <date-time>

Date and time at which a credit memo is allocated.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects

Items of the credit memo.

Array
unitPrice
required
number <double>

Price of the credit memo item.

quantity
required
integer

Quantity of the credit memo item.

id
string <= 50 characters

ID of the credit memo item.

invoiceItemId
string or null <= 50 characters

ID of the invoice item to which the credit item is referenced.

description
string

Description of the credit memo item.

price
number <double>

Total price of the credit memo item.

productId
string <= 50 characters

ID of the related product.

planId
string <= 50 characters

ID of the related plan.

object or null

Credit memo item tax.

status
string

Status of the credit memo.

Enum: Description
issued

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

reason
string

Reason for the credit memo.

Enum: "return" "product-unsatisfactory" "order-change" "order-cancellation" "chargeback" "write-off" "waiver" "customer-credit" "other"
description
string

Public description, that is visible to customers, which describes the purpose of the credit memo.

shippingAmount
number <double>
Default: 0

Shipping amount of an invoice to credit.

taxAmount
number <double>
Default: 0

Sum of items tax amount of an invoice to credit.

totalAmount
number <double>
Default: 0

Total amount of all credits in the credit memo, including items, shipping, and tax.

unusedAmount
number <double>
Default: 0

Unused credit memo amount that has not been allocated.

revision
integer

Number of times the credit memo has been modified.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects

Related links.

Array
href
string

Link URL.

rel
string

Type of link.

Enum: "self" "customer" "invoice"
invoiceId
string or null <= 50 characters

ID of the invoice to which the credit memo is issued.

401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

404

Resource not found.

422

Invalid data sent.

put/credit-memos/{id}
Request samples
application/json
{
  • "allocations": {
    },
  • "items": [
    ],
  • "reason": "return",
  • "description": "string",
  • "shippingAmount": 0,
  • "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF",
  • "currency": "USD",
  • "invoiceId": "44433322-2c4y-483z-a0a9-158621f77a21"
}
Response samples
application/json
{
  • "id": "cm_0YV7DE1YYBC7C9JJ79J2PBB5RR",
  • "number": 0,
  • "allocations": {
    },
  • "items": [
    ],
  • "status": "issued",
  • "reason": "return",
  • "description": "string",
  • "shippingAmount": 0,
  • "taxAmount": 0,
  • "totalAmount": 0,
  • "unusedAmount": 0,
  • "revision": 0,
  • "createdTime": "2019-08-24T14:15:22Z",
  • "updatedTime": "2019-08-24T14:15:22Z",
  • "_links": [
    ],
  • "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF",
  • "currency": "USD",
  • "invoiceId": "44433322-2c4y-483z-a0a9-158621f77a21"
}