Composable Frontend 2.0 Learn more 

  • Commerce Cloud/
    Checkout/
    Account Checkout API

    Account Checkout API

    When a Cart is ready for checkout, you can convert the cart to an order. The cart remains and can be modified and checked out again if required.

    After a successful checkout, a response that contains the order is returned.

    By default, carts are automatically deleted 7 days after the last update. You can change this setting by updating cart settings.

    Your inventory is modified during checkout and payment of an order. For more information about the changes in the inventory, see the Inventory section.

    POST Create Checkout With Account

    The user authenticates with the Client Credentials Token.

    https://useast.api.elasticpath.com/v2/carts/:reference/checkout
    

    Parameters

    Path parameters

    NameRequiredTypeDescription
    referenceRequiredstringThe reference to the cart that you want to check out.

    Headers

    NameRequiredTypeDescription
    AuthorizationRequiredstringThe Bearer token required to get access to the API. Set the grant type to client_credentials to use this checkout mechanism.

    Body

    NameRequiredTypeDescription
    account.idRequiredstringThe account ID.
    account.member_idOptionalstringThe account member ID.
    contact.nameRequiredstringThe name of the account member.
    contact.emailRequiredstringThe email address of the account member.

    Request example

    curl -X POST https://useast.api.elasticpath.com/v2/carts/:reference/checkout \
         -H "Authorization: Bearer XXXX" \
         -H "Content-Type: application/json" \
        -d $ {
           "data": {
             "account": {
                "id": "8cee1b9e-3e39-4d5f-bd4a-86cdb985c6ee",
                "member_id": "338f84bf-e6c9-4704-9f33-2708addd462b"
            },
             "contact": {
               "email": "john@email.com",
               "name": "John Doe"
             },
             "billing_address": {
               "first_name": "John",
               "last_name": "Doe",
               "company_name": "ElasticPath",
               "line_1": "1234 Disney Drive",
               "line_2": "Disney Resort",
               "city": "Anaheim",
               "county": "Orange",
               "region": "CA",
               "postcode": "92802",
               "country": "US"
             },
             "shipping_address": {
               "first_name": "John",
               "last_name": "Doe",
               "company_name": "ElasticPath",
               "phone_number": "(555) 555-1234",
               "line_1": "1234 Disney Drive",
               "line_2": "Disney Resort",
               "city": "Anaheim",
               "county": "Orange",
               "region": "CA",
               "postcode": "92802",
               "country": "US",
               "instructions": "Leave in porch"
             }
           }
        }
    

    Response example

    201 Created

    {
        "data": {
            "id": "74b48ecb-8599-4c63-85a8-09cb9bb7ee39",
            "type": "order",
            "status": "incomplete",
            "payment": "unpaid",
            "shipping": "unfulfilled",
            "contact": {
                "name": "John Doe",
                "email": "johndoe@email.com"
            },
            "shipping_address": {
               ...
            },
            "billing_address": {
               ...
            },
            "links": {},
            "meta": {
                ...
            },
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "d9f30f2f-9973-45d7-a6c9-360be52a26b0"
                        }
                    ]
                },
                "account": {
                    "data": {
                        "type": "account",
                        "id": "b6e47478-7e7f-4127-b7e9-4a255564ae68"
                    }
                },
                "account_member": {
                    "data": {
                        "type": "account_member",
                        "id": "338f84bf-e6c9-4704-9f33-2708addd463a"
                    }
                }
            }
        },
        "included": {
            "items": [
              ...]
        }
    }
    

    POST Create Checkout with Account Management Authentication Token

    The shopper authenticates with the Implicit Token and the EP-Account-Management-Authentication-Token.

    https://useast.api.elasticpath.com/v2/carts/:reference/checkout
    

    Parameters

    Path parameters

    NameRequiredTypeDescription
    referenceRequiredstringThe reference to the cart that you want to check out.

    Headers

    NameRequiredTypeDescription
    EP-Account-Management-Authentication-TokenRequiredstringAn account management authentication token that identifies the authenticated account member.
    AuthorizationRequiredstringThe Bearer token required to get access to the API. Set the grant type to client_credentials if account management authentication token is unavailable.

    Body

    NameRequiredTypeDescription
    contact.nameRequiredstringThe name of the contact.
    contact.emailRequiredstringThe email address of the contact.

    Request example

    curl -X POST https://useast.api.elasticpath.com/v2/carts/:reference/checkout \
         -H "Authorization: Bearer XXXX" \
         -H "EP-Account-Management-Authentication-Token: XXXX"
        -d $'{
        "data": {
          "contact": {
            "name": "John Doe",
            "email": "johndoe@email.com"
          },
          "billing_address": {
            ...
          },
          "shipping_address": {
            ...
          }
        }
      }'
    

    Response example

    201 Created

    {
        "data": {
            "id": "74b48ecb-8599-4c63-85a8-09cb9bb7ee39",
            "type": "order",
            "status": "incomplete",
            "payment": "unpaid",
            "shipping": "unfulfilled",
            "contact": {
                "name": "John Doe",
                "email": "johndoe@email.com"
            },
            "shipping_address": {
               ...
            },
            "billing_address": {
               ...
            },
            "links": {},
            "meta": {
                ...
            },
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "d9f30f2f-9973-45d7-a6c9-360be52a26b0"
                        }
                    ]
                },
                "account": {
                    "data": {
                        "type": "account",
                        "id": "b6e47478-7e7f-4127-b7e9-4a255564ae68"
                    }
                },
                "account_member": {
                    "data": {
                        "type": "account_member",
                        "id": "338f84bf-e6c9-4704-9f33-2708addd463a"
                    }
                }
            }
        },
        "included": {
            "items": [
              ...]
        }
    }
    
    Previous
    Checkout API