Checkout REST API

Routes

POST /wp-json/awecommerce/v1/checkout/quote
POST /wp-json/awecommerce/v1/checkout/location
POST /wp-json/awecommerce/v1/checkout/create
POST /wp-json/awecommerce/v1/checkout/capture
POST /wp-json/awecommerce/v1/checkout/confirm
POST /wp-json/awecommerce/v1/checkout/confirm-paymongo
POST /wp-json/awecommerce/v1/checkout/confirm-adyen
POST /wp-json/awecommerce/v1/checkout/confirm-paypal-subscription
GET  /wp-json/awecommerce/v1/checkout/return/{gateway}

Checkout routes are public at the REST permission layer. Validation, gateway verification, completion tokens, and server-authoritative totals protect the flow.

Quote Request

curl -X POST "https://store.example.com/wp-json/awecommerce/v1/checkout/quote" \
  -H "Content-Type: application/json" \
  -d '{
    "cart": [
      { "price_id": 101, "quantity": 1 }
    ],
    "currency": "USD",
    "gateway": "stripe",
    "coupon": "LAUNCH25",
    "customer": {
      "email": "buyer@example.com",
      "first_name": "Ada",
      "last_name": "Lovelace"
    },
    "billing_address": {
      "country": "US",
      "state": "CA",
      "postal_code": "94105"
    }
  }'

Create Checkout

curl -X POST "https://store.example.com/wp-json/awecommerce/v1/checkout/create" \
  -H "Content-Type: application/json" \
  -H "X-WP-Nonce: NONCE_FROM_PAGE" \
  -d '{
    "cart": [
      { "price_id": 101, "quantity": 1 }
    ],
    "currency": "USD",
    "gateway": "stripe",
    "customer": {
      "email": "buyer@example.com",
      "first_name": "Ada",
      "last_name": "Lovelace"
    },
    "accepted_agreements": [
      { "agreement_id": "terms", "version": "2026-06-01" }
    ]
  }'

Stripe Confirm

curl -X POST "https://store.example.com/wp-json/awecommerce/v1/checkout/confirm" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": 5001,
    "payment_intent_id": "pi_123",
    "checkout_completion_token": "token-from-create-response"
  }'

Stripe Setup Intent Confirm

curl -X POST "https://store.example.com/wp-json/awecommerce/v1/checkout/confirm" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": 5001,
    "setup_intent_id": "seti_123",
    "checkout_completion_token": "token-from-create-response"
  }'

PayPal Capture

curl -X POST "https://store.example.com/wp-json/awecommerce/v1/checkout/capture" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": 5001,
    "checkout_completion_token": "token-from-create-response"
  }'

Location Hint

curl -X POST "https://store.example.com/wp-json/awecommerce/v1/checkout/location"

JavaScript Quote Example

async function getQuote(priceId) {
  const response = await fetch('/wp-json/awecommerce/v1/checkout/quote', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      cart: [{ price_id: priceId, quantity: 1 }],
      currency: 'USD',
      gateway: 'stripe',
      customer: {
        email: 'buyer@example.com'
      }
    })
  });

  if (!response.ok) {
    throw new Error(`Quote failed: ${response.status}`);
  }

  return response.json();
}

Checkout Hooks

add_filter('awecommerce_checkout_before_create', function ($quote, $request) {
    return $quote;
}, 10, 2);

add_action('awecommerce_checkout_after_create', function ($result) {
    error_log('Checkout created.');
});

add_filter('awecommerce_checkout_capture_return', function ($default_url, $order, $gateway) {
    return $default_url;
}, 10, 3);

Was this documentation helpful?