Cancel an authorization

Learn to cancel an authorization.

In Digital River, authorizations are cancelled by marking items in the order as cancelled. Therefore, it is not possible to cancel an authorization by adding a CancelAuthorization transaction. Also, while partial cancels are supported, it is not possible to specify the amount to be cancelled. The amount calculated for you by Digital River, based on the items you cancel.

Items can be marked as cancelled in the following ways:

The next sections provide more details.

Call the Digital River fulfillments API

To use the Digital River API directly, you need your Digital River secret API key and the Digital River order and line item ids. The Digital River order ID is available in the custom field drOrderId on the commercetools order. The Digital River line item ID is available in the custom field drLineItemId in each commercetools order line item.

Use the Convenience API

The convenience API is similar to the Digital River API above but it lets you use the commercetools resource ids to look up your configured secret API key for you. The following is an example:

Method: POST

Path: /api/v1/fulfillments/create

Payload:

{
  "orderId": "<commercetools order id>",
  "items": [
    {
      "itemId": "<commercetools line item id>",
      "quantity": 0,
      "cancelQuantity": <quantity to cancel>
    }
  ],
  "metadata": {
    <any key value pairs>
  }
}

You can also provide optional metadata.

Note: The endpoint should be secured, even if you use the convenience API.

Understand the cancellation outcome

Digital River calculates the amount to be cancelled for you. When this is available, a CancelAuthorization transaction with the amount is added to the commercetools payment. The state of the transaction will be either Success or Failure depending on the outcome of the cancellation in Digital River.

The interactionId of the CancelAuthorization transaction is set to the ID of the Digital River cancellation so that you can reconcile these two if needed.

Last updated