The checkout endpoints provide ways of performing a checkout process against an Order. The Storefront API supports two ways of checking out an order, one using hosted checkout pages, and a more advanced option for inline payment processing.
With the hosted checkout flow it is required that before redirecting to the payment gateway a checkout token should be generated. This token is passed to the pay endpoint to ensure that only the given order can be processed in response to the checkout request. The pay endpoint should be launched in a WebView/iframe with this token which will redirect to the given Orders payment gateway for payment capture. To determine the outcome of the payment developers should monitor the WebView/iframes URL. They will be redirected to the same pay endpoint URL with either a /completed
, /canceled
or /errored
suffix.
Initialization prepares the order for checkout and produces a token to be passed to the /pay
endpoint.
The ID of the order being checked out
Example:bd7eb675-0fd8-4d32-b855-c1db06db6348
StorestringRequired
The ID or the alias of the store
Example:{"value":"f14ca31d-3dc2-4fae-86eb-8676de0d0238"}
OriginstringOptional
The base URL the checkout request originates from. Used on the checkout status pages to securly post messages back to a parent window about the checkout status.
Example:https://www.example.com
ModestringOptional
Sets the mode the checkout should run in, either Redirect
(default) which follows the regular full redirect approach and after payment returns to the configured URL's in the payment provider settings, or Framed
where it is assumed the checkout will be opened in a WebView/iframe and the status of the container monitored.
{"value":"Redirect"}
GET /umbraco/commerce/storefront/api/v1/checkout/{orderId}/token HTTP/1.1
Host:
Store: text
Accept: */*
{
"token": "text",
"orderNumber": "text",
"payUrl": "text"
}
Starts the hosted payment process
Redirects to the given Orders selected payment gateway for payment processing.If in Framed
mode should be redirected to as normal, or if in Framed
mode, the endpoint URL should be launched in a WebView/iframe and developers should watch for changes in the URL to detect the outcome of the transaction. Final endpoint URLs will be one of {endpointUrl}/completed
, {endpointUrl}/canceled
or {endpointUrl}/errored
. If launched in an iframe from a web context, you can also register a message
event handler to get notified of the final status. Messages will be in the format UC:{orderId}:{token}:{status}
The ID of the order being checked out
Example:927dde27-4b3f-4223-9c89-1b0d25fadf0f
tokenstringRequired
The checkout token for the checkout session
Example:d84581c4-135e-41a0-ba92-38d3d6002661
GET /umbraco/commerce/storefront/api/v1/checkout/{orderId}/pay/{token} HTTP/1.1
Host:
Accept: */*
With the inline checkout flow, it is left to the implementing developer to perform payment capture. Before a capture can begin, the order should be initialized using the initialize
endpoint which prepares the Order for capture. The initialize
endpoint will return the settings of the Orders selected payment method, along with details of expected metadata needed by the payment provider. Developers can use this data to perform an inline capture and call the confirm
endpoint when the capture is successful, passing back any metadata captured.
With inline checkout flow it's the developers responsibility to capture the transaction and confirm the payment via the /confirm
endpoint. The selected payment methods setting are returned to ease payment gateway configuation, along with details of any meta data the payment method expects to be captured.
The ID of the order being checked out
Example:54a5385f-6af0-4706-b77d-eb01e52e2f90
Api-KeystringRequired
API key specified through configuration to authorize access to the API.
StorestringRequiredThe ID or the alias of the store
Example:{"value":"1b82c2c3-c80b-47ae-aed6-627f5cdec050"}
GET /umbraco/commerce/storefront/api/v1/checkout/{orderId}/initialize HTTP/1.1
Host:
Api-Key: text
Store: text
Accept: */*
{
"orderNumber": "text",
"paymentMethod": {
"settings": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"metaDataDefinitions": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"urls": {
"continue": "text",
"cancel": "text",
"error": "text",
"callback": "text"
}
}
}
Confirms an inline checkout flow
Updates the given Orders transaction info with the supplied details and transitions the order from a open
to a finalized
state
The ID of the order being checked out
Example:fa6d97a5-737b-448b-9809-5d719338d4df
fieldsstringOptional
Limit the properties returned in the response
Example:{"value":" "}
expandstringOptional
Defines the properties that should be expanded in the response
Example:{"value":" "}
Api-KeystringRequired
API key specified through configuration to authorize access to the API.
StorestringRequiredThe ID or the alias of the store
Example:{"value":"53df8d21-a3ce-4646-955e-96394cde5206"}
POST /umbraco/commerce/storefront/api/v1/checkout/{orderId}/confirm HTTP/1.1
Host:
Api-Key: text
Store: text
Content-Type: application/json
Accept: */*
Content-Length: 119
{
"amount": 1,
"fee": 1,
"transactionId": "text",
"paymentStatus": "Initialized",
"metaData": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
{
"orderNumber": "text",
"transactionInfo": {
"transactionId": "text",
"authorizedAmount": {
"currency": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"code": "text"
},
"value": 1,
"formatted": {
"value": "text"
}
},
"feeAmount": {
"currency": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"code": "text"
},
"value": 1,
"formatted": {
"value": "text"
}
},
"baseCurrencyExchangeRate": 1,
"paymentStatus": "Initialized"
}
}
Last updated 4 months ago
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4