API Documentation

Getting Started

This tutorial will guide you through handling a new order using the Abillify API. This involves creating/updating a customer, creating a voucher for the order and issuing related invoice and credit notes.

Introduction

The Abillify API allows you to manage customers, orders, payments, and vouchers efficiently. This tutorial will help you implement the workflow for handling a new order.

Authentication

Abillify API uses Basic Authentication. To authenticate your requests, include the Authorization header with your base64-encoded username:password string as the value.

See Authentication documentation for more details on how to obtain your API credentials.

Example:

Authorization: Basic ZGVtbzpwQDU1dzByZA==

Identity Management

Before you can use the Invoice or Order Flow, you need to create a identity (customer). This identity contains the customer's information, such as name, address, email, and phone number.

Create Identity

To create a identity, use the /identities/{identityReference} endpoint. You can create a new customer an existing one based on the provided identityReference.

Tip

Prefer to use the upsert method to avoid unnecessary complexity in your implementation.

  • Endpoint: /identities/{identityReference}
  • Method: PUT

Request

curl -X PUT "https://staging1.abillify.dev/api/identities/string" \
  -H "Content-Type: application/json" \
  -d '{
    "detail": {
      "vatId": "DE123456789"
    },
    "kind": "incorporate",
    "name": {
      "company": "ACME Inc."
    }
  }'
const body = JSON.stringify({
  "detail": {
    "vatId": "DE123456789"
  },
  "kind": "incorporate",
  "name": {
    "company": "ACME Inc."
  }
})

fetch("https://staging1.abillify.dev/api/identities/string", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/identities/string"
  body := strings.NewReader(`{
    "detail": {
      "vatId": "DE123456789"
    },
    "kind": "incorporate",
    "name": {
      "company": "ACME Inc."
    }
  }`)
  req, _ := http.NewRequest("PUT", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/identities/string"
body = {
  "detail": {
    "vatId": "DE123456789"
  },
  "kind": "incorporate",
  "name": {
    "company": "ACME Inc."
  }
}
response = requests.request("PUT", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Update Identity

To update a customer's information, use the same endpoint as creating a customer. The request body should contain the updated information.

Fields not defined in the upsert will not be nullified, if you want to unset a field set it to null in the request.

  • Endpoint: /identities/{identityReference}
  • Method: PUT

Request

curl -X PUT "https://staging1.abillify.dev/api/identities/string" \
  -H "Content-Type: application/json" \
  -d '{
    "detail": {
      "vatId": "DE123456789"
    },
    "kind": "incorporate",
    "name": {
      "company": "ACME Inc."
    }
  }'
const body = JSON.stringify({
  "detail": {
    "vatId": "DE123456789"
  },
  "kind": "incorporate",
  "name": {
    "company": "ACME Inc."
  }
})

fetch("https://staging1.abillify.dev/api/identities/string", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/identities/string"
  body := strings.NewReader(`{
    "detail": {
      "vatId": "DE123456789"
    },
    "kind": "incorporate",
    "name": {
      "company": "ACME Inc."
    }
  }`)
  req, _ := http.NewRequest("PUT", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/identities/string"
body = {
  "detail": {
    "vatId": "DE123456789"
  },
  "kind": "incorporate",
  "name": {
    "company": "ACME Inc."
  }
}
response = requests.request("PUT", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Voucher Management - Invoice Flow

This flow is a common way if you issue invoices that are not based on a previous order.

Create Invoice

To create an invoice for a customer, use the /identities/{identityReference}/invoices endpoint.

  • Endpoint: /identities/{identityReference}/invoices
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/identities/string/invoices" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "addresses": [
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "billing",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      },
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "shipping",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      }
    ],
    "currency": "EUR",
    "items": [
      {
        "constcenter": "1234",
        "detail": {
          "taxprofile": "default"
        },
        "label": "Product 1",
        "quantity": 1,
        "unit": "pcs",
        "unitprice": "100.00"
      }
    ],
    "netbased": true,
    "orderdate": "2020-01-01T00:00:00.000Z",
    "ordernumber": "xyz-1234",
    "paymentkind": "CT",
    "reference": "1234567890"
  }'
const body = JSON.stringify({
  "addresses": [
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "billing",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    },
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "shipping",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    }
  ],
  "currency": "EUR",
  "items": [
    {
      "constcenter": "1234",
      "detail": {
        "taxprofile": "default"
      },
      "label": "Product 1",
      "quantity": 1,
      "unit": "pcs",
      "unitprice": "100.00"
    }
  ],
  "netbased": true,
  "orderdate": "2020-01-01T00:00:00.000Z",
  "ordernumber": "xyz-1234",
  "paymentkind": "CT",
  "reference": "1234567890"
})

