Denne dokumentation beskriver, hvordan du indsætter komplette ordredata via vores API, samt hvordan du finder din API-nøgle i teamets settings.
For at indsende en ordre skal du sende en POST-request til /api/orders
med følgende JSON payload:
{
"order_id": "123456",
"date_created": "2023-01-01",
"integration": "api", /* Default 'api' */
"status": "processing",
"sub_total": 100.00,
"shipping_total": 10.00,
"discount": 0.00,
"total_tax": 15.00,
"total": 125.00,
"currency": "DKK",
"payment_method": "quickpay",
"accounting_id": null, /* Reference til bogføringssystemet */
"order_items": [
{
"product_id": 1,
"quantity": 2,
"unit_price": 30.00,
"total_price": 60.00,
"item_name": "Produkt 1",
"vat_rate": 25,
"line_type": "product"
},
{
"product_id": 2,
"quantity": 1,
"unit_price": 40.00,
"total_price": 40.00,
"item_name": "Produkt 2",
"vat_rate": 25,
"line_type": "product"
},
{
/* Forsendelse */
"product_id": null,
"quantity": 1,
"unit_price": 31.20,
"total_price": 31.20,
"item_name": "GLS Pakkeshop",
"vat_rate": 25,
"line_type": "shipping"
},
{
/* Pant og andre gebyrer/tillæg */
"product_id": null,
"quantity": 1,
"unit_price": 19.20,
"total_price": 19.20,
"item_name": "Pant A",
"vat_rate": 25,
"line_type": "fee"
}
],
"billing_info": {
"first_name": "John",
"last_name": "Doe",
"company": "Invomate",
"address": "Rådhuspladsen 37",
"city": "Aalborg",
"postal_code": "9000",
"country": "DK",
"email": "john.doe@example.com",
"phone": "+1234567890",
"cvr": "12345678",
"ean": "9876543210123"
}
}
order_id
: Unik reference for ordren (bruges evt. som reference til WooCommerce-ordren).date
: Ordredato (mapper til date_created
i databasen).integration
: Navn på integrationen, f.eks. erp-api
.status
: Ordrestatus (f.eks. processing, pending, completed).sub_total
: Ordre subtotal før forsendelse og afgifter.shipping_total
: Forsendelsesomkostninger.discount
: Eventuel rabat på ordren.total_tax
: Samlet skat på ordren.total
: Det samlede beløb for ordren.currency
: Valuta for ordren (f.eks. DKK, USD).payment_method
: Betalingsmetode (f.eks. credit_card, paypal).accounting_id
: Referencenummer til bogføringssystemet.product_id
: ID for produktet.quantity
: Antal bestilte enheder.unit_price
: Pris pr. enhed.total_price
: Total pris for denne linje (unit_price * quantity).item_name
: Navn på produktet.vat_rate
: Momsprocent for produktet.discount
: Rabat på produktet, hvis relevant.line_type
: Type af ordrelinje (f.eks. normal, gave, osv.).first_name
: Kundens fornavn.last_name
: Kundens efternavn.company
: Firma (hvis relevant).address
: Faktureringsadresse.city
: By.postal_code
: Postnummer.country
: Land.email
: Kundens e-mail adresse.phone
: Telefonnummer.cvr
: CVR-nummer, hvis relevant.ean
: EAN-nummer, hvis relevant.Din unikke API-nøgle kan findes under kontoens indstillinger. Følg disse trin:
curl --request POST \
--url https://facturaflow.dk/api/orders \
--header 'Authorization: Bearer {din_api_token}' \
--header 'Content-Type: application/json' \
--data '{
"order_id": "123456",
"date": "2023-01-01",
"integration": "teams-api",
"status": "shipped",
"sub_total": 100.00,
"shipping_total": 10.00,
"discount": 5.00,
"total_tax": 15.00,
"total": 120.00,
"currency": "DKK",
"payment_method": "credit_card",
"accounting_id": "acc-98765",
"order_items": [
{
"product_id": 1,
"quantity": 2,
"unit_price": 30.00,
"total_price": 60.00,
"item_name": "Produkt 1",
"vat_rate": 25,
"discount": 0,
"line_type": "normal"
},
{
"product_id": 2,
"quantity": 1,
"unit_price": 40.00,
"total_price": 40.00,
"item_name": "Produkt 2",
"vat_rate": 25,
"discount": 5,
"line_type": "normal"
}
],
"billing_info": {
"first_name": "John",
"last_name": "Doe",
"company": "Acme Inc.",
"address": "123 Elm St",
"city": "Springfield",
"postal_code": "62701",
"country": "USA",
"email": "john.doe@example.com",
"phone": "+1234567890",
"cvr": "12345678",
"ean": "9876543210123"
}
}'
Med denne dokumentation burde du være klar til at integrere med vores API og indsende komplette ordrer med alle tilhørende detaljer.