Settings API
The Settings controller (api/settings.php, base settings) reads store settings and updates payment gateway configuration. It extends WP_REST_Controller directly (not the StoreEngine base controller).
Authentication
Admin only — Helper::check_rest_user_cap( 'manage_options' ). See Authentication.
Routes
| Method | Path | Purpose |
|---|---|---|
| GET | /settings | Read store settings |
| PUT/PATCH | /settings/payment-gateways | Update gateway config |
| PUT/PATCH | /settings/verify-payment-gateways | Verify gateway credentials |
All paths are relative to /wp-json/storeengine/v1.
GET /settings
GET /wp-json/storeengine/v1/settings
Returns the store settings object (store identity, currency, pages, checkout options, and so on).
curl https://your-store.example/wp-json/storeengine/v1/settings \
-u "admin:APPLICATION_PASSWORD"
PUT/PATCH /settings/payment-gateways
PUT /wp-json/storeengine/v1/settings/payment-gateways
Updates payment gateway settings. Each gateway declares its own fields (text, password, checkbox, safe-text, etc.), and the endpoint validates and sanitizes each field against that declared type.
| Param | Type | Required | Notes |
|---|---|---|---|
config | object | yes | Gateway settings keyed by field. |
context | string | no | Sanitization context; default edit. |
curl -X PUT https://your-store.example/wp-json/storeengine/v1/settings/payment-gateways \
-u "admin:APPLICATION_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"config": {
"stripe": { "is_production": true, "publishable_key": "pk_live_…", "secret_key": "sk_live_…" }
}
}'
The precise config schema is generated from the registered gateways; inspect it with an OPTIONS request against the route.
PUT/PATCH /settings/verify-payment-gateways
PUT /wp-json/storeengine/v1/settings/verify-payment-gateways
Verifies a gateway's credentials without persisting them — the "Test connection" action.
| Param | Type | Required | Notes |
|---|---|---|---|
method | string | yes | Gateway id to verify (e.g. stripe). |
config | object | yes | The credentials to test. |
context | string | no | Default edit. |
curl -X PUT https://your-store.example/wp-json/storeengine/v1/settings/verify-payment-gateways \
-u "admin:APPLICATION_PASSWORD" \
-H "Content-Type: application/json" \
-d '{ "method": "stripe", "config": { "secret_key": "sk_test_…" } }'
Related
- Payments API — read gateway metadata.
- Payment gateways reference
- Settings API guide for addons — how addons register their own settings.