fetch("https://staging1.abillify.dev/api/identities/string/invoices", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/identities/string/invoices"
  body := strings.NewReader(`{
    "addresses": [
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "billing",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      },
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "shipping",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      }
    ],
    "currency": "EUR",
    "items": [
      {
        "constcenter": "1234",
        "detail": {
          "taxprofile": "default"
        },
        "label": "Product 1",
        "quantity": 1,
        "unit": "pcs",
        "unitprice": "100.00"
      }
    ],
    "netbased": true,
    "orderdate": "2020-01-01T00:00:00.000Z",
    "ordernumber": "xyz-1234",
    "paymentkind": "CT",
    "reference": "1234567890"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/identities/string/invoices"
body = {
  "addresses": [
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "billing",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    },
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "shipping",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    }
  ],
  "currency": "EUR",
  "items": [
    {
      "constcenter": "1234",
      "detail": {
        "taxprofile": "default"
      },
      "label": "Product 1",
      "quantity": 1,
      "unit": "pcs",
      "unitprice": "100.00"
    }
  ],
  "netbased": true,
  "orderdate": "2020-01-01T00:00:00.000Z",
  "ordernumber": "xyz-1234",
  "paymentkind": "CT",
  "reference": "1234567890"
}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

A successful response will contain the invoice's data, including the invoice reference in the reference field. Use this reference to, for example, update the invoice, send the invoice to the customer and create credit notes when needed.

Send Invoice

To generate the document and send the invoice to the customer, use the /invoices/{invoiceReference}/generateDocument endpoint. No request body is required for this endpoint.

  • Endpoint: /invoices/{invoiceReference}/generateDocument
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/invoices/string/generateDocument" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "attachments": [
      {
        "filname": "overwrite_filename.svg",
        "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
      }
    ],
    "data": "123",
    "notifyUrl": "https://yourdomain.com/notify"
  }'
const body = JSON.stringify({
  "attachments": [
    {
      "filname": "overwrite_filename.svg",
      "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
    }
  ],
  "data": "123",
  "notifyUrl": "https://yourdomain.com/notify"
})

fetch("https://staging1.abillify.dev/api/invoices/string/generateDocument", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/invoices/string/generateDocument"
  body := strings.NewReader(`{
    "attachments": [
      {
        "filname": "overwrite_filename.svg",
        "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
      }
    ],
    "data": "123",
    "notifyUrl": "https://yourdomain.com/notify"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/invoices/string/generateDocument"
body = {
  "attachments": [
    {
      "filname": "overwrite_filename.svg",
      "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
    }
  ],
  "data": "123",
  "notifyUrl": "https://yourdomain.com/notify"
}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Do note that this will lock the invoice and prevent further changes. This is not reversible.

Voucher Management - Order Flow

After creating the identity, you can proceed with the order flow. This flow involves creating an order, creating a voucher for the order, issuing the invoice, and sending the invoice to the customer.

Create Order

To create an order for a customer, use the /identities/{identityReference}/orders endpoint.

  • Endpoint: /identities/{identityReference}/orders
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/identities/string/orders" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "addresses": [
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "billing",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      },
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "shipping",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      }
    ],
    "currency": "EUR",
    "items": [
      {
        "constcenter": "1234",
        "detail": {
          "taxprofile": "default"
        },
        "label": "Product 1",
        "quantity": 1,
        "unit": "pcs",
        "unitprice": "100.00"
      }
    ],
    "netbased": true,
    "orderdate": "2020-01-01T00:00:00.000Z",
    "ordernumber": "XYZ-12345",
    "paymentkind": "CT",
    "reference": "1234567890"
  }'
const body = JSON.stringify({
  "addresses": [
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "billing",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    },
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "shipping",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    }
  ],
  "currency": "EUR",
  "items": [
    {
      "constcenter": "1234",
      "detail": {
        "taxprofile": "default"
      },
      "label": "Product 1",
      "quantity": 1,
      "unit": "pcs",
      "unitprice": "100.00"
    }
  ],
  "netbased": true,
  "orderdate": "2020-01-01T00:00:00.000Z",
  "ordernumber": "XYZ-12345",
  "paymentkind": "CT",
  "reference": "1234567890"
})

