POST /v1/orders/{id}/invoice has always accepted a finished PDF. Nothing gave you
what goes in it — the order payload carries a delivery block because a courier needs a
city and a postcode, and an invoice needs a street, and for a business buyer a company
name and a VAT number. Sellers were reading those off the dashboard and retyping them.
curl https://api.biklo.com/v1/orders/711/customer -H "Authorization: Bearer $KEY"
{
"id": 9000001,
"name": "John Doe",
"email": "[email protected]",
"phone": "+40700000000",
"billing": {
"address_line": "Str. Exemplu 12",
"city": "Brasov",
"county": "Brasov",
"postal_code": "500002",
"country_code": "RO",
"country": "România",
"is_company": true,
"company": {
"name": "Example Bike Shop SRL",
"vat_code": "RO12345678",
"registration_no": "J16/123/2020"
},
"is_live": true,
"delivered_to_locker": false
}
}
Three endpoints:
GET /v1/orders/{id}/customer— the buyer as they were for that sale. This is the one to call when you are about to invoice: a customer who has moved has two orders at two addresses, and each invoice carries its own.GET /v1/customers— everyone who has bought from you, with their latest billing details. Paginated, filterable onupdated_sinceand searchable on name or email.GET /v1/customers/{id}— one buyer plus every order they placed with you, each flaggedhas_invoice.has_invoice: falseis your queue of orders still to bill.
is_company is the field to branch on#
A buyer who checked out with a company address must be invoiced as that company, with
its CUI — not as the person. Read the flag; do not infer it from whether company
came back populated.
A new scope, off by default#
These sit behind customers.read, which is not part of orders.read. An order
carries a delivery address because you cannot ship without one. A full postal address,
an email and a company's fiscal identity is a different thing to hand out, and a
stock-sync integration has no use for it. Sellers grant it under "Customers and
invoicing" in their dashboard.
One caveat worth reading#
is_live: true means address_line was read from an address the buyer still controls
and can edit. Only the city, county, postcode and country were frozen at checkout. If
your invoices have to be reproducible, store the billing block at the moment you issue
the invoice rather than re-fetching it later.
Where a buyer has since deleted that address, address_line is null and is_live is
false — the rest of the block still stands.
