Skip to main content
POST
/
v1
/
customer-credits
/
{customerCreditId}
/
invoice-receivables
/
{invoiceReceivableId}
/
link
Link customer credit to invoice
curl --request POST \
  --url https://api.light.inc/v1/customer-credits/{customerCreditId}/invoice-receivables/{invoiceReceivableId}/link \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json;charset=UTF-8' \
  --data '{
  "amount": 123
}'
{
  "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "customerCredit": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "documentNumber": "<string>",
    "documentDate": "2023-12-25",
    "amount": 123,
    "currency": "USD"
  },
  "invoiceReceivable": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "documentNumber": "<string>",
    "documentDate": "2023-12-25",
    "amount": 123,
    "currency": "USD"
  },
  "amount": 123,
  "linkedAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.

Path Parameters

customerCreditId
string<uuid>
required
invoiceReceivableId
string<uuid>
required

Body

application/json;charset=UTF-8
amount
integer<int64> | null

Amount of the customer credit to apply to the sales invoice, in the smallest currency unit. If omitted, the remaining unallocated customer-credit balance is applied, capped by the invoice receivable's remaining balance. Partial allocation is not supported for entities configured with an e-invoicing provider.

Response

default - application/json;charset=UTF-8

default response

companyId
string<uuid>

ID of the company

customerCredit
object

Invoice payable details

invoiceReceivable
object

Invoice payable details

amount
integer<int64>

Amount of the customer credit applied to the sales invoice, in the smallest currency unit

linkedAt
string<date-time>

Timestamp when the customer credit was linked to the sales invoice