An overview of the typical use case handling the creation of an invoice to start the accounting process
The process to create an invoice is the second step in the accounting process, which can be started as soon as you have created the webshop order. This API call is mandatory for all orders in order to have Accounting as a Service fully processing the order. Depending on your requirements and needs, you can either create dedicated invoices for single order lines or create a single invoice for the entire order.
When creating an invoice, the following sequence of steps takes place:
To invoice an order, make a POST /accounting/{version}/businesses/{businessCode}/customers/{customerNumber}/orders/{orderReference}/invoices
request, where {businesscode}
is the related business entity, {customerNumber}
is the identifier of the affected customer and {orderReference}
is the reference of the order that you would like to be invoiced.
IMPORTANT NOTE You can either create an invoice for a single order position or for the entire order. You cannot create a cancellation for any order position where you have created an invoice for.
For more information, please refer to the related endpoint description within the API Explorer.
POST /accounting/v1/businesses/1000/customers/TFI2021072801/orders/ODE12345678901/invoices HTTP/1.1
Host: api-uat.accounting.riverty.io
X-Subscription-Key: YOUR_API_SUBSCRIPTION_TOKEN
Content-Type: application/json
{
"dispatchDate": "2018-11-06",
"dueDate": "2018-11-05",
"invoiceDate": "2018-11-04",
"items": [{
"orderItemReference": 1
}
],
"invoiceReference": "IDE12345678901",
"shipmentReference": "S01234567",
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"internalRequestId": "23c9579b-baaf-468f-a529-f876226e183c"
}
In case the order contains physical products that have to be shipped to the customer (i.e. orderType
= PHYSICAL_GOODS
), you should provide the following information:
carrier
trackingCode
IMPORTANT NOTE If the paymenMethodName
= CashOnDelivery
, the information is mandatory to enable Accounting as a Service to perform the carrier dunning process.
For more information, please refer to the related endpoint description within the API Explorer.
POST /accounting/v1/businesses/1000/customers/TFI2021072801/orders/ODE12345678901/invoices HTTP/1.1
Host: api-uat.accounting.riverty.io
X-Subscription-Key: YOUR_API_SUBSCRIPTION_TOKEN
Content-Type: application/json
{
"dispatchDate": "2018-11-06",
"dueDate": "2018-11-05",
"invoiceDate": "2018-11-04",
"items": [{
"orderItemReference": 1
}
],
"invoiceReference": "IDE12345678901",
"shipmentReference": "S01234567",
"carrier": "DHL",
"trackingCode": "123456asfd788754sdffs987"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"internalRequestId": "23c9579b-baaf-468f-a529-f876226e183c"
}