Cancel webshop order

An overview of the typical use case handling the cancelation of webshop orders which have not yet been invoiced.

As long as an order has not yet been invoiced, a customer may cancel the order or any order position at any point in time. When cancelling an order, a refund may be required if the payment has already been captured. If a refund is required, Accounting as a Service will automatically take care of the refund as part of the overall cancellation process. No additional processing is required on your end.

Once the order has been created in the accounting module using create webshop order, you can cancel any of the order positions until they have been invoiced.

How it works

When executing an order cancellation, the following sequence of steps takes place:

  1. Customer sends request for cancellation of an order to the merchant.
  2. Merchant passes request for order cancellation to Accounting as a Service.
  3. In case the payment has already been captured, Accounting as a Service creates an internal refund request based on the received order cancellation request.
  4. In case of a payout request existing, Accounting as a Service initiates the refund.
  5. Accounting as a Service triggers a notification of type accounting/refundCompleted once the initiated payment has been completed.
  6. (Optional) Accounting as a Service informs the customer about the initiated payment via email.
High-level process description
An overview using BPMN to describe the process flow
Checkout the BPMN illustration to get an overview of the process, including the various activities and participating main actors.

How to implement

Cancel an order

To cancel an order, make a POST /accounting/v1/businesses/{businessCode}/customers/{customerNumber}/orders/{orderReference}/cancellations request, where {businessCode} is the related business entity, {customerNumber} is the identifier of the related customer and {orderReference} is the reference of the order (as indicated during the creation of the order) that you would like to be cancelled.

Please note that you can only cancel entire order positions. A partial cancellation of an order line / position is not possible.

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/cancellations HTTP/1.1
Host: api-uat.accounting.riverty.io
X-Subscription-Key: YOUR_API_SUBSCRIPTION_TOKEN
Content-Type: application/json

{
  "cancellationDate": "2018-03-21T00:00:00.0000000+00:00",
  "cancellationReason": "OUT_OF_STOCK",
  "invoiceReference": "IDE12345678901",
  "items": [
    {
      "orderItemReference": 1
    }
  ]
}
Sample response
HTTP/1.1 200 OK
Content-Type: application/json

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

Cancel an order with refund to specific IBAN

In some cases, your customer may want to receive the payment to a different account (IBAN) than to the account from where the origin payment was made or in case of some payment methods (e.g. omnichannel) Accounting as a Service may not know any payment instrument to refund yet. In this case, you can provide the information about the IBAN, bank account owner and BIC (in case the account is located outside the SEPA-area) to be used instead of the origin account. By default, the payment will be paid to the original payment method and account number.

In case a different account shall be used, the following fields are required:

  • IBANcode
  • bankAccountOwner
  • BIC (only mandatory in case the account is located outside the SEPA-area)

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/cancellations HTTP/1.1
Host: api-uat.accounting.riverty.io
X-Subscription-Key: YOUR_API_SUBSCRIPTION_TOKEN
Content-Type: application/json

{
  "cancellationDate": "2018-03-21T00:00:00.0000000+00:00",
  "cancellationReason": "OUT_OF_STOCK",
  "invoiceReference": "IDE12345678901",
  "IBANcode": "DE89370400440532013000",
  "bankAccountOwner": "Sammy Sample",
  "BIC": "INGDDEFFXXX",
  "items": [
    {
      "orderItemReference": 3
    }
  ]
}
Sample response
HTTP/1.1 200 OK
Content-Type: application/json

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

See also