Create customer credit
Creates a new customer credit
curl --request POST \
--url https://api.light.inc/v1/customer-credits \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentNumber": "<string>",
"description": "<string>",
"currency": "USD",
"localCurrencyFxRate": 123,
"groupCurrencyFxRate": 123,
"documentDate": "2023-12-25",
"documentTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"areLinesWithTax": true,
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"lines": [
{
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"netTransactionAmount": {
"amount": 123
},
"grossTransactionAmount": {
"amount": 123
},
"taxTransactionAmount": {
"amount": 123
},
"description": "<string>",
"ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"avataxCode": "<string>",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
],
"accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accrualStartDate": "2023-12-25",
"accrualEndDate": "2023-12-25"
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
]
}
'import requests
url = "https://api.light.inc/v1/customer-credits"
payload = {
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentNumber": "<string>",
"description": "<string>",
"currency": "USD",
"localCurrencyFxRate": 123,
"groupCurrencyFxRate": 123,
"documentDate": "2023-12-25",
"documentTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"areLinesWithTax": True,
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"lines": [
{
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"netTransactionAmount": { "amount": 123 },
"grossTransactionAmount": { "amount": 123 },
"taxTransactionAmount": { "amount": 123 },
"description": "<string>",
"ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"avataxCode": "<string>",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
],
"accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accrualStartDate": "2023-12-25",
"accrualEndDate": "2023-12-25"
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({
companyEntityId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
documentNumber: '<string>',
description: '<string>',
currency: 'USD',
localCurrencyFxRate: 123,
groupCurrencyFxRate: 123,
documentDate: '2023-12-25',
documentTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
areLinesWithTax: true,
customerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
amount: 123,
lines: [
{
productId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 123,
netTransactionAmount: {amount: 123},
grossTransactionAmount: {amount: 123},
taxTransactionAmount: {amount: 123},
description: '<string>',
ledgerTaxId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
ledgerAccountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
avataxCode: '<string>',
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
],
accrualTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
accrualStartDate: '2023-12-25',
accrualEndDate: '2023-12-25'
}
],
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
]
})
};
fetch('https://api.light.inc/v1/customer-credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.light.inc/v1/customer-credits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyEntityId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'documentNumber' => '<string>',
'description' => '<string>',
'currency' => 'USD',
'localCurrencyFxRate' => 123,
'groupCurrencyFxRate' => 123,
'documentDate' => '2023-12-25',
'documentTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'areLinesWithTax' => true,
'customerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'amount' => 123,
'lines' => [
[
'productId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123,
'netTransactionAmount' => [
'amount' => 123
],
'grossTransactionAmount' => [
'amount' => 123
],
'taxTransactionAmount' => [
'amount' => 123
],
'description' => '<string>',
'ledgerTaxId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'ledgerAccountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'avataxCode' => '<string>',
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
],
'accrualTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'accrualStartDate' => '2023-12-25',
'accrualEndDate' => '2023-12-25'
]
],
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/customer-credits"
payload := strings.NewReader("{\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"documentNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"USD\",\n \"localCurrencyFxRate\": 123,\n \"groupCurrencyFxRate\": 123,\n \"documentDate\": \"2023-12-25\",\n \"documentTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"areLinesWithTax\": true,\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 123,\n \"lines\": [\n {\n \"productId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"netTransactionAmount\": {\n \"amount\": 123\n },\n \"grossTransactionAmount\": {\n \"amount\": 123\n },\n \"taxTransactionAmount\": {\n \"amount\": 123\n },\n \"description\": \"<string>\",\n \"ledgerTaxId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"avataxCode\": \"<string>\",\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ],\n \"accrualTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accrualStartDate\": \"2023-12-25\",\n \"accrualEndDate\": \"2023-12-25\"\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.light.inc/v1/customer-credits")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"documentNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"USD\",\n \"localCurrencyFxRate\": 123,\n \"groupCurrencyFxRate\": 123,\n \"documentDate\": \"2023-12-25\",\n \"documentTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"areLinesWithTax\": true,\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 123,\n \"lines\": [\n {\n \"productId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"netTransactionAmount\": {\n \"amount\": 123\n },\n \"grossTransactionAmount\": {\n \"amount\": 123\n },\n \"taxTransactionAmount\": {\n \"amount\": 123\n },\n \"description\": \"<string>\",\n \"ledgerTaxId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"avataxCode\": \"<string>\",\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ],\n \"accrualTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accrualStartDate\": \"2023-12-25\",\n \"accrualEndDate\": \"2023-12-25\"\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/customer-credits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"documentNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"USD\",\n \"localCurrencyFxRate\": 123,\n \"groupCurrencyFxRate\": 123,\n \"documentDate\": \"2023-12-25\",\n \"documentTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"areLinesWithTax\": true,\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 123,\n \"lines\": [\n {\n \"productId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"netTransactionAmount\": {\n \"amount\": 123\n },\n \"grossTransactionAmount\": {\n \"amount\": 123\n },\n \"taxTransactionAmount\": {\n \"amount\": 123\n },\n \"description\": \"<string>\",\n \"ledgerTaxId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"avataxCode\": \"<string>\",\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ],\n \"accrualTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accrualStartDate\": \"2023-12-25\",\n \"accrualEndDate\": \"2023-12-25\"\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"customerName": "<string>",
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "DRAFT",
"description": "<string>",
"currency": "USD",
"documentDate": "2023-12-25",
"valuationDate": "2023-12-25",
"areLinesWithTax": true,
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customerCreditId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"grossTransactionAmount": {
"amount": 123,
"dcSign": "D"
},
"netTransactionAmount": {
"amount": 123,
"dcSign": "D"
},
"description": "<string>",
"ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxTransactionAmount": {
"amount": 123,
"dcSign": "D"
},
"ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"avataxCode": "<string>",
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accrualStartDate": "2023-12-25",
"accrualEndDate": "2023-12-25",
"accrualDefaultDuration": 123
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedInvoiceReceivable": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentNumber": "<string>",
"documentDate": "2023-12-25",
"status": "DRAFT",
"amount": 123,
"currency": "USD"
}
}Authorizations
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
Headers
Body
ID of the entity
Description of the customer credit
"USD"
Custom foreign exchange rate for the ledger's local currency. If not provided Light uses official ECB rates
Custom foreign exchange rate for the ledger's group currency. If not provided Light uses official ECB rates
Date when the customer credit was issued
ID of the document template that the customer credit will use
Whether the customer credit line amount is inclusive of tax or not. True means tax is already included in the line amount and will not be added on top, false means tax will be added on top of the line amount
ID of the customer
Total customer credit amount in cents
List of customer credit line items
Show child attributes
Show child attributes
List of custom properties associated with the customer credit
List of custom properties to set on the vendor.
Show child attributes
Show child attributes
Response
default response
Unique identifier for the object
ID of the company
ID of the entity
Total customer credit amount in cents
Name of the customer
ID of the customer
Status of the customer credit
⚠️ This enum is not exhaustive; new values may be added in the future.
DRAFT, APPROVAL_PENDING, APPROVED, POSTED, PARTIALLY_CLEARED, CLEARED, ARCHIVED Description of the customer credit
"USD"
Date when the customer credit was issued
Date used when applying foreign exchange rate
Whether the customer credit line amount is inclusive of tax or not. True means tax is already included in the line amount and will not be added on top, false means tax will be added on top of the line amount
List of customer credit line items
Show child attributes
Show child attributes
Timestamp when the customer credit was created
Timestamp when the customer credit was last updated
ID of the user who last updated the customer credit
Invoice payable details
Show child attributes
Show child attributes
curl --request POST \
--url https://api.light.inc/v1/customer-credits \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentNumber": "<string>",
"description": "<string>",
"currency": "USD",
"localCurrencyFxRate": 123,
"groupCurrencyFxRate": 123,
"documentDate": "2023-12-25",
"documentTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"areLinesWithTax": true,
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"lines": [
{
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"netTransactionAmount": {
"amount": 123
},
"grossTransactionAmount": {
"amount": 123
},
"taxTransactionAmount": {
"amount": 123
},
"description": "<string>",
"ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"avataxCode": "<string>",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
],
"accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accrualStartDate": "2023-12-25",
"accrualEndDate": "2023-12-25"
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
]
}
'import requests
url = "https://api.light.inc/v1/customer-credits"
payload = {
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentNumber": "<string>",
"description": "<string>",
"currency": "USD",
"localCurrencyFxRate": 123,
"groupCurrencyFxRate": 123,
"documentDate": "2023-12-25",
"documentTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"areLinesWithTax": True,
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"lines": [
{
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"netTransactionAmount": { "amount": 123 },
"grossTransactionAmount": { "amount": 123 },
"taxTransactionAmount": { "amount": 123 },
"description": "<string>",
"ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"avataxCode": "<string>",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
],
"accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accrualStartDate": "2023-12-25",
"accrualEndDate": "2023-12-25"
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({
companyEntityId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
documentNumber: '<string>',
description: '<string>',
currency: 'USD',
localCurrencyFxRate: 123,
groupCurrencyFxRate: 123,
documentDate: '2023-12-25',
documentTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
areLinesWithTax: true,
customerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
amount: 123,
lines: [
{
productId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 123,
netTransactionAmount: {amount: 123},
grossTransactionAmount: {amount: 123},
taxTransactionAmount: {amount: 123},
description: '<string>',
ledgerTaxId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
ledgerAccountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
avataxCode: '<string>',
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
],
accrualTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
accrualStartDate: '2023-12-25',
accrualEndDate: '2023-12-25'
}
],
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
]
})
};
fetch('https://api.light.inc/v1/customer-credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.light.inc/v1/customer-credits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyEntityId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'documentNumber' => '<string>',
'description' => '<string>',
'currency' => 'USD',
'localCurrencyFxRate' => 123,
'groupCurrencyFxRate' => 123,
'documentDate' => '2023-12-25',
'documentTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'areLinesWithTax' => true,
'customerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'amount' => 123,
'lines' => [
[
'productId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123,
'netTransactionAmount' => [
'amount' => 123
],
'grossTransactionAmount' => [
'amount' => 123
],
'taxTransactionAmount' => [
'amount' => 123
],
'description' => '<string>',
'ledgerTaxId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'ledgerAccountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'avataxCode' => '<string>',
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
],
'accrualTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'accrualStartDate' => '2023-12-25',
'accrualEndDate' => '2023-12-25'
]
],
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/customer-credits"
payload := strings.NewReader("{\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"documentNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"USD\",\n \"localCurrencyFxRate\": 123,\n \"groupCurrencyFxRate\": 123,\n \"documentDate\": \"2023-12-25\",\n \"documentTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"areLinesWithTax\": true,\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 123,\n \"lines\": [\n {\n \"productId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"netTransactionAmount\": {\n \"amount\": 123\n },\n \"grossTransactionAmount\": {\n \"amount\": 123\n },\n \"taxTransactionAmount\": {\n \"amount\": 123\n },\n \"description\": \"<string>\",\n \"ledgerTaxId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"avataxCode\": \"<string>\",\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ],\n \"accrualTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accrualStartDate\": \"2023-12-25\",\n \"accrualEndDate\": \"2023-12-25\"\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.light.inc/v1/customer-credits")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"documentNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"USD\",\n \"localCurrencyFxRate\": 123,\n \"groupCurrencyFxRate\": 123,\n \"documentDate\": \"2023-12-25\",\n \"documentTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"areLinesWithTax\": true,\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 123,\n \"lines\": [\n {\n \"productId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"netTransactionAmount\": {\n \"amount\": 123\n },\n \"grossTransactionAmount\": {\n \"amount\": 123\n },\n \"taxTransactionAmount\": {\n \"amount\": 123\n },\n \"description\": \"<string>\",\n \"ledgerTaxId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"avataxCode\": \"<string>\",\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ],\n \"accrualTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accrualStartDate\": \"2023-12-25\",\n \"accrualEndDate\": \"2023-12-25\"\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/customer-credits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"documentNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"USD\",\n \"localCurrencyFxRate\": 123,\n \"groupCurrencyFxRate\": 123,\n \"documentDate\": \"2023-12-25\",\n \"documentTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"areLinesWithTax\": true,\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"amount\": 123,\n \"lines\": [\n {\n \"productId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"netTransactionAmount\": {\n \"amount\": 123\n },\n \"grossTransactionAmount\": {\n \"amount\": 123\n },\n \"taxTransactionAmount\": {\n \"amount\": 123\n },\n \"description\": \"<string>\",\n \"ledgerTaxId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerAccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"avataxCode\": \"<string>\",\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ],\n \"accrualTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accrualStartDate\": \"2023-12-25\",\n \"accrualEndDate\": \"2023-12-25\"\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"customerName": "<string>",
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "DRAFT",
"description": "<string>",
"currency": "USD",
"documentDate": "2023-12-25",
"valuationDate": "2023-12-25",
"areLinesWithTax": true,
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customerCreditId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"grossTransactionAmount": {
"amount": 123,
"dcSign": "D"
},
"netTransactionAmount": {
"amount": 123,
"dcSign": "D"
},
"description": "<string>",
"ledgerTaxId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxTransactionAmount": {
"amount": 123,
"dcSign": "D"
},
"ledgerAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"avataxCode": "<string>",
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"accrualTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accrualStartDate": "2023-12-25",
"accrualEndDate": "2023-12-25",
"accrualDefaultDuration": 123
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedInvoiceReceivable": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentNumber": "<string>",
"documentDate": "2023-12-25",
"status": "DRAFT",
"amount": 123,
"currency": "USD"
}
}