producers
Post v3producerscontractscharges and creditscsv upload
This API allows you to credit amounts towards specific customer contracts. These can be single items or recurring amounts, which will be added to the next customer invoice. Typical use cases are customer-specific or variable amounts that you want to keep full control over.
An example is bonus payments, which can be granted once as a referral bonus or over several months/years as a promotional bonus.
Has similar to ChargesAndCreditsCreateAPIView logic, but works with bulk creation from csv file
Requirements to CSV file format:
- Encoding: Unicode, UTF-8;
- Line ending: Unix/Linux, LF;
- Headers must be included;
- Separator: semicolon;
- Date format: YYYY-MM-DD;
- Fields:
- contract_id
- type_of_transaction
- amount_cent
- is_gross
- vat_type
- due_date
- no_of_executions
- execution_cycle
- input_id
- category
- display_name
- explanation_text
- bookkeeping_account
CSV file data example:
contract_id;type_of_transaction;amount_cent;is_gross;vat_type;due_date;no_of_executions;execution_cycle;input_id;category;display_name;explanation_text;bookkeeping_account
CC-ID1-001;credit;10000;FALSE;normal;2023-05-30;1;;In_ID_001;Category_001;May_Credit_001 2023;;0001
CC-ID2-002;charge;20000;TRUE;reduced;2023-05-30;1;;In_ID_002;Category_002;May_Charge_001 2023;;0002
POST
/
v3
/
producers
/
contracts
/
charges_and_credits
/
csv_upload
/
cURL
curl --request POST \
--url https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/ \
--header 'Content-Type: multipart/form-data' \
--form 'file=<string>'import requests
url = "https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {"Content-Type": "multipart/form-data"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/', 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.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"bonus_created": [
{
"ABCDEFGH0001": {
"type_of_transaction": "credit",
"amount_cent": 1000,
"is_gross": true,
"vat_type": "normal",
"due_date": "2022-02-01",
"input_id": "ABCDEFGH0001",
"internal_id": "ABCDEFGH0001__1",
"contract_id": "CC0001",
"category": "non_charging_bonus",
"display_name": "Non-charging bonus",
"explanation_text": "Diesen Bonus erhalten Sie da Sie noch nicht laden.",
"bookkeeping_account": "",
"salespartner": "salespartner_spid"
}
},
{
"ABCDEFGH0001": {
"type_of_transaction": "credit",
"amount_cent": 1000,
"is_gross": true,
"vat_type": "normal",
"due_date": "2022-03-01",
"input_id": "ABCDEFGH0001",
"internal_id": "ABCDEFGH0001__2",
"contract_id": "CC0001",
"category": "non_charging_bonus",
"display_name": "Non-charging bonus",
"explanation_text": "Diesen Bonus erhalten Sie da Sie noch nicht laden.",
"bookkeeping_account": "",
"salespartner": "salespartner_spid"
}
}
]
}{
"amount_cent": [
"Ensure this value is greater than or equal to 0."
],
"execution_cycle": [
"This field required in case when \"no_of_executions\" greater than 1."
]
}⌘I
cURL
curl --request POST \
--url https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/ \
--header 'Content-Type: multipart/form-data' \
--form 'file=<string>'import requests
url = "https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {"Content-Type": "multipart/form-data"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/', 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.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lumenaza.de/v3/producers/contracts/charges_and_credits/csv_upload/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"bonus_created": [
{
"ABCDEFGH0001": {
"type_of_transaction": "credit",
"amount_cent": 1000,
"is_gross": true,
"vat_type": "normal",
"due_date": "2022-02-01",
"input_id": "ABCDEFGH0001",
"internal_id": "ABCDEFGH0001__1",
"contract_id": "CC0001",
"category": "non_charging_bonus",
"display_name": "Non-charging bonus",
"explanation_text": "Diesen Bonus erhalten Sie da Sie noch nicht laden.",
"bookkeeping_account": "",
"salespartner": "salespartner_spid"
}
},
{
"ABCDEFGH0001": {
"type_of_transaction": "credit",
"amount_cent": 1000,
"is_gross": true,
"vat_type": "normal",
"due_date": "2022-03-01",
"input_id": "ABCDEFGH0001",
"internal_id": "ABCDEFGH0001__2",
"contract_id": "CC0001",
"category": "non_charging_bonus",
"display_name": "Non-charging bonus",
"explanation_text": "Diesen Bonus erhalten Sie da Sie noch nicht laden.",
"bookkeeping_account": "",
"salespartner": "salespartner_spid"
}
}
]
}{
"amount_cent": [
"Ensure this value is greater than or equal to 0."
],
"execution_cycle": [
"This field required in case when \"no_of_executions\" greater than 1."
]
}
