Portal routes require a logged-in WordPress user linked to an AweCommerce customer.
Routes
GET /wp-json/awecommerce/v1/portal/me
PATCH|PUT /wp-json/awecommerce/v1/portal/profile
DELETE /wp-json/awecommerce/v1/portal/profile/pending-email
GET /wp-json/awecommerce/v1/portal/orders
GET /wp-json/awecommerce/v1/portal/orders/{id}
GET /wp-json/awecommerce/v1/portal/subscriptions
GET /wp-json/awecommerce/v1/portal/subscriptions/{id}
POST /wp-json/awecommerce/v1/portal/subscriptions/{id}/cancel
POST /wp-json/awecommerce/v1/portal/subscriptions/{id}/pause
POST /wp-json/awecommerce/v1/portal/subscriptions/{id}/resume
GET /wp-json/awecommerce/v1/portal/licenses
GET /wp-json/awecommerce/v1/portal/licenses/{id}
POST /wp-json/awecommerce/v1/portal/licenses/{id}/reveal-key
POST /wp-json/awecommerce/v1/portal/licenses/{id}/rotate-key
GET /wp-json/awecommerce/v1/portal/licenses/{id}/domains
POST /wp-json/awecommerce/v1/portal/licenses/{id}/domains/deactivate
GET /wp-json/awecommerce/v1/portal/addresses
POST /wp-json/awecommerce/v1/portal/addresses
PATCH|PUT /wp-json/awecommerce/v1/portal/addresses/{id}
DELETE /wp-json/awecommerce/v1/portal/addresses/{id}
POST /wp-json/awecommerce/v1/portal/addresses/{id}/default
GET /wp-json/awecommerce/v1/portal/payment-methods
POST /wp-json/awecommerce/v1/portal/payment-methods/update-link
POST /wp-json/awecommerce/v1/portal/payment-methods/setup-intent
POST /wp-json/awecommerce/v1/portal/payment-methods/confirm-setup
POST /wp-json/awecommerce/v1/portal/payment-methods/{id}/default
POST /wp-json/awecommerce/v1/portal/payment-methods/{id}/disable
GET /wp-json/awecommerce/v1/portal/downloads/{id}/download
GET /wp-json/awecommerce/v1/portal/invoices
GET /wp-json/awecommerce/v1/portal/invoices/{id}
GET /wp-json/awecommerce/v1/portal/invoices/{id}/download
Request Helper
async function portalRequest(path, options = {}) {
const response = await fetch(`/wp-json/awecommerce/v1${path}`, {
credentials: 'same-origin',
...options,
headers: {
'Content-Type': 'application/json',
'X-WP-Nonce': window.wpApiSettings.nonce,
...(options.headers || {})
}
});
const data = await response.json().catch(() => null);
if (!response.ok) {
throw new Error(data?.message || `Portal request failed: ${response.status}`);
}
return data;
}
Update Profile
await portalRequest('/portal/profile', {
method: 'PATCH',
body: JSON.stringify({
first_name: 'Ada',
last_name: 'Lovelace',
email: 'ada@example.com'
})
});
Create Address
curl -X POST "https://store.example.com/wp-json/awecommerce/v1/portal/addresses" \
-H "Content-Type: application/json" \
-H "X-WP-Nonce: CUSTOMER_REST_NONCE" \
-d '{
"type": "billing",
"name": "Ada Lovelace",
"line1": "123 Example Street",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
}'
Cancel Subscription
curl -X POST "https://store.example.com/wp-json/awecommerce/v1/portal/subscriptions/33/cancel" \
-H "Content-Type: application/json" \
-H "X-WP-Nonce: CUSTOMER_REST_NONCE" \
-d '{ "at_period_end": true }'
Deactivate License Domain
curl -X POST "https://store.example.com/wp-json/awecommerce/v1/portal/licenses/77/domains/deactivate" \
-H "Content-Type: application/json" \
-H "X-WP-Nonce: CUSTOMER_REST_NONCE" \
-d '{
"site_uuid": "site-uuid",
"normalized_domain": "old-site.example",
"install_uuid": "install-uuid"
}'
Download Invoice
curl -L "https://store.example.com/wp-json/awecommerce/v1/portal/invoices/22/download?format=pdf" \
-H "X-WP-Nonce: CUSTOMER_REST_NONCE" \
-o invoice.pdf
Error Mapping
Portal errors map to:
401 Not authenticated
403 Forbidden
404 Missing or non-owned resource
400 Request could not be completed
500 Unexpected failure
Use 404 for non-owned resources to avoid ownership leaks.