Cancel an order - Amplia Reg
Cancel an order when the certificate is no longer wanted, for example because the sale was canceled or refunded in your system. A canceled order is closed for good: it cannot be reopened, and the holder can no longer issue the certificate.
Make sure you have completed the Getting started steps
Before you start
- Role: the application must have the Sales app role. The Electronic registration authority role, used for preapproved orders, cannot cancel orders: an application that creates preapproved orders and also cancels them needs both roles.
- Order status: an order can be canceled at any status until the certificate is issued, including Waiting issue. Orders that are Issued, Revoked or already Canceled cannot be canceled. See Order statuses.
Canceling does not apply to a certificate that was already issued. To invalidate an issued certificate, it must be revoked instead. See Revocation.
Canceling the order
Call the cancellation API with the order number and the reason for the cancellation.
In .NET:
await ampliaRegService.CancelOrderAsync("100-000-010", new OrderCancelRequest() {
Description = "Cancellation requested by customer", // Cancellation reason (required, max 500 characters)
});
Via API:
POST /api/orders/100-000-010/cancellation
{
"description": "Cancellation requested by customer" // Cancellation reason (required, max 500 characters)
}
The order can be identified by its number or by its ID (the orderId received in webhooks). The number is matched
ignoring punctuation, spaces and case, so 100-000-010 and 100000010 refer to the same order.
The description field is required, with up to 500 characters. Write it for whoever will read the order's history later: it is recorded
in the order's status history, next to the date of the cancellation.
On success, the API responds with HTTP code 200 and no body.
What happens next
- The order moves to Canceled (
Canceled), and the cancellation and its reason are recorded in the order's history. - If the order was created by your application and your application has webhooks enabled, it receives an
OrderStatusChangednotification withstatusset toCanceled. TheorderStatusTransitionModel.descriptionfield carries the reason given in the request. - For ICP-Brasil orders, if the holder's biometric enrollment was started for this order and the order had not been approved yet, Amplia Reg also cancels the pending enrollment transaction with the biometric service.
Errors
| Code | Cause |
|---|---|
OrderNotFound | No order with the given number or ID exists |
CannotCancelOrder | The order is already Issued, Revoked or Canceled |
If the application does not have the Sales app role, the API responds with HTTP code 403 (Forbidden). If description is missing or
longer than 500 characters, it responds with HTTP code 400 (Bad Request). See Error codes for the other codes.