fetch("https://staging1.abillify.dev/api/identities/string/orders", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/identities/string/orders"
  body := strings.NewReader(`{
    "addresses": [
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "billing",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      },
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "shipping",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      }
    ],
    "currency": "EUR",
    "items": [
      {
        "constcenter": "1234",
        "detail": {
          "taxprofile": "default"
        },
        "label": "Product 1",
        "quantity": 1,
        "unit": "pcs",
        "unitprice": "100.00"
      }
    ],
    "netbased": true,
    "orderdate": "2020-01-01T00:00:00.000Z",
    "ordernumber": "XYZ-12345",
    "paymentkind": "CT",
    "reference": "1234567890"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/identities/string/orders"
body = {
  "addresses": [
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "billing",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    },
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "shipping",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    }
  ],
  "currency": "EUR",
  "items": [
    {
      "constcenter": "1234",
      "detail": {
        "taxprofile": "default"
      },
      "label": "Product 1",
      "quantity": 1,
      "unit": "pcs",
      "unitprice": "100.00"
    }
  ],
  "netbased": true,
  "orderdate": "2020-01-01T00:00:00.000Z",
  "ordernumber": "XYZ-12345",
  "paymentkind": "CT",
  "reference": "1234567890"
}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Create Invoice for Order

To create an invoice for the order, use the /orders/{orderReference}/invoices endpoint.

  • Endpoint: /orders/{orderReference}/invoices
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/orders/string/invoices" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "addresses": [
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "billing",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      },
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "shipping",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      }
    ],
    "currency": "EUR",
    "items": [
      {
        "constcenter": "1234",
        "detail": {
          "description": "This is a product description",
          "taxprofile": "default"
        },
        "label": "Product 1",
        "quantity": 1,
        "unit": "pcs",
        "unitprice": "100.00"
      }
    ],
    "netbased": true,
    "paymentkind": "CT",
    "reference": "1234567890"
  }'
const body = JSON.stringify({
  "addresses": [
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "billing",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    },
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "shipping",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    }
  ],
  "currency": "EUR",
  "items": [
    {
      "constcenter": "1234",
      "detail": {
        "description": "This is a product description",
        "taxprofile": "default"
      },
      "label": "Product 1",
      "quantity": 1,
      "unit": "pcs",
      "unitprice": "100.00"
    }
  ],
  "netbased": true,
  "paymentkind": "CT",
  "reference": "1234567890"
})

fetch("https://staging1.abillify.dev/api/orders/string/invoices", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/orders/string/invoices"
  body := strings.NewReader(`{
    "addresses": [
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "billing",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      },
      {
        "city": "Berlin",
        "company": "ACME Inc.",
        "country": "DE",
        "extra": "C/O Mr. Smith",
        "firstname": "John",
        "housenumber": "1",
        "info": "string",
        "kind": "shipping",
        "lastname": "Doe",
        "state": "Berlin",
        "street": "Main Street",
        "zipcode": "10115"
      }
    ],
    "currency": "EUR",
    "items": [
      {
        "constcenter": "1234",
        "detail": {
          "description": "This is a product description",
          "taxprofile": "default"
        },
        "label": "Product 1",
        "quantity": 1,
        "unit": "pcs",
        "unitprice": "100.00"
      }
    ],
    "netbased": true,
    "paymentkind": "CT",
    "reference": "1234567890"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/orders/string/invoices"
body = {
  "addresses": [
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "billing",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    },
    {
      "city": "Berlin",
      "company": "ACME Inc.",
      "country": "DE",
      "extra": "C/O Mr. Smith",
      "firstname": "John",
      "housenumber": "1",
      "info": "string",
      "kind": "shipping",
      "lastname": "Doe",
      "state": "Berlin",
      "street": "Main Street",
      "zipcode": "10115"
    }
  ],
  "currency": "EUR",
  "items": [
    {
      "constcenter": "1234",
      "detail": {
        "description": "This is a product description",
        "taxprofile": "default"
      },
      "label": "Product 1",
      "quantity": 1,
      "unit": "pcs",
      "unitprice": "100.00"
    }
  ],
  "netbased": true,
  "paymentkind": "CT",
  "reference": "1234567890"
}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Send Invoice

To generate the document and send the invoice to the customer, use the /invoices/{invoiceReference}/generateDocument endpoint. No request body is required for this endpoint.

  • Endpoint: /invoices/{invoiceReference}/generateDocument
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/invoices/string/generateDocument" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "attachments": [
      {
        "filname": "overwrite_filename.svg",
        "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
      }
    ],
    "data": "123",
    "notifyUrl": "https://yourdomain.com/notify"
  }'
