Allocate customer credit balance to an invoice

Request

Allocates existing allocatable credit memos related to the invoice customer. Specific credit memos cannot be provided in the request and are selected automatically. Allocation can be capped with amount. Credit memos are applied automatically in the specified allocation order. If no order is specified, oldest-first is used.

Security
SecretApiKey or JWT
Path
idstring, <= 50 characters^[@~\-\.\w]+$required
ID of the resource.
Bodyapplication/json
Invoice credit memo automatic allocation settings.
amountnumber, (double), > 0

Optional maximum amount to allocate from customer credit memos to the invoice. If provided, allocation is capped at this value. If omitted, the allocated amount is the lesser of:

  • Invoice unpaid amount.
  • Available allocatable credit memo balance.
allocationOrderstring
Credit memo application order.
Default:"oldest-first"
Enum ValueDescription
oldest-first
Applies oldest allocatable credit memos first.
newest-first
Applies newest allocatable credit memos first.
curl -i -X POST \
  'https://www.rebilly.com/_mock/catalog/all/invoices/{id}/allocate-credit-balance' \
  -H 'Content-Type: application/json' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE' \
  -d '{
    "amount": 1,
    "allocationOrder": "oldest-first"
  }'

Responses

Credit memos allocated to invoice.
Headers
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
invoiceIdstring, <= 50 charactersread-onlyrequired
ID of the invoice.
Example:"in_0YVF9605RKC62BP14NE2R7V2XT"
currencystring, = 3 characters(CurrencyCode)read-onlyrequired
Currency code in ISO 4217 format.
Example:"USD"
appliedCreditMemosArray of objects(InvoiceAppliedCreditMemoAllocation)read-onlyrequired
List of credit memos applied to the invoice and the amount allocated from each.
remainingInvoiceAmountnumber, (double)read-onlyrequired
Remaining amount due on the invoice after credit memo allocation.
Response
{ "invoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT", "currency": "USD", "appliedCreditMemos": [ { … } ], "remainingInvoiceAmount": 0.1 }