Skip to content

Checkout API

Handle the checkout process including placing orders, retrieving checkout summaries, shipping method availability, and user login.

Base URL: https://your-site.com/wp-json/fluent-cart/v2

Policy: PublicPolicy (no authentication required for most endpoints)

These are public-facing endpoints used by the storefront checkout flow. All monetary values are in cents (e.g., $10.00 = 1000).


Checkout

Place Order

POST /fluent-cart/v2/checkout/place-order

Submit a checkout order with billing/shipping details and payment method. This endpoint validates the cart, creates a customer (or matches an existing one), creates a draft order, and initiates the payment flow with the selected gateway.

  • Authentication: Optional (logged-in users have their email and name auto-populated)
  • Rate Limit: 5 requests per 60 seconds per IP/user

Parameters

ParameterTypeLocationRequiredDescription
billing_emailstringbodyYesCustomer email address. Auto-populated for logged-in users
billing_full_namestringbodyConditionalFull name of the customer. Required when the store uses full name mode. Auto-populated for logged-in users if available
billing_first_namestringbodyConditionalCustomer first name. Required when the store uses separate first/last name mode
billing_last_namestringbodyConditionalCustomer last name. Required when the store uses separate name mode and last name is configured as required
billing_countrystringbodyConditionalISO country code (e.g., US, GB). Required based on checkout field configuration. Defaults to store country if not provided
billing_address_1stringbodyConditionalStreet address line 1. Required based on checkout field configuration
billing_address_2stringbodyNoStreet address line 2 (apt, suite, unit)
billing_citystringbodyConditionalCity name. Required based on checkout field configuration
billing_statestringbodyConditionalState/province code. Required if the selected country has states
billing_postcodestringbodyConditionalPostal/ZIP code. Required based on checkout field configuration
billing_phonestringbodyNoPhone number
billing_tax_idstringbodyNoCustomer tax ID / VAT number
billing_address_idintegerbodyNoID of a saved customer billing address (for returning customers)
ship_to_differentstringbodyNoSet to yes to use a different shipping address. Default: no
shipping_full_namestringbodyConditionalShipping recipient name. Required when ship_to_different is yes
shipping_countrystringbodyConditionalShipping country code. Required when ship_to_different is yes
shipping_address_1stringbodyConditionalShipping street address. Required when ship_to_different is yes
shipping_address_2stringbodyNoShipping address line 2
shipping_citystringbodyConditionalShipping city. Required when ship_to_different is yes
shipping_statestringbodyConditionalShipping state/province code
shipping_postcodestringbodyConditionalShipping postal code
shipping_phonestringbodyNoShipping phone number
shipping_address_idintegerbodyNoID of a saved customer shipping address
fc_selected_shipping_methodintegerbodyConditionalID of the selected shipping method. Required for orders containing physical products
payment_methodstringbodyYesPayment gateway slug (e.g., stripe, paypal, cod, square)
order_notesstringbodyNoOptional order notes from the customer. Max 200 characters
agree_termsstringbodyConditionalTerms agreement flag. Required if terms acceptance is enabled in store settings
allow_create_accountstringbodyNoSet to yes to create a WordPress user account (when store setting is user_choice)
user_tzstringbodyNoCustomer timezone (e.g., America/New_York). Default: UTC

Response (Success — 200)

The response varies by payment gateway. Common patterns include:

Redirect-based gateways (PayPal, hosted Stripe checkout):

json
{
  "status": "success",
  "redirect_url": "https://checkout.stripe.com/pay/cs_...",
  "message": "Order placed successfully"
}

On-site gateways (Stripe Elements):

json
{
  "status": "success",
  "payment_args": {
    "client_secret": "pi_..._secret_...",
    "checkout_mode": "onsite"
  },
  "order_id": 42,
  "message": "Order placed successfully"
}

Free / COD orders:

json
{
  "status": "success",
  "redirect_url": "https://your-site.com/checkout/order-received/?order=abc123",
  "message": "Order placed successfully"
}

Error Responses

Empty/completed cart (200):

json
{
  "status": "failed",
  "message": "Cart is empty or already completed"
}

Validation errors (200):

json
{
  "status": "failed",
  "errors": {
    "billing_email": {
      "invalid": "Email must be a valid email address."
    },
    "billing_country": {
      "required": "Country is required."
    },
    "shipping_method": {
      "required": "You must select a shipping method."
    }
  }
}

Product validation failure (422):

json
{
  "message": "Product is out of stock"
}

Duplicate order (200):

json
{
  "status": "failed",
  "message": "You have already completed this order."
}

Rate limit exceeded (429):

json
{
  "message": "Too many requests. Please try again later."
}

Example

