Search API-Explorer Need help? Create your account

Create invoice for webshop order

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.

How it works

When creating an invoice, the following sequence of steps takes place:

  1. (Prerequisite) Merchant has previously created an order via create webshop order and the order has not been cancelled.
  2. Merchant ships goods / provides licences / fulfils service.
  3. Merchant sends request for creation of invoice to Accounting as a Service.
High-level process description
A process overview using BPMN
Checkout the BPMN illustration to get an overview of the process, including the various activities and participating main actors.

How to implement

Invoice a webshop order

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.

Sample request
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",
}
Sample response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "internalRequestId": "23c9579b-baaf-468f-a529-f876226e183c"
}

Provide details for orders with shipment of physical goods

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.

Sample request
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"
}
Sample response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "internalRequestId": "23c9579b-baaf-468f-a529-f876226e183c"
}

See also