# Checkout

Submit an order and redirect to the payment provider.

# Endpoint

POST /checkout

# Fields

Name Required
name true
street true
zip true
city true
province false
country true
phone true
email true
shipping_method true
shipping_pickup_point false
payment_method true
terms true
accepts_marketing false
set_cart_products false

# Example

<form action="/checkout" method="POST">

    <input type="text" name="name">

    <input type="text" name="street">

    <input type="text" name="zip">

    <input type="text" name="city">

    <select name="country">
        {%- for country in checkout.countries -%}
            <option value="{{ country.id }}">{{ country.name }}</option>
        {%- endfor -%}
    </select>

    <input type="tel" name="phone">

    <input type="email" name="email">

    <select name="shipping_method">
        {%- for shipping_option in checkout.shipping_options_filtered -%}
            <option value="{{ shipping_option.id }}">
                {{ shipping_option.description }}
            </option>
        {%- endfor -%}
    </select>

    <select name="payment_method">
        {%- for payment_method in checkout.payment_methods -%}
            <option value="{{ payment_method.handle }}">
                {{ payment_method.title }}
            </option>
        {%- endfor -%}
    </select>

    <input type="checkbox" name="accepts_marketing" value="1">

    <input type="checkbox" name="terms" value="1">

    {{ csrf.field }}

    <button type="submit">Submit</button>


</form>

name
The name of the customer. Must be minimum 2 words (first name and last name)

street
The name of the street incl. the house number of the customer.

zip
The zip/postal code of the customer. Must be a valid zip for the country that's submitted with the request.

city
The city of the customer.

province
The province of the customer. E.g. Washington or WA. Any value will be accepted, so we often recommend using dropdowns for this value.

country
An ISO_3166-1 representation of the customer's country. The country specified is used to validate the zip and phone number.

phone
A valid phone number. If the phone number doesn't include a price e.g. +45. It will be validated against the specified country. Please note that we do not check if the phone number exists, but only check that it follows the official country syntax. Whitespaces (spaces) are ignored.

email
A valid email. We don't validate that the email exists, but validate that it is a correct email syntax.

shipping_method
The ID if one of your store's shipping rates. We validate that the shipping rate is available in the customers country based on what you have setup in the shipping zone.

shipping_pickup_point
Optionally specify the ID of the pickup point for shipping methods with pick up in-store options.

payment_method
The handle of the payment method that the customer wants to use.

terms
Specify if the customer accepts the terms and conditions. The only accepted value is 1. It's required but can be hardcoded to 1 with a hidden input you don't want the checkbox.

accepts_marketing
Optionally specify if the customer wants to opt-in to marketing promotions. The only accepted value is 1 or 0, but can be left out.

set_cart_products
Clear the customer's current cart and checkout with the specified products instead. This is often used on landing pages etc. where you are selling a specific product and don't care about which is in the customer's current cart. A single or multiple variants can be specified.

Example

<input type="hidden" name="set_cart_products[{{ variant_one.id }}]" value="1">
<input type="hidden" name="set_cart_products[{{ variant_two.id }}]" value="1">