> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Storefront API Checkout (In Progress)

> Run order completion flows with the WEBSALE Storefront API Checkout: shipping, payment selection, totals, validation, and triggering payment processes.

The Storefront API Checkout provides functions for the order and checkout process. It covers the steps that typically take place between the shopping cart and order completion.

These include:

* Determining and selecting shipping methods
* Determining and selecting payment methods
* Calculating totals (including taking into account discounts, surcharges, and other price-relevant components)
* Checking and accepting checkout-relevant data (e.g. delivery/billing data, prerequisites, and conditions for order completion)
* Triggering order completion and transitioning into the respective payment flow (depending on the payment method)

In addition, the interface provides access to all relevant settings and rules for the order process, e.g. minimum order values, small-quantity surcharges, and other checkout-relevant restrictions or surcharge logic, so that these can be correctly considered and displayed in the frontend.

<Info>
  This Storefront API is currently still being developed and is at present available **only with a limited scope of functions**. Which information and endpoints are currently included can be found in the interface description below. The further development of this interface is being continuously continued.
</Info>

***

## Supported methods

List of all supported methods.

| **Command**              | **Endpoints**             | **GET**               | **PUT**             | **POST**              | **DELETE**          |
| ------------------------ | ------------------------- | --------------------- | ------------------- | --------------------- | ------------------- |
| Retrieve checkout status | `checkout/status`         | <Icon icon="check" /> | <Icon icon="ban" /> | <Icon icon="ban" />   | <Icon icon="ban" /> |
| Set account type         | `checkout/setAccountType` | <Icon icon="ban" />   | <Icon icon="ban" /> | <Icon icon="check" /> | <Icon icon="ban" /> |

## Methods for the checkout

The following methods provide information about the current checkout process of the active session.

### GET checkout/status

The following call returns the total costs for the checkout process (including small-quantity surcharge "`surcharge`", shipping and payment method costs, vouchers, etc.). It can be used, for example, to update the total amount in the checkout without reloading the page.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
GET https://<your-shop>.de/api/v1/checkout/status
```

#### **Parameter overview**

#### **Header parameters**

| **Parameter** | **Description**                                                                                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `x-session`   | **Required field**<br />ID of the current session.   <br />More information: [Storefront API Basics](../storefront-api/storefront-api-basics.md#2-session-handling) |

#### **Example response**

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
   "currency" : "EUR",
   "paymentCost" : 0,
   "shippingCost" : 0,
   "surchargeCost" : 0,
   "total" : 14.9,
   "totalGross" : 14.9,
   "totalNet" : 12.52,
   "totalTax" : 2.38,
   "totalVoucher" : 0,
   "totalWeight" : 0
}
```

### POST checkout/setAccountType

The following call sets the type of account used for the order in the checkout. This determines whether the customer orders as a new customer, existing customer, or guest.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
POST https://<your-shop>.de/api/v1/checkout/setAccountType
```

#### **Example request**

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
    "accountType": "guest"
}
```

#### **Parameter overview**

#### **Header parameters**

| **Parameter** | **Description**                                                                                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `x-session`   | **Required field**<br />ID of the current session.   <br />More information: [Storefront API Basics](../storefront-api/storefront-api-basics.md#2-session-handling) |

#### **Body parameters**

| **Parameter** | **Type** | **Description**                                                                                                                                                                                    |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountType` | string   | **Required field**<br />Type of customer account.   <br />Valid values:  <br />- `"new"` - New customer <br />- `"registered"` - Registered customer<br />- `"guest"` - Order without registration |