const body = JSON.stringify({
  "attachments": [
    {
      "filname": "overwrite_filename.svg",
      "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
    }
  ],
  "data": "123",
  "notifyUrl": "https://yourdomain.com/notify"
})

fetch("https://staging1.abillify.dev/api/invoices/string/generateDocument", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/invoices/string/generateDocument"
  body := strings.NewReader(`{
    "attachments": [
      {
        "filname": "overwrite_filename.svg",
        "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
      }
    ],
    "data": "123",
    "notifyUrl": "https://yourdomain.com/notify"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/invoices/string/generateDocument"
body = {
  "attachments": [
    {
      "filname": "overwrite_filename.svg",
      "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
    }
  ],
  "data": "123",
  "notifyUrl": "https://yourdomain.com/notify"
}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Do note that this will lock the invoice and prevent further changes. This is not reversible.

Credit Notes

Credit Notes are used to refund customers, they are always linked to an invoice.

Create and Send Credit Notes

In case you need to refund the customer, you can create a credit note using the /invoices/{invoiceReference}/creditnotes endpoint.

  • Endpoint: /invoices/{invoiceReference}/creditnotes
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/invoices/string/creditnotes" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{}'
const body = JSON.stringify({})

fetch("https://staging1.abillify.dev/api/invoices/string/creditnotes", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/invoices/string/creditnotes"
  body := strings.NewReader(`{}`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/invoices/string/creditnotes"
body = {}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

Sending the credit note works similarly to sending the invoice, by calling the /creditnotes/{creditnoteReference}/generateDocument endpoint:

  • Endpoint: /creditnotes/{creditnoteReference}/generateDocument
  • Method: POST

Request

curl -X POST "https://staging1.abillify.dev/api/creditnotes/string/generateDocument" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "attachments": [
      {
        "filname": "overwrite_filename.svg",
        "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
      }
    ],
    "data": "123",
    "notifyUrl": "https://yourdomain.com/notify"
  }'
const body = JSON.stringify({
  "attachments": [
    {
      "filname": "overwrite_filename.svg",
      "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
    }
  ],
  "data": "123",
  "notifyUrl": "https://yourdomain.com/notify"
})

fetch("https://staging1.abillify.dev/api/creditnotes/string/generateDocument", {
  headers: {
    "Idempotency-Key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://staging1.abillify.dev/api/creditnotes/string/generateDocument"
  body := strings.NewReader(`{
    "attachments": [
      {
        "filname": "overwrite_filename.svg",
        "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
      }
    ],
    "data": "123",
    "notifyUrl": "https://yourdomain.com/notify"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Idempotency-Key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://staging1.abillify.dev/api/creditnotes/string/generateDocument"
body = {
  "attachments": [
    {
      "filname": "overwrite_filename.svg",
      "url": "https://abillify.me/wp-content/themes/abillify/assets/images/logo.svg"
    }
  ],
  "data": "123",
  "notifyUrl": "https://yourdomain.com/notify"
}
response = requests.request("POST", url, json = body, headers = {
  "Idempotency-Key": "string",
  "Content-Type": "application/json"
})

print(response.text)

For more details, check the API specification here.

As with invoices, this will lock the credit note and prevent further changes.

Error Handling

The Abillify API returns standard HTTP status codes for successful and erroneous requests. Here are some common status codes and their meanings:

  • 200 OK: The request was successful.
  • 400 Bad Request: The request was invalid or cannot be served.
  • 401 Unauthorized: Authentication failed or user does not have permissions.
  • 404 Not Found: The requested resource could not be found.
  • 500 Internal Server Error: An error occurred on the server.

In case of errors, the response body will contain detailed information about the error.

Example error response:

{
  "code": 400,
  "message": "InvalidValue, see error details",
  "name": "ClientError",
  "type": "ERR_INVALID_VALUE",
  "details": [
    {
      "error": "Value for field 'debtor' is of wrong type, expected bigint.",
      "fields": ["debtor"],
      "hint": "Value must be a number or a string containing only a number."
    }
  ]
}

By following this guide, you should be able to effectively handle new vouchers and identities using the Abillify API. For more detailed information, refer to the official API documentation here.