Selling an Invoice

Customer

Before we can sell our first invoice we first need to register our customer as a recipient.

curl -X "POST" "https://api.invoier.com/v1/customers" \
     -H 'Authorization: <API_KEY>' \
     -H 'Content-Type: application/json' \
     -d $'{
  "customer": {
  	"metadata": {
      "myCustomerNumber": 5
    }
    "nationalOrgNumber": {
      "country": "SE",
      "orgNumber": "559146-3327"
    }
  }
}'

If the customer is already registered it will be returned. Note that metadata is optional and can be used to store arbitrary data together with the customer.

{
  "customer": {
    "companyName": "Invoier AB",
    "createdAt": "2025-04-02T11:24:46.507554+00:00",
    "customerId": "0195f63f-1e2b-99ec-1703-07613affa762",
    "metadata": {
      "myCustomerNumber": 5
    },
    "nationalOrgNumber": {
      "country": "SE",
      "orgNumber": "5591463327"
    }
  }
}

Invoice Intent

Next we create an invoice intent with an amount of 1 000 kr and a duration of 30 days.

## Create Invoice Intent
curl -X "POST" "https://api.invoier.com/v1/invoice-intents" \
     -H 'Authorization: <API_KEY>' \
     -H 'Content-Type: application/json' \
     -d $'{
  "invoiceIntent": {
    "amount": {
      "currency": "SEK",
      "value": 1000
    },
    "debtor": {
      "customerId": "0195f63f-1e2b-99ec-1703-07613affa762"
    },
    "duration": 30
  }
}'

When it was created the invoice intent received an indicative bid from the marketplace. If we want a more concrete offer we can query intent again in a couple of seconds as more bids are collected.

{
  "invoiceIntent": {
    "amount": {
      "currency": "SEK",
      "value": 1000
    },
    "attachmentTargets": [
      {
        "emailAddress": "[email protected]",
        "expiresAt": "2025-04-30T12:53:20.540570+00:00",
        "transferNotice": "<INVOICE TRANSFER NOTICE>"
      }
    ],
    "createdAt": "2025-04-23T12:53:20.540570+00:00",
    "debtor": {...},
    "duration": 30,
    "financing": {
      "offers": [
        {
          "createdAt": "2025-04-23T12:53:20.540570+00:00",
          "financedAmount": {
            "currency": "SEK",
            "value": 1000
          },
          "financingCost": {
            "currency": "SEK",
            "value": 56.81,
            "vat": 14.2
          },
          "offerType": "INDICATIVE_BID",
          "terms": {
            "durationInDays": 30,
            "durationOffsetInDays": 0,
            "fees": [
              {
                "feeType": "YEARLY_INTEREST",
                "unit": "PERCENT",
                "value": 15.21
              },
              {
                "currency": "SEK",
                "feeType": "FIXED",
                "value": 44.31
              }
            ],
            "financingRatio": 1.0,
            "requiresManualReview": false
          }
        }
      ]
    },
    "invoiceDate": "2025-04-23",
    "invoiceIntentId": "7d6b81e9-8349-4a6c-99a4-23239ec4f461",
    "invoiceIntentStatus": "COLLECTING_OFFERS"
  }
}

Invoice

Once we are happy with the financing terms we can create the invoice in our invoicing system. The API provides a few mechanisms for sharing the PDF version with Invoier but the most straightforward one involves including a unique email in the BCC field when sending the invoice.

The Invoice Intent provides us with this address through what is called attachment targets. The attachment target also specifies the transferNotice that needs to be present in the PDF document.

The final step is to actually create the invoice. The final piece of information we need to add is the invoice's reference and optional transactionReference. These are usually generated by your invoicing system.

## Create Invoice
curl -X "POST" "https://api.invoier.com/v1/invoices" \
     -H 'Authorization: <API_KEY>' \
     -H 'Content-Type: application/json' \
     -d $'{
  "invoice": {
    "addresses": [
      {
      	"emailAddress": "[email protected]",
        "labels": [
          "billing"
        ]
      },
      {
        "emailAddress": "[email protected]",
        "labels": [
          "contact"
        ],
        "phoneNumber": "+46701112233",
        "personName": "Contact Person"
      }
    ],
    "invoiceIntentId": "7d6b81e9-8349-4a6c-99a4-23239ec4f461",
    "reference": "159",
    "transactionReference": "15906"
  }
}'