bash
curl -X POST "https://example.com/wp-json/fluent-cart/v2/checkout/place-order" \
  -H "Content-Type: application/json" \
  -H "X-WP-Nonce: your_nonce_here" \
  -d '{
    "billing_email": "[email protected]",
    "billing_full_name": "John Doe",
    "billing_country": "US",
    "billing_address_1": "123 Main St",
    "billing_city": "New York",
    "billing_state": "NY",
    "billing_postcode": "10001",
    "payment_method": "stripe",
    "user_tz": "America/New_York"
  }'

Get Order Info

GET /fluent-cart/v2/checkout/get-order-info

Retrieve payment-gateway-specific order information needed by the frontend to initialize payment UI elements. This is typically called after the checkout page loads to set up payment forms (e.g., Stripe Elements configuration, PayPal button setup).

  • Authentication: Optional

Parameters

ParameterTypeLocationRequiredDescription
methodstringqueryYesPayment gateway slug (e.g., stripe, paypal, square, airwallex)

Response (Success — 200)

The response structure is gateway-specific. Example for Stripe:

Stripe (hosted mode):

json
{
  "status": "success",
  "message": "Order info retrieved!",
  "data": [],
  "payment_args": {
    "checkout_mode": "hosted"
  }
}

Stripe (on-site mode):

json
{
  "status": "success",
  "message": "Order info retrieved!",
  "data": {
    "client_secret": "seti_..._secret_...",
    "publishable_key": "pk_live_..."
  },
  "payment_args": {
    "checkout_mode": "onsite",
    "appearance": {
      "theme": "stripe"
    }
  }
}

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-order-info?method=stripe"

Get Checkout Summary

GET /fluent-cart/v2/checkout/get-checkout-summary-view

Retrieve a rendered HTML summary of the current cart along with pricing totals. Used to dynamically update the checkout page when the customer changes shipping methods or other options.

  • Authentication: Optional (cart is identified by session/cookie)

Parameters

ParameterTypeLocationRequiredDescription
shipping_method_idintegerqueryNoID of the selected shipping method to include its charge in the totals

Response (Success — 200)

json
{
  "items": {
    "views": "<div class=\"fct-checkout-items\">...rendered HTML...</div>",
    "subtotal": "$50.00",
    "has_subscriptions": false,
    "shipping_charge": 500,
    "unformatted_total": 5500,
    "total": "$55.00",
    "shipping_charge_formated": "$5.00",
    "shipping_method_id": "3"
  }
}

Response Fields

FieldTypeDescription
items.viewsstring (HTML)Server-rendered HTML of the cart item list for the checkout page
items.subtotalstringFormatted subtotal of all cart items (before shipping)
items.has_subscriptionsbooleanWhether the cart contains subscription products
items.shipping_chargeintegerShipping charge in cents
items.unformatted_totalintegerGrand total in cents (subtotal + shipping)
items.totalstringFormatted grand total string
items.shipping_charge_formatedstringFormatted shipping charge string
items.shipping_method_idstringThe shipping method ID used for calculation

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-checkout-summary-view?shipping_method_id=3"

Get Available Shipping Methods

GET /fluent-cart/v2/checkout/get-available-shipping-methods

Retrieve shipping methods available for a given country and state. The country can be auto-detected from the customer's timezone or provided directly via country code.

  • Authentication: Not required

Parameters

ParameterTypeLocationRequiredDescription
timezonestringqueryConditionalIANA timezone string (e.g., America/New_York, Europe/London). Used to auto-detect the country. Either timezone or country_code must be provided
country_codestringqueryConditionalISO 3166-1 alpha-2 country code (e.g., US, GB). Used when timezone is not provided
statestringqueryNoState/province code to further filter applicable shipping methods

Response (Success — 200)

json
{
  "available_shipping_methods": [
    {
      "id": 1,
      "title": "Standard Shipping",
      "charge_type": "flat_rate",
      "charge_amount": 500,
      "status": "active",
      "countries": ["US", "CA"],
      "states": []
    },
    {
      "id": 2,
      "title": "Express Shipping",
      "charge_type": "flat_rate",
      "charge_amount": 1500,
      "status": "active",
      "countries": ["US"],
      "states": ["NY", "CA"]
    }
  ],
  "country_code": "US"
}

Error Responses

Missing country (200):

json
{
  "status": false,
  "message": "Country code is required"
}

No methods available (200):

json
{
  "status": false,
  "country_code": "XX",
  "view": "<div class=\"fct-empty-state\">No shipping methods available for this address.</div>"
}

Note: When the current user is a WordPress admin, the view field in the "no methods" response includes a link to the shipping settings page.

Example

bash
# Using timezone auto-detection
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-available-shipping-methods?timezone=America/New_York"

# Using explicit country code
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-available-shipping-methods?country_code=US&state=NY"

Get Shipping Methods List View

