Anwendungsfälle
Hier siehst du, wie die Methoden zusammenspielen: komplette Abläufe aus der Praxis, jeder Aufruf in der Reihenfolge, in der du ihn brauchst, mit den Werten, die du dir aus der Antwort merken musst. Die Beispiele sind dieselben wie bei den Methoden, du kannst sie direkt in Postman nachspielen.
Jede Antwort hat response, data und message. Prüfe immer response: Ein abgelehnter Aufruf kommt mit HTTP 200 und response: false, die Meldung sagt, warum. Die Kennungen (*_ident) aus data sind das, was dein System speichert.
Shop-Bestellung: vom Kunden bis zur versendeten Rechnung
Der häufigste Ablauf: Ein Shop oder eine Warenwirtschaft legt für jede Bestellung den Kunden und den Auftrag an und lässt billware die Rechnung erzeugen und verschicken, sobald die Ware raus ist. Drei Aufrufe.
Schritt 1: customer.create
Lege den Kunden an und merke dir customer_ident aus der Antwort. Hast du den Kunden schon einmal angelegt, nimm die gespeicherte Kennung; customer.exists sagt dir, ob sie noch gültig ist. Ländercodes klein schreiben, z. B. de.
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"customer_type":"billware","is_business_client":0,"bill_title":"Mister","bill_firstname":"Max","bill_lastname":"Mustermann","bill_street":"Musterstraße 12","bill_zipcode":"12345","bill_city":"Musterstadt","bill_country":"de","bill_phone":"+49 123 4567890","bill_email":"max.mustermann@example.com","divergent_delivery_address":1,"delivery_title":"Mister","delivery_firstname":"Max","delivery_lastname":"Mustermann","delivery_street":"Lieferweg 5","delivery_zipcode":"54321","delivery_city":"Lieferstadt","delivery_country":"de","delivery_phone":"+49 987 6543210","account_iban":"DE89370400440532013000","account_bic":"COBADEFFXXX","account_bank":"Commerzbank","account_paypal":"max.paypal@example.com","user_note":"Kunde möchte Rechnung nur per E-Mail erhalten","public_authority_id":""}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: customer.create" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'customer_type' => 'billware',
'is_business_client' => 0,
'bill_title' => 'Mister',
'bill_firstname' => 'Max',
'bill_lastname' => 'Mustermann',
'bill_street' => 'Musterstraße 12',
'bill_zipcode' => '12345',
'bill_city' => 'Musterstadt',
'bill_country' => 'de',
'bill_phone' => '+49 123 4567890',
'bill_email' => 'max.mustermann@example.com',
'divergent_delivery_address' => 1,
'delivery_title' => 'Mister',
'delivery_firstname' => 'Max',
'delivery_lastname' => 'Mustermann',
'delivery_street' => 'Lieferweg 5',
'delivery_zipcode' => '54321',
'delivery_city' => 'Lieferstadt',
'delivery_country' => 'de',
'delivery_phone' => '+49 987 6543210',
'account_iban' => 'DE89370400440532013000',
'account_bic' => 'COBADEFFXXX',
'account_bank' => 'Commerzbank',
'account_paypal' => 'max.paypal@example.com',
'user_note' => 'Kunde möchte Rechnung nur per E-Mail erhalten',
'public_authority_id' => '',
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: customer.create',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"customer_type": "billware",
"is_business_client": 0,
"bill_title": "Mister",
"bill_firstname": "Max",
"bill_lastname": "Mustermann",
"bill_street": "Musterstraße 12",
"bill_zipcode": "12345",
"bill_city": "Musterstadt",
"bill_country": "de",
"bill_phone": "+49 123 4567890",
"bill_email": "max.mustermann@example.com",
"divergent_delivery_address": 1,
"delivery_title": "Mister",
"delivery_firstname": "Max",
"delivery_lastname": "Mustermann",
"delivery_street": "Lieferweg 5",
"delivery_zipcode": "54321",
"delivery_city": "Lieferstadt",
"delivery_country": "de",
"delivery_phone": "+49 987 6543210",
"account_iban": "DE89370400440532013000",
"account_bic": "COBADEFFXXX",
"account_bank": "Commerzbank",
"account_paypal": "max.paypal@example.com",
"user_note": "Kunde möchte Rechnung nur per E-Mail erhalten",
"public_authority_id": ""
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'customer.create',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"customer_type": "billware",
"is_business_client": 0,
"bill_title": "Mister",
"bill_firstname": "Max",
"bill_lastname": "Mustermann",
"bill_street": "Musterstraße 12",
"bill_zipcode": "12345",
"bill_city": "Musterstadt",
"bill_country": "de",
"bill_phone": "+49 123 4567890",
"bill_email": "max.mustermann@example.com",
"divergent_delivery_address": 1,
"delivery_title": "Mister",
"delivery_firstname": "Max",
"delivery_lastname": "Mustermann",
"delivery_street": "Lieferweg 5",
"delivery_zipcode": "54321",
"delivery_city": "Lieferstadt",
"delivery_country": "de",
"delivery_phone": "+49 987 6543210",
"account_iban": "DE89370400440532013000",
"account_bic": "COBADEFFXXX",
"account_bank": "Commerzbank",
"account_paypal": "max.paypal@example.com",
"user_note": "Kunde möchte Rechnung nur per E-Mail erhalten",
"public_authority_id": "",
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "customer.create",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
customer_type = "billware",
is_business_client = 0,
bill_title = "Mister",
bill_firstname = "Max",
bill_lastname = "Mustermann",
bill_street = "Musterstraße 12",
bill_zipcode = "12345",
bill_city = "Musterstadt",
bill_country = "de",
bill_phone = "+49 123 4567890",
bill_email = "max.mustermann@example.com",
divergent_delivery_address = 1,
delivery_title = "Mister",
delivery_firstname = "Max",
delivery_lastname = "Mustermann",
delivery_street = "Lieferweg 5",
delivery_zipcode = "54321",
delivery_city = "Lieferstadt",
delivery_country = "de",
delivery_phone = "+49 987 6543210",
account_iban = "DE89370400440532013000",
account_bic = "COBADEFFXXX",
account_bank = "Commerzbank",
account_paypal = "max.paypal@example.com",
user_note = "Kunde möchte Rechnung nur per E-Mail erhalten",
public_authority_id = ""
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "customer.create");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Schritt 2: order.create
Lege den Auftrag mit der Kundenkennung und den Positionen an. Preise sind Nettopreise je Einheit, Mengen sind Zahlen. Merke dir order_ident. Mit customer_reference steht die Bestellnummer deines Shops auf der Rechnung.
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"customer_ident":"46yq1898qmohrz57","order_date":"2025-07-16 10:00:00","due_date":"2025-07-30 00:00:00","is_paid":0,"invoice_number":null,"is_quotation":0,"small_entrepreneur":0,"reverse_charge":0,"intra_community":0,"term_of_credit":14,"user_note":"Bitte schnell liefern – Kaninchenstall wird dringend benötigt!","customer_reference":"PO-2025-4711","discount":{"title":"Sonderrabatt","calculation_type":0,"price_type":1,"value":10},"payment":{"name":"Vorkasse","calculation_type":1,"price_type":1,"value":0,"cashback_active":0,"cashback":0,"cashback_days":0},"shipping":{"name":"DHL Paket","tracking":"1234567890","calculation_type":1,"price_type":1,"value":5.99},"articles":[{"article_title":"Kaninchenstall XL","article_purchase_price":75,"article_price":129.99,"article_quantity":1,"article_country":"de","article_tax_rate":19,"article_subtitle":"Wetterfest mit Auslauf","article_position":1,"article_unit":"unit_ppu","article_ean":"4012345678901","article_nr":"KAN-XL-2025"}]}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.create" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'customer_ident' => '46yq1898qmohrz57',
'order_date' => '2025-07-16 10:00:00',
'due_date' => '2025-07-30 00:00:00',
'is_paid' => 0,
'invoice_number' => null,
'is_quotation' => 0,
'small_entrepreneur' => 0,
'reverse_charge' => 0,
'intra_community' => 0,
'term_of_credit' => 14,
'user_note' => 'Bitte schnell liefern – Kaninchenstall wird dringend benötigt!',
'customer_reference' => 'PO-2025-4711',
'discount' => [
'title' => 'Sonderrabatt',
'calculation_type' => 0,
'price_type' => 1,
'value' => 10,
],
'payment' => [
'name' => 'Vorkasse',
'calculation_type' => 1,
'price_type' => 1,
'value' => 0,
'cashback_active' => 0,
'cashback' => 0,
'cashback_days' => 0,
],
'shipping' => [
'name' => 'DHL Paket',
'tracking' => '1234567890',
'calculation_type' => 1,
'price_type' => 1,
'value' => 5.99,
],
'articles' => [
[
'article_title' => 'Kaninchenstall XL',
'article_purchase_price' => 75,
'article_price' => 129.99,
'article_quantity' => 1,
'article_country' => 'de',
'article_tax_rate' => 19,
'article_subtitle' => 'Wetterfest mit Auslauf',
'article_position' => 1,
'article_unit' => 'unit_ppu',
'article_ean' => '4012345678901',
'article_nr' => 'KAN-XL-2025',
],
],
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.create',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"customer_ident": "46yq1898qmohrz57",
"order_date": "2025-07-16 10:00:00",
"due_date": "2025-07-30 00:00:00",
"is_paid": 0,
"invoice_number": null,
"is_quotation": 0,
"small_entrepreneur": 0,
"reverse_charge": 0,
"intra_community": 0,
"term_of_credit": 14,
"user_note": "Bitte schnell liefern – Kaninchenstall wird dringend benötigt!",
"customer_reference": "PO-2025-4711",
"discount": {
"title": "Sonderrabatt",
"calculation_type": 0,
"price_type": 1,
"value": 10
},
"payment": {
"name": "Vorkasse",
"calculation_type": 1,
"price_type": 1,
"value": 0,
"cashback_active": 0,
"cashback": 0,
"cashback_days": 0
},
"shipping": {
"name": "DHL Paket",
"tracking": "1234567890",
"calculation_type": 1,
"price_type": 1,
"value": 5.99
},
"articles": [
{
"article_title": "Kaninchenstall XL",
"article_purchase_price": 75,
"article_price": 129.99,
"article_quantity": 1,
"article_country": "de",
"article_tax_rate": 19,
"article_subtitle": "Wetterfest mit Auslauf",
"article_position": 1,
"article_unit": "unit_ppu",
"article_ean": "4012345678901",
"article_nr": "KAN-XL-2025"
}
]
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.create',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"customer_ident": "46yq1898qmohrz57",
"order_date": "2025-07-16 10:00:00",
"due_date": "2025-07-30 00:00:00",
"is_paid": 0,
"invoice_number": None,
"is_quotation": 0,
"small_entrepreneur": 0,
"reverse_charge": 0,
"intra_community": 0,
"term_of_credit": 14,
"user_note": "Bitte schnell liefern – Kaninchenstall wird dringend benötigt!",
"customer_reference": "PO-2025-4711",
"discount": {
"title": "Sonderrabatt",
"calculation_type": 0,
"price_type": 1,
"value": 10,
},
"payment": {
"name": "Vorkasse",
"calculation_type": 1,
"price_type": 1,
"value": 0,
"cashback_active": 0,
"cashback": 0,
"cashback_days": 0,
},
"shipping": {
"name": "DHL Paket",
"tracking": "1234567890",
"calculation_type": 1,
"price_type": 1,
"value": 5.99,
},
"articles": [
{
"article_title": "Kaninchenstall XL",
"article_purchase_price": 75,
"article_price": 129.99,
"article_quantity": 1,
"article_country": "de",
"article_tax_rate": 19,
"article_subtitle": "Wetterfest mit Auslauf",
"article_position": 1,
"article_unit": "unit_ppu",
"article_ean": "4012345678901",
"article_nr": "KAN-XL-2025",
},
],
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.create",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
customer_ident = "46yq1898qmohrz57",
order_date = "2025-07-16 10:00:00",
due_date = "2025-07-30 00:00:00",
is_paid = 0,
invoice_number = (string)null,
is_quotation = 0,
small_entrepreneur = 0,
reverse_charge = 0,
intra_community = 0,
term_of_credit = 14,
user_note = "Bitte schnell liefern – Kaninchenstall wird dringend benötigt!",
customer_reference = "PO-2025-4711",
discount = new
{
title = "Sonderrabatt",
calculation_type = 0,
price_type = 1,
value = 10
},
payment = new
{
name = "Vorkasse",
calculation_type = 1,
price_type = 1,
value = 0,
cashback_active = 0,
cashback = 0,
cashback_days = 0
},
shipping = new
{
name = "DHL Paket",
tracking = "1234567890",
calculation_type = 1,
price_type = 1,
value = 5.99
},
articles = new[]
{
new
{
article_title = "Kaninchenstall XL",
article_purchase_price = 75,
article_price = 129.99,
article_quantity = 1,
article_country = "de",
article_tax_rate = 19,
article_subtitle = "Wetterfest mit Auslauf",
article_position = 1,
article_unit = "unit_ppu",
article_ean = "4012345678901",
article_nr = "KAN-XL-2025"
}
}
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.create");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Schritt 3: order.sendDocument
Sobald die Ware verschickt ist, lässt du billware die Rechnung erzeugen und an die Rechnungs-Mailadresse des Auftrags senden. Ein Aufruf: Die Rechnungsnummer wird dabei gezogen, das PDF mit deinem Layout gebaut und mit deiner Mailvorlage verschickt.
order.sendDocument (invoice)
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"order_ident":"aswm5o5i2v5hwlbp","type":"invoice"}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.sendDocument" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'order_ident' => 'aswm5o5i2v5hwlbp',
'type' => 'invoice',
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.sendDocument',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "invoice"
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.sendDocument',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "invoice",
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.sendDocument",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
order_ident = "aswm5o5i2v5hwlbp",
type = "invoice"
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.sendDocument");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());In der Antwort steht document_nr, die Rechnungsnummer, und unter file der Link zum PDF, falls dein Shop die Rechnung selbst ablegen will. Ein zweiter Aufruf schickt nichts doppelt, er wird mit dem Versandzeitpunkt abgelehnt. Soll die Rechnung nur erzeugt, aber von dir selbst verschickt werden, nimm order.createDocument statt order.sendDocument.
Erst die Zahlung, dann die Rechnung
Bei Vorkasse oder Abholung soll die Rechnung erst entstehen, wenn das Geld da ist. Buche die Zahlung mit order.createPayment und set_paid auf 1; der Auftrag gilt dann als bezahlt und die Rechnung weist die Zahlung aus. Danach wie oben order.sendDocument.
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"order_ident":"aswm5o5i2v5hwlbp","amount":144.61,"fee":0,"payment_name":"payment_paypal","date_paid":"2025-07-16 12:30:00","external_ident":"TRANS123456","set_paid":1}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.createPayment" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'order_ident' => 'aswm5o5i2v5hwlbp',
'amount' => 144.61,
'fee' => 0,
'payment_name' => 'payment_paypal',
'date_paid' => '2025-07-16 12:30:00',
'external_ident' => 'TRANS123456',
'set_paid' => 1,
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.createPayment',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"order_ident": "aswm5o5i2v5hwlbp",
"amount": 144.61,
"fee": 0,
"payment_name": "payment_paypal",
"date_paid": "2025-07-16 12:30:00",
"external_ident": "TRANS123456",
"set_paid": 1
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.createPayment',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"order_ident": "aswm5o5i2v5hwlbp",
"amount": 144.61,
"fee": 0,
"payment_name": "payment_paypal",
"date_paid": "2025-07-16 12:30:00",
"external_ident": "TRANS123456",
"set_paid": 1,
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.createPayment",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
order_ident = "aswm5o5i2v5hwlbp",
amount = 144.61,
fee = 0,
payment_name = "payment_paypal",
date_paid = "2025-07-16 12:30:00",
external_ident = "TRANS123456",
set_paid = 1
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.createPayment");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Kommt eine Zahlung erst nach der Rechnung, buchst du sie genauso nach. Der offene Betrag steht in order.read unter booked_payments.open_amount.
Lieferschein und Teillieferung
Ein Lieferschein über den ganzen Auftrag entsteht mit type delivery_note, einmal je Auftrag. Geht die Ware in mehreren Paketen raus, erzeugst du je Sendung einen anteiligen Lieferschein mit partial_delivery_note und den Positionen dieser Sendung; jeder Aufruf ist ein neues Dokument mit laufender Nummer. Beide lassen sich mit order.sendDocument auch per Mail schicken.
order.createDocument (partial delivery note)
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"order_ident":"aswm5o5i2v5hwlbp","type":"partial_delivery_note","date_delivery_note":"2025-07-18 09:00:00","articles":[{"article_title":"Kaninchenstall XL","article_quantity":1}]}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.createDocument" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'order_ident' => 'aswm5o5i2v5hwlbp',
'type' => 'partial_delivery_note',
'date_delivery_note' => '2025-07-18 09:00:00',
'articles' => [
[
'article_title' => 'Kaninchenstall XL',
'article_quantity' => 1,
],
],
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.createDocument',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "partial_delivery_note",
"date_delivery_note": "2025-07-18 09:00:00",
"articles": [
{
"article_title": "Kaninchenstall XL",
"article_quantity": 1
}
]
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.createDocument',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "partial_delivery_note",
"date_delivery_note": "2025-07-18 09:00:00",
"articles": [
{
"article_title": "Kaninchenstall XL",
"article_quantity": 1,
},
],
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.createDocument",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
order_ident = "aswm5o5i2v5hwlbp",
type = "partial_delivery_note",
date_delivery_note = "2025-07-18 09:00:00",
articles = new[]
{
new
{
article_title = "Kaninchenstall XL",
article_quantity = 1
}
}
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.createDocument");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Storno: Stornorechnung erzeugen und versenden
Wird eine Bestellung nach der Rechnung storniert, erzeugt reversal_invoice die Stornorechnung mit der Rechnungsnummer und dem Zusatz -S und setzt den Auftrag auf storniert. Voraussetzung ist eine vorhandene Rechnung. Mit order.sendDocument geht sie direkt an den Kunden.
order.sendDocument (reversal invoice)
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"order_ident":"aswm5o5i2v5hwlbp","type":"reversal_invoice"}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.sendDocument" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'order_ident' => 'aswm5o5i2v5hwlbp',
'type' => 'reversal_invoice',
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.sendDocument',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "reversal_invoice"
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.sendDocument',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "reversal_invoice",
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.sendDocument",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
order_ident = "aswm5o5i2v5hwlbp",
type = "reversal_invoice"
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.sendDocument");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Ein stornierter Auftrag bekommt keine neue Rechnung mehr. Bestellt derselbe Kunde erneut, legst du einen neuen Auftrag an.
Teilrückgabe: Korrekturrechnung mit Positionen
Kommt ein Teil der Ware zurück, erzeugt credit_note die Korrekturrechnung. Ohne articles wird der ganze Auftrag gutgeschrieben; für eine Teilrückgabe gibst du die zurückgenommenen Positionen an, die Menge negativ, Preis und Steuersatz wie auf der Rechnung. Die Nummer ist die Rechnungsnummer mit dem Zusatz -K, ein Auftrag hat eine Korrekturrechnung.
order.createDocument (credit note for one position)
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"order_ident":"aswm5o5i2v5hwlbp","type":"credit_note","date_credit_note":"2025-07-20 10:00:00","articles":[{"article_title":"Kaninchenstall XL","article_quantity":-1,"article_price":129.99,"article_tax_rate":19,"article_unit":"unit_ppu","article_nr":"KAN-XL-2025"}]}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.createDocument" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'order_ident' => 'aswm5o5i2v5hwlbp',
'type' => 'credit_note',
'date_credit_note' => '2025-07-20 10:00:00',
'articles' => [
[
'article_title' => 'Kaninchenstall XL',
'article_quantity' => -1,
'article_price' => 129.99,
'article_tax_rate' => 19,
'article_unit' => 'unit_ppu',
'article_nr' => 'KAN-XL-2025',
],
],
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.createDocument',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "credit_note",
"date_credit_note": "2025-07-20 10:00:00",
"articles": [
{
"article_title": "Kaninchenstall XL",
"article_quantity": -1,
"article_price": 129.99,
"article_tax_rate": 19,
"article_unit": "unit_ppu",
"article_nr": "KAN-XL-2025"
}
]
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.createDocument',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "credit_note",
"date_credit_note": "2025-07-20 10:00:00",
"articles": [
{
"article_title": "Kaninchenstall XL",
"article_quantity": -1,
"article_price": 129.99,
"article_tax_rate": 19,
"article_unit": "unit_ppu",
"article_nr": "KAN-XL-2025",
},
],
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.createDocument",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
order_ident = "aswm5o5i2v5hwlbp",
type = "credit_note",
date_credit_note = "2025-07-20 10:00:00",
articles = new[]
{
new
{
article_title = "Kaninchenstall XL",
article_quantity = -1,
article_price = 129.99,
article_tax_rate = 19,
article_unit = "unit_ppu",
article_nr = "KAN-XL-2025"
}
}
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.createDocument");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Die Erstattung an den Kunden buchst du mit order.createPayment und negativem Betrag.
Mahnlauf in drei Stufen
Bleibt eine Rechnung offen, erzeugt und verschickt order.sendDocument mit reminder_1 die erste Mahnung, später reminder_2 und reminder_3. Die Mahngebühren kommen aus deinen Einstellungen. Die Stufen halten ihre Reihenfolge ein, und ein bezahlter Auftrag wird nicht gemahnt: Buche Zahlungen also immer mit order.createPayment, dann lehnt billware die Mahnung von selbst ab.
order.sendDocument (first reminder)
# Get your API credentials from your billware customer area
API_APPID="your-app-id"
API_SECRET="your-api-secret"
PAYLOAD='{"order_ident":"aswm5o5i2v5hwlbp","type":"reminder_1"}'
# The HMAC is calculated over the exact request body that is sent
HMAC=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)
curl -X POST "https://www.billware.de/api/v1" \
-H "X-Bw-Hmac: $API_APPID:$HMAC" \
-H "X-Bw-Method: order.sendDocument" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"<?php
// Get your API credentials from your billware customer area
$apiAppId = 'your-app-id';
$apiSecret = 'your-api-secret';
$payload = json_encode([
'order_ident' => 'aswm5o5i2v5hwlbp',
'type' => 'reminder_1',
]);
// The HMAC is calculated over the exact request body that is sent
$hmac = base64_encode(hash_hmac('sha256', $payload, $apiSecret, true));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://www.billware.de/api/v1',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Bw-Hmac: '.$apiAppId.':'.$hmac,
'X-Bw-Method: order.sendDocument',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));import crypto from 'node:crypto';
// Get your API credentials from your billware customer area
const apiAppId = 'your-app-id';
const apiSecret = 'your-api-secret';
const payload = JSON.stringify({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "reminder_1"
});
// The HMAC is calculated over the exact request body that is sent
const hmac = crypto.createHmac('sha256', apiSecret).update(payload).digest('base64');
const response = await fetch('https://www.billware.de/api/v1', {
method: 'POST',
headers: {
'X-Bw-Hmac': `${apiAppId}:${hmac}`,
'X-Bw-Method': 'order.sendDocument',
'Content-Type': 'application/json'
},
body: payload
});
console.log(await response.json());import base64
import hashlib
import hmac
import json
import requests
# Get your API credentials from your billware customer area
api_appid = "your-app-id"
api_secret = "your-api-secret"
payload = json.dumps({
"order_ident": "aswm5o5i2v5hwlbp",
"type": "reminder_1",
})
# The HMAC is calculated over the exact request body that is sent
signature = base64.b64encode(
hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
response = requests.post(
"https://www.billware.de/api/v1",
data=payload,
headers={
"X-Bw-Hmac": f"{api_appid}:{signature}",
"X-Bw-Method": "order.sendDocument",
"Content-Type": "application/json",
},
)
print(response.json())using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
// Get your API credentials from your billware customer area
const string apiAppId = "your-app-id";
const string apiSecret = "your-api-secret";
var payload = JsonSerializer.Serialize(new
{
order_ident = "aswm5o5i2v5hwlbp",
type = "reminder_1"
});
// The HMAC is calculated over the exact request body that is sent
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload)));
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.billware.de/api/v1")
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("X-Bw-Hmac", $"{apiAppId}:{signature}");
request.Headers.Add("X-Bw-Method", "order.sendDocument");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());Welche Aufträge offen sind, liefert order.list mit date_type date_invoice; bei offenen Aufträgen ist date_paid leer.
Stolpersteine
- Ländercodes klein (
de,at). Großschreibung wird zwar klein gespeichert, aber deine Daten bleiben sauber, wenn du sie gleich richtig schickst. - Wiederholungen sind ungefährlich:
order.createDocumentliefert das bestehende Dokument,order.sendDocumentlehnt den zweiten Versand ab. Nurorder.createlegt bei jedem Aufruf einen neuen Auftrag an, merke dir also die Kennung, bevor du es erneut versuchst. order.createInvoiceNrbrauchst du nicht mehr: Die Rechnungsnummer wird beim Erzeugen der Rechnung gezogen. Nutze es nur, wenn du eine eigene Nummer vergeben willst.- Die Mail geht an
bill_emaildes Auftrags. Fehlt die Adresse, wird das Dokument erzeugt, aber nicht gesendet; die Meldung sagt das. - Das Kontingent zählt jeden Aufruf, auch abgelehnte. Für viele Aufträge ist
order.listgünstiger als viele einzelneorder.read. - Datum und Uhrzeit sendest du als
JJJJ-MM-TT HH:MM:SSin der Zeitzone deines Kontos.