In order to verify that the articles exists in stock when completing a purchase you can provide a validation uri in the Initialize a Checkout Session request. If provided, a call this uri will be performed before the purchase is completed
During this validate call your backend can (optionally) create an order and send the order reference back in the response as json.
Note that this order should not be considered completed on your side since the purchase is not completed yet. Please read up on the Handle Purchase Callbacks section since the notification callback is the only valid place to consider a purchase to be successful.
If an order reference is provided in the response it will be shown on the thank you page.
Even if the validate call was successful (2xx, e.g. 200 OK) the purchase might not be completed due to various reasons. For example, the credit check on the customer might be rejected.
If this call returns a non-2xx http status code, we will stop the purchase and emit a frontend event, read more in section Client-side events. We will follow redirects, e.g. 301.
This call has a timeout of 10 seconds, if the call does not return a response within this timeout the purchase will not be completed and the customer will be shown a message and given the opportunity to try again. Please note that this endpoint might be called several times. For example when the end customer fails the credit check and chooses to purchase by card or direct bank transfer instead. In these cases there will be several calls to this endpoint.
- Validate Call
- Response with a reference
- Response with custom error
GET /validation-uri-provided-in-initialize HTTP/1.1Host: yourdomain.se
By using this feature the time it takes to complete a purchase will increase, causing longer wait times for the end customer. If you have reservation functionality in your ecommerce system we suggest you use that instead. Reservation in ecommerce systems is a feature to reserve/lock the articles the customer have in the cart when visiting the Checkout page, preventing customers from buying articles that dont exist in stock.
There are no request properties.
Properties for successful response
|orderReference||No||Order reference to the order just created during the validate call. This can later be used to track the purchase with merchant services. Max 50 chars.|
Properties for unsuccessful response
|title||No||The title of the validation failure displayed in the Checkout. Truncated to max 512 chars.|
|message||No||The message with a more descriptive text why the validation failed, and how the customer should proceed. Truncated to max 512 chars.|
In order to override the default title and message both title and message must be specified in the response.
The response must be empty or a valid Json document.