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

# Complete Order

> Completes checkout for Full Cart API with advanced features

## Overview

Completes the checkout process for carts using the Full Cart API. This endpoint supports advanced cart features including shipments, addons, and complex product configurations.

## Authentication

**x-firmly-authorization** `string` *required*

Device authentication token from Browser Session

## Path Parameters

**domain** `string` *required*

The merchant domain (e.g., "staging.luma.gift")

## Request Body

**encrypted\_card** `string` *required*

JWE-encrypted credit card data using the public key from [Get Public Key](https://firmly.mintlify.site/api-reference/payment/get-public-key.md) endpoint

**billing\_info** `object` *required*

Billing address information

**Required fields:**

* `first_name` (string): Customer's first name
* `last_name` (string): Customer's last name
* `email` (string): Email address
* `phone` (string): Phone number
* `address1` (string): Primary address line
* `city` (string): City name
* `state_or_province` (string): State/province code
* `country` (string): Country name or code
* `postal_code` (string): ZIP or postal code

**Optional fields:**

* `address2` (string): Secondary address line
* `company` (string): Company name

**captcha\_token** `string`

Captcha verification token when required by merchant

## Response

Returns an order confirmation with Full Cart API structure including:

**platform\_order\_number** `string`

The order number from the merchant

**cart\_id** `string`

Unique identifier for the cart

**line\_items** `array`

Detailed array of items with variant information

**shipments** `array`

Shipment groups with fulfillment details

**addons** `object`

Selected addon services and their pricing

**total** `object`

Final order total including all fees

## Credit Card Encryption

The credit card must be encrypted as a JWE token with the following structure:

```json theme={null}
{
  "number": "4111111111111111",
  "name": "John Smith",
  "verification_value": "123",
  "month": "08",
  "year": "2025"
}
```

## Code Example

```javascript theme={null}
// Complete order for Full Cart API
const response = await fetch('https://cc.firmly.work/api/v2/payment/domains/staging.luma.gift/complete-order', {
  method: 'POST',
  headers: {
    'x-firmly-authorization': authToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    encrypted_card: encryptedCard,
    billing_info: {
      first_name: 'John',
      last_name: 'Smith',
      email: 'john@staging.luma.gift',
      phone: '2065551212',
      address1: '123 Main St',
      city: 'Seattle',
      state_or_province: 'WA',
      country: 'US',
      postal_code: '98101'
    }
  })
});

const order = await response.json();
```

## Prerequisites

Before calling this endpoint:

1. Cart must have at least one item
2. All shipments must have shipping information set
3. Required addons (if any) must be selected
4. Tax calculations must be current

## Error Responses

| Code | Description |
| - | - |
| `ErrorInvalidInputBody` | Request validation failed |
| `ErrorMissingRequiredParameters` | Cart missing required data |
| `ErrorCartNotFound` | No cart found for domain |
| `ErrorPaymentDeclined` | Payment was declined |
| `ErrorStoreUnavailable` | Merchant temporarily unavailable |

## Related Endpoints

* [Get Public Key](https://firmly.mintlify.site/api-reference/payment/get-public-key.md) - Get encryption key
* [Set Shipping Info](https://firmly.mintlify.site/api-reference/checkout/set-shipping-info.md) - Add delivery address
* [Add Line Item](https://firmly.mintlify.site/api-reference/cart-management/add-line-item.md) - Add products to cart
* [Add Addon](https://firmly.mintlify.site/api-reference/addon-management/add-addon.md) - Select addon services


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.