GET /fluent-cart/v2/checkout/get-shipping-methods-list-view

Retrieve a server-rendered HTML view of available shipping methods for the checkout page. This endpoint wraps get-available-shipping-methods and returns a pre-rendered HTML list suitable for direct insertion into the checkout form.

  • Authentication: Not required

Parameters

ParameterTypeLocationRequiredDescription
timezonestringqueryConditionalIANA timezone string (e.g., America/New_York). Used to auto-detect the country. Either timezone or country_code must be provided
country_codestringqueryConditionalISO 3166-1 alpha-2 country code (e.g., US, GB). Used when timezone is not provided
statestringqueryNoState/province code to further filter applicable shipping methods

Response (Success — 200)

json
{
  "data": {
    "status": true,
    "view": "<div class=\"fct-shipping-methods\">...rendered shipping method list HTML...</div>",
    "country_code": "US"
  }
}

Error Responses

Returns the same error responses as Get Available Shipping Methods when no country is provided or no methods are available for the given location.

No methods available (200):

json
{
  "status": false,
  "country_code": "XX",
  "view": "<div class=\"fct-empty-state\">No shipping methods available for this address.</div>"
}

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-shipping-methods-list-view?country_code=US&state=CA"

Get Country Info

GET /fluent-cart/v2/checkout/get-country-info

Retrieve localization details for a country including available states/provinces and address field configuration. Used by the checkout form to dynamically adjust address fields based on the selected country.

  • Authentication: Not required

Parameters

ParameterTypeLocationRequiredDescription
timezonestringqueryConditionalIANA timezone string (e.g., Asia/Tokyo). Used to auto-detect the country. Either timezone or country_code must be provided
country_codestringqueryConditionalISO 3166-1 alpha-2 country code (e.g., US, JP). Used when timezone is not provided

Response (Success — 200)

json
{
  "data": {
    "country_code": "US",
    "states": [
      { "label": "Alabama", "value": "AL" },
      { "label": "Alaska", "value": "AK" },
      { "label": "California", "value": "CA" },
      { "label": "New York", "value": "NY" }
    ],
    "address_locale": {
      "state": {
        "label": "State",
        "required": true
      },
      "postcode": {
        "label": "ZIP Code",
        "required": true
      },
      "city": {
        "label": "City",
        "required": true
      }
    }
  }
}

Response Fields

FieldTypeDescription
data.country_codestringThe resolved ISO country code
data.statesarrayList of state/province options with label and value. Empty array if the country has no states
data.address_localeobjectCountry-specific address field labels and requirements (e.g., "State" vs "Province", "ZIP Code" vs "Postal Code")

Example

bash
# Auto-detect from timezone
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-country-info?timezone=America/Chicago"

# Explicit country code
curl -X GET "https://example.com/wp-json/fluent-cart/v2/checkout/get-country-info?country_code=CA"

User Authentication

Login

POST /fluent-cart/v2/user/login

Authenticate a user during the checkout process. On success, sets the WordPress authentication cookie and returns a redirect URL to the customer profile page.

  • Authentication: Requires a valid WordPress REST API nonce (X-WP-Nonce header)
  • Policy: PublicPolicy

Parameters

ParameterTypeLocationRequiredDescription
user_loginstringbodyYesWordPress username or email address
passwordstringbodyYesAccount password
remember_mestringbodyNoSet to on to persist the login session ("Remember Me"). Default: not remembered

Headers

HeaderRequiredDescription
X-WP-NonceYesWordPress REST API nonce for wp_rest action. Required to prevent CSRF attacks

Response (Success — 200)

json
{
  "success": true,
  "data": {
    "message": "Login successful",
    "redirect_url": "https://your-site.com/customer-profile/#/profile"
  }
}

Error Responses

Invalid nonce (403):

json
{
  "message": "Invalid security token. Please refresh the page and try again.",
  "code": "invalid_nonce"
}

Missing username (400):

json
{
  "success": false,
  "data": {
    "message": "Email or username is required",
    "code": "missing_login"
  }
}

Missing password (400):

json
{
  "success": false,
  "data": {
    "message": "Password is required",
    "code": "missing_password"
  }
}

Invalid credentials (401):

json
{
  "success": false,
  "data": {
    "message": "The password you entered for the username [email protected] is incorrect.",
    "code": "login_failed"
  }
}

Example

bash
curl -X POST "https://example.com/wp-json/fluent-cart/v2/user/login" \
  -H "Content-Type: application/json" \
  -H "X-WP-Nonce: your_nonce_here" \
  -d '{
    "user_login": "[email protected]",
    "password": "securepassword123",
    "remember_me": "on"
  }'

Note: The X-WP-Nonce is typically generated by WordPress on the checkout page and is available to frontend JavaScript. It is required for this endpoint to function correctly.

FluentCart developer documentation