-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_credit_note.py
More file actions
47 lines (42 loc) · 1.25 KB
/
Copy pathsend_credit_note.py
File metadata and controls
47 lines (42 loc) · 1.25 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
"""Send a credit note via the getpeppr API.
A credit note corrects or cancels a previous invoice.
It MUST reference the original invoice number.
Uses POST /v1/invoices/send with isCreditNote: true.
"""
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={
"isCreditNote": True,
"number": "CN-2026-001",
"invoiceReference": "INV-2026-042",
"to": {
"name": "Wayne Enterprises NV",
"peppolId": "0208:BE0123456789",
"street": "Avenue Louise 54",
"city": "Brussels",
"postalCode": "1050",
"country": "BE",
},
"lines": [
{
"description": "Arc Reactor Maintenance Q1 — cancelled",
"quantity": 1,
"unitPrice": 50000,
"vatRate": 21,
},
],
"paymentTerms": "Refund within 14 days",
"paymentIban": "BE68539007547034",
},
timeout=30,
)
response.raise_for_status()
result = response.json()
print(f"Credit note sent: {result['id']}")