curl --request POST \ --url https://api.maesn.dev/accounting/paymentTerms \ --header 'Content-Type: application/json' \ --header 'X-ACCOUNT-KEY: <x-account-key>' \ --header 'X-API-KEY: <x-api-key>' \ --data '{ "code": "1", "description": "31 dagen", "discountDays": 10, "discountDays2": 14, "discountPercentage": 5, "discountPercentage2": 3, "discountPeriods": [ { "invoiceRange": "Invoice issuance range up to day 5 of the month", "discountDeadline": "Day 15 of the current month", "discountDeadline2": "Day 25 of the current month", "paymentDeadline": "Day 30 of the current month" } ], "name": "31 DAYS", "paymentDays": 31, "paymentMethod": "BANK_TRANSFER"}'
import requests
url = "https://api.maesn.dev/accounting/paymentTerms"
payload = {
"code": "1",
"description": "31 dagen",
"discountDays": 10,
"discountDays2": 14,
"discountPercentage": 5,
"discountPercentage2": 3,
"discountPeriods": [
{
"invoiceRange": "Invoice issuance range up to day 5 of the month",
"discountDeadline": "Day 15 of the current month",
"discountDeadline2": "Day 25 of the current month",
"paymentDeadline": "Day 30 of the current month"
}
],
"name": "31 DAYS",
"paymentDays": 31,
"paymentMethod": "BANK_TRANSFER"
}
headers = {
"X-API-KEY": "<x-api-key>",
"X-ACCOUNT-KEY": "<x-account-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {
'X-API-KEY': '<x-api-key>',
'X-ACCOUNT-KEY': '<x-account-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: '1',
description: '31 dagen',
discountDays: 10,
discountDays2: 14,
discountPercentage: 5,
discountPercentage2: 3,
discountPeriods: [
{
invoiceRange: 'Invoice issuance range up to day 5 of the month',
discountDeadline: 'Day 15 of the current month',
discountDeadline2: 'Day 25 of the current month',
paymentDeadline: 'Day 30 of the current month'
}
],
name: '31 DAYS',
paymentDays: 31,
paymentMethod: 'BANK_TRANSFER'
})
};
fetch('https://api.maesn.dev/accounting/paymentTerms', 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.maesn.dev/accounting/paymentTerms",
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([
'code' => '1',
'description' => '31 dagen',
'discountDays' => 10,
'discountDays2' => 14,
'discountPercentage' => 5,
'discountPercentage2' => 3,
'discountPeriods' => [
[
'invoiceRange' => 'Invoice issuance range up to day 5 of the month',
'discountDeadline' => 'Day 15 of the current month',
'discountDeadline2' => 'Day 25 of the current month',
'paymentDeadline' => 'Day 30 of the current month'
]
],
'name' => '31 DAYS',
'paymentDays' => 31,
'paymentMethod' => 'BANK_TRANSFER'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-ACCOUNT-KEY: <x-account-key>",
"X-API-KEY: <x-api-key>"
],
]);
$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.maesn.dev/accounting/paymentTerms"
payload := strings.NewReader("{\n \"code\": \"1\",\n \"description\": \"31 dagen\",\n \"discountDays\": 10,\n \"discountDays2\": 14,\n \"discountPercentage\": 5,\n \"discountPercentage2\": 3,\n \"discountPeriods\": [\n {\n \"invoiceRange\": \"Invoice issuance range up to day 5 of the month\",\n \"discountDeadline\": \"Day 15 of the current month\",\n \"discountDeadline2\": \"Day 25 of the current month\",\n \"paymentDeadline\": \"Day 30 of the current month\"\n }\n ],\n \"name\": \"31 DAYS\",\n \"paymentDays\": 31,\n \"paymentMethod\": \"BANK_TRANSFER\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<x-api-key>")
req.Header.Add("X-ACCOUNT-KEY", "<x-account-key>")
req.Header.Add("Content-Type", "application/json")
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.maesn.dev/accounting/paymentTerms")
.header("X-API-KEY", "<x-api-key>")
.header("X-ACCOUNT-KEY", "<x-account-key>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"1\",\n \"description\": \"31 dagen\",\n \"discountDays\": 10,\n \"discountDays2\": 14,\n \"discountPercentage\": 5,\n \"discountPercentage2\": 3,\n \"discountPeriods\": [\n {\n \"invoiceRange\": \"Invoice issuance range up to day 5 of the month\",\n \"discountDeadline\": \"Day 15 of the current month\",\n \"discountDeadline2\": \"Day 25 of the current month\",\n \"paymentDeadline\": \"Day 30 of the current month\"\n }\n ],\n \"name\": \"31 DAYS\",\n \"paymentDays\": 31,\n \"paymentMethod\": \"BANK_TRANSFER\"\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.maesn.dev/accounting/paymentTerms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<x-api-key>'
request["X-ACCOUNT-KEY"] = '<x-account-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"1\",\n \"description\": \"31 dagen\",\n \"discountDays\": 10,\n \"discountDays2\": 14,\n \"discountPercentage\": 5,\n \"discountPercentage2\": 3,\n \"discountPeriods\": [\n {\n \"invoiceRange\": \"Invoice issuance range up to day 5 of the month\",\n \"discountDeadline\": \"Day 15 of the current month\",\n \"discountDeadline2\": \"Day 25 of the current month\",\n \"paymentDeadline\": \"Day 30 of the current month\"\n }\n ],\n \"name\": \"31 DAYS\",\n \"paymentDays\": 31,\n \"paymentMethod\": \"BANK_TRANSFER\"\n}"
response = http.request(request)
puts response.read_body
{ "meta": { "warnings": [ "Field not used by target system" ], "pagination": { "total": 125, "perPage": 50, "currentPage": 1, "totalPages": 3 } }, "data": { "id": "08d52c49-b90c-4328-b1ec-623df74f904a", "code": "1", "createdDate": "2021-01-01T00:00:00Z", "description": "31 dagen", "discountDays": 10, "discountDays2": 14, "discountDaysCalculation": "10D", "discountPercentage": 5, "discountPercentage2": 3, "discountPeriods": [ { "invoiceRange": "Invoice issuance range up to day 5 of the month", "discountDeadline": "Day 15 of the current month", "discountDeadline2": "Day 25 of the current month", "paymentDeadline": "Day 30 of the current month" } ], "dueType": "DUE_IN_DAYS", "name": "31 DAYS", "paymentDays": 31, "paymentDaysCalculation": "10D", "paymentMethod": "BANK_TRANSFER", "updatedDate": "2021-01-01T00:00:00Z" }}
Payment Terms
Create payment term
POST
/
accounting
/
paymentTerms
cURL
curl --request POST \ --url https://api.maesn.dev/accounting/paymentTerms \ --header 'Content-Type: application/json' \ --header 'X-ACCOUNT-KEY: <x-account-key>' \ --header 'X-API-KEY: <x-api-key>' \ --data '{ "code": "1", "description": "31 dagen", "discountDays": 10, "discountDays2": 14, "discountPercentage": 5, "discountPercentage2": 3, "discountPeriods": [ { "invoiceRange": "Invoice issuance range up to day 5 of the month", "discountDeadline": "Day 15 of the current month", "discountDeadline2": "Day 25 of the current month", "paymentDeadline": "Day 30 of the current month" } ], "name": "31 DAYS", "paymentDays": 31, "paymentMethod": "BANK_TRANSFER"}'
import requests
url = "https://api.maesn.dev/accounting/paymentTerms"
payload = {
"code": "1",
"description": "31 dagen",
"discountDays": 10,
"discountDays2": 14,
"discountPercentage": 5,
"discountPercentage2": 3,
"discountPeriods": [
{
"invoiceRange": "Invoice issuance range up to day 5 of the month",
"discountDeadline": "Day 15 of the current month",
"discountDeadline2": "Day 25 of the current month",
"paymentDeadline": "Day 30 of the current month"
}
],
"name": "31 DAYS",
"paymentDays": 31,
"paymentMethod": "BANK_TRANSFER"
}
headers = {
"X-API-KEY": "<x-api-key>",
"X-ACCOUNT-KEY": "<x-account-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {
'X-API-KEY': '<x-api-key>',
'X-ACCOUNT-KEY': '<x-account-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: '1',
description: '31 dagen',
discountDays: 10,
discountDays2: 14,
discountPercentage: 5,
discountPercentage2: 3,
discountPeriods: [
{
invoiceRange: 'Invoice issuance range up to day 5 of the month',
discountDeadline: 'Day 15 of the current month',
discountDeadline2: 'Day 25 of the current month',
paymentDeadline: 'Day 30 of the current month'
}
],
name: '31 DAYS',
paymentDays: 31,
paymentMethod: 'BANK_TRANSFER'
})
};
fetch('https://api.maesn.dev/accounting/paymentTerms', 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.maesn.dev/accounting/paymentTerms",
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([
'code' => '1',
'description' => '31 dagen',
'discountDays' => 10,
'discountDays2' => 14,
'discountPercentage' => 5,
'discountPercentage2' => 3,
'discountPeriods' => [
[
'invoiceRange' => 'Invoice issuance range up to day 5 of the month',
'discountDeadline' => 'Day 15 of the current month',
'discountDeadline2' => 'Day 25 of the current month',
'paymentDeadline' => 'Day 30 of the current month'
]
],
'name' => '31 DAYS',
'paymentDays' => 31,
'paymentMethod' => 'BANK_TRANSFER'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-ACCOUNT-KEY: <x-account-key>",
"X-API-KEY: <x-api-key>"
],
]);
$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.maesn.dev/accounting/paymentTerms"
payload := strings.NewReader("{\n \"code\": \"1\",\n \"description\": \"31 dagen\",\n \"discountDays\": 10,\n \"discountDays2\": 14,\n \"discountPercentage\": 5,\n \"discountPercentage2\": 3,\n \"discountPeriods\": [\n {\n \"invoiceRange\": \"Invoice issuance range up to day 5 of the month\",\n \"discountDeadline\": \"Day 15 of the current month\",\n \"discountDeadline2\": \"Day 25 of the current month\",\n \"paymentDeadline\": \"Day 30 of the current month\"\n }\n ],\n \"name\": \"31 DAYS\",\n \"paymentDays\": 31,\n \"paymentMethod\": \"BANK_TRANSFER\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<x-api-key>")
req.Header.Add("X-ACCOUNT-KEY", "<x-account-key>")
req.Header.Add("Content-Type", "application/json")
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.maesn.dev/accounting/paymentTerms")
.header("X-API-KEY", "<x-api-key>")
.header("X-ACCOUNT-KEY", "<x-account-key>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"1\",\n \"description\": \"31 dagen\",\n \"discountDays\": 10,\n \"discountDays2\": 14,\n \"discountPercentage\": 5,\n \"discountPercentage2\": 3,\n \"discountPeriods\": [\n {\n \"invoiceRange\": \"Invoice issuance range up to day 5 of the month\",\n \"discountDeadline\": \"Day 15 of the current month\",\n \"discountDeadline2\": \"Day 25 of the current month\",\n \"paymentDeadline\": \"Day 30 of the current month\"\n }\n ],\n \"name\": \"31 DAYS\",\n \"paymentDays\": 31,\n \"paymentMethod\": \"BANK_TRANSFER\"\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.maesn.dev/accounting/paymentTerms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<x-api-key>'
request["X-ACCOUNT-KEY"] = '<x-account-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"1\",\n \"description\": \"31 dagen\",\n \"discountDays\": 10,\n \"discountDays2\": 14,\n \"discountPercentage\": 5,\n \"discountPercentage2\": 3,\n \"discountPeriods\": [\n {\n \"invoiceRange\": \"Invoice issuance range up to day 5 of the month\",\n \"discountDeadline\": \"Day 15 of the current month\",\n \"discountDeadline2\": \"Day 25 of the current month\",\n \"paymentDeadline\": \"Day 30 of the current month\"\n }\n ],\n \"name\": \"31 DAYS\",\n \"paymentDays\": 31,\n \"paymentMethod\": \"BANK_TRANSFER\"\n}"
response = http.request(request)
puts response.read_body
{ "meta": { "warnings": [ "Field not used by target system" ], "pagination": { "total": 125, "perPage": 50, "currentPage": 1, "totalPages": 3 } }, "data": { "id": "08d52c49-b90c-4328-b1ec-623df74f904a", "code": "1", "createdDate": "2021-01-01T00:00:00Z", "description": "31 dagen", "discountDays": 10, "discountDays2": 14, "discountDaysCalculation": "10D", "discountPercentage": 5, "discountPercentage2": 3, "discountPeriods": [ { "invoiceRange": "Invoice issuance range up to day 5 of the month", "discountDeadline": "Day 15 of the current month", "discountDeadline2": "Day 25 of the current month", "paymentDeadline": "Day 30 of the current month" } ], "dueType": "DUE_IN_DAYS", "name": "31 DAYS", "paymentDays": 31, "paymentDaysCalculation": "10D", "paymentMethod": "BANK_TRANSFER", "updatedDate": "2021-01-01T00:00:00Z" }}
If you’re not using the Interactive Authentication Flow, make sure the query parameter companyId is correctly populated.
You can obtain this value by using the GET Companies endpoint available under the Authentication section.