When a contact places an order and their account is configured to use an external service to determine whether approval is required, the server first invokes the Order Approvals function webhook. The webhook sends the following data to the external system:
Details about the order. The request does not include certain payment details, such as credit card information. See Understand webhooks and PCI DSS compliance for information about payment details that are excluded from the request. SeeOrder Submit request example for a sample JSON representation of an order in a webhook body.
Shopper profile details for the contact who placed the order.
Details about the account for which the order was placed.
To send this data to the external system, you configure the webhook by specifying the URL, username, and password for accessing the system. (See Configure webhooks for details.) You must also configure the external system to read the request data, determine whether the order requires approval, and send a response that includes the following items:
The key
approvalAction
, whose value must be eithertrue
(the order requires approval) orfalse
(the order does not require approval).The key
approvalActionReason
, whose value is a string that describes the reason approval is required ifapprovalAction
istrue
. Commerce Cloud adds this string to the order’s properties and displays it in layouts and emails related to orders and approvals. See Configure page layouts for order approvals for details about layouts where this string can appear. See Notify users of order approval-related events in Using Oracle Commerce Cloud for details about emails where this string can appear.If
approvalAction
istrue
butapprovalActionReason
is missing, empty, or contains a null string, Commerce Cloud uses the stringReason unavailable
.
For example, if the order requires approval because some of the products ordered are part of a specific collection, the response body might be:
{ "approvalAction": true, "approvalActionReason": "Contains restricted items" }
If Commerce Cloud cannot connect to the external system, for example in the event of an outage, or if the approvalAction
key is missing, null, or contains an invalid value, the order is sent for approval. Approvers are notified, via the Order Pending For Approval email, that the order requires approval because the external system could not be reached.