-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallowances_charges.py
More file actions
67 lines (63 loc) · 1.93 KB
/
Copy pathallowances_charges.py
File metadata and controls
67 lines (63 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""Send an invoice with document-level and line-level allowances/charges."""
import requests
BASE_URL = "https://api.getpeppr.dev"
API_KEY = "sk_sandbox_abc123..."
response = requests.post(
f"{BASE_URL}/v1/invoices/send",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"number": "INV-2026-099",
"to": {
"name": "Wayne Enterprises NV",
"peppolId": "0208:BE0123456789",
"street": "Avenue Louise 54",
"city": "Brussels",
"postalCode": "1050",
"country": "BE",
},
"buyerReference": "PO-2026-099",
"lines": [
{
"description": "Arc Reactor Maintenance Q1",
"quantity": 1,
"unitPrice": 50000,
"vatRate": 21,
# Line-level discount
"allowances": [{"reason": "Loyalty discount", "amount": 5000}],
},
{
"description": "Vibranium Shield Polish",
"quantity": 10,
"unitPrice": 250,
"vatRate": 21,
# Line-level surcharge
"charges": [{"reason": "Rush delivery fee", "amount": 100}],
},
],
# Document-level discount
"allowances": [
{
"reason": "Volume discount (annual contract)",
"amount": 1000,
"vatRate": 21,
}
],
# Document-level surcharge
"charges": [
{
"reason": "Hazardous materials handling",
"amount": 500,
"vatRate": 21,
}
],
"paymentTerms": "Net 30 days",
"paymentIban": "BE68539007547034",
},
timeout=30,
)
response.raise_for_status()
result = response.json()
print(f"Sent! ID: {result['id']}, Status: {result['status']}")