WooCommerce Redsys Gateway REST API
A REST API for querying transactions, managing tokens, and automating payment workflows from external systems.
Overview
The WooCommerce Redsys Gateway Premium plugin exposes two complementary machine-to-machine surfaces on top of the same signed Redsys pipeline that powers a normal checkout (PSD2/SCA on the shopper side, signed IPN on the bank side). Every automated payment still ends in a real WooCommerce order.
| Surface | What it is | Namespace |
|---|---|---|
| A2A (Agent2Agent) | A JSON-RPC 2.0 surface that lets an authenticated AI agent or backend client create, capture, refund, query and tokenize payments. | wc-redsys-a2a/v1 |
| UCP (Universal Commerce Protocol) | A RESTful commerce surface: catalog discovery, cart and checkout sessions, orders, refunds and webhooks for agentic shopping flows. | redsys-ucp/v1 |
Both surfaces ship off by default and must be enabled by the merchant under WooCommerce → Settings → Redsys Advanced → Agentic Commerce. Until enabled, the endpoints return a service-unavailable error while the public discovery documents (Agent Card, UCP manifest) stay reachable so a client can still discover the surface.
There are also two internal namespaces — redsys-acp/v1 (Agentic Commerce Protocol bridge) and redsys-app/v1 (mobile/app helper routes). They follow the same OAuth model and are not covered endpoint-by-endpoint here.
Base URLs & namespaces
All REST routes are served from your store's WordPress REST root under the plugin namespaces. Discovery documents are additionally published at well-known paths at the site root.
# A2A (JSON-RPC)
https://your-store.com/wp-json/wc-redsys-a2a/v1/
# UCP (REST) — canonical namespace
https://your-store.com/wp-json/redsys-ucp/v1/
# UCP OAuth 2.1 authorization server
https://your-store.com/wp-json/redsys-ucp/oauth/v1/
# Well-known discovery documents
https://your-store.com/.well-known/agent-card.json
https://your-store.com/.well-known/ucp.json
https://your-store.com/.well-known/oauth-authorization-server
For convenience, several UCP capabilities are also registered under capability-scoped aliases (for example redsys-ucp/checkout/v1, redsys-ucp/catalog/v1, redsys-ucp/orders/v1) that mirror the canonical redsys-ucp/v1 routes. Prefer the canonical namespace shown throughout this page.
Authentication
Both surfaces authenticate with OAuth 2.1 + PKCE bearer tokens issued by the UCP authorization server bundled in the same plugin. There are no static API keys. A token is sent on every request in the Authorization: Bearer header.
| Method | Path | Description |
|---|---|---|
| GET POST | /wp-json/redsys-ucp/oauth/v1/authorize | Authorization endpoint (authorization-code + PKCE flow) |
| POST | /wp-json/redsys-ucp/oauth/v1/token | Exchange an authorization code (or refresh) for an access token |
| POST | /wp-json/redsys-ucp/oauth/v1/register | Dynamic client registration (RFC 7591) |
| POST | /wp-json/redsys-ucp/oauth/v1/introspect | Token introspection (RFC 7662) |
| POST | /wp-json/redsys-ucp/oauth/v1/revoke | Token revocation (RFC 7009) |
| GET | /.well-known/oauth-authorization-server | Authorization server metadata (RFC 8414) |
| GET | /.well-known/oauth-protected-resource | Protected resource metadata |
Register a client dynamically, then run the standard authorization-code + PKCE flow. A2A clients must register with a client_type beginning with a2a_; the server then issues a client_id of the form a2a_… and a one-time client_secret. A2A tokens carry a2a:payments:* scopes; a UCP-flavored token is rejected on the A2A surface and vice-versa — the surfaces are isolated on purpose.
POST /wp-json/redsys-ucp/oauth/v1/register
{
"client_name": "Concierge Bot",
"client_type": "a2a_concierge",
"redirect_uris": ["https://bot.example/oauth/callback"],
"scopes": ["a2a:payments:read", "a2a:payments:create"]
}
curl https://your-store.com/wp-json/redsys-ucp/v1/discovery \
-H 'Authorization: Bearer <access_token>' \
-H 'Accept: application/json'
| Scope | Allows |
|---|---|
a2a:payments:read | query_payment_status, list_payments, read-only tasks/get |
a2a:payments:create | create_payment |
a2a:payments:capture | capture_payment (post-authorization capture) |
a2a:payments:refund | refund_payment |
a2a:payments:tokenize | tokenize_card, recurrent_charge |
Scopes are matched exactly — a2a:payments:create does not imply a2a:payments:read. Every A2A request passes a five-gate chain: authenticate, authorize (scope), IP whitelist, hours window and per-client rate limit (default 60/min, 600/hour, 5000/day). A sandbox bearer credential is available for local testing but only resolves when WP_DEBUG is true and the merchant has explicitly enabled it; it is never honored on a production install.
A2A — Agent2Agent
A2A is a JSON-RPC 2.0 surface. Discovery is via the Agent Card; every operation is a single POST to the /rpc endpoint; long-running tasks report progress over Server-Sent Events.
| Method | Path | Description |
|---|---|---|
| GET | /.well-known/agent-card.json | Public Agent Card. No auth. Cacheable (ETag, max-age 300) |
| GET | /wp-json/wc-redsys-a2a/v1/agent-card | Extended Agent Card (auth required) including private skills |
| POST | /wp-json/wc-redsys-a2a/v1/rpc | JSON-RPC 2.0 endpoint for all skill invocations |
| GET | /wp-json/wc-redsys-a2a/v1/tasks/{taskId}/stream | SSE stream for a task. Resumable with Last-Event-ID |
| GET | /wp-json/wc-redsys-a2a/v1/sca/return/{taskId} | Public browser callback after the shopper completes SCA |
JSON-RPC 2.0 transport. The method selects the RPC verb; for tasks/send and tasks/sendSubscribe the params.skill_id selects the operation. Amounts are always integer cents (1500 = 15,00 EUR); currency codes are uppercase ISO-4217.
| Method | Purpose |
|---|---|
tasks/send | Invoke a skill. Returns a task. |
tasks/sendSubscribe | Invoke a skill and return a stream_url to subscribe to. |
tasks/get | Look up a task by id. |
tasks/cancel | Cancel a non-terminal task. |
agent/listSkills | List the skills the bearer is allowed to invoke. |
| skill_id | Required scope | Description |
|---|---|---|
query_payment_status | a2a:payments:read | Look up a payment by A2A payment_id or wc_order_id |
list_payments | a2a:payments:read | List payments with filters |
create_payment | a2a:payments:create | Provision a pending order; returns an SCA redirect URL |
capture_payment | a2a:payments:capture | Capture a previously pre-authorized payment |
refund_payment | a2a:payments:refund | Full or partial refund |
tokenize_card | a2a:payments:tokenize | Store a reusable card token |
recurrent_charge | a2a:payments:tokenize | Charge a stored token |
POST /wp-json/wc-redsys-a2a/v1/rpc
Authorization: Bearer <token>
{
"jsonrpc": "2.0",
"id": 1,
"method": "tasks/send",
"params": {
"skill_id": "create_payment",
"input": {
"amount": 1250,
"currency": "EUR",
"order_reference": "ORDER-2026-001",
"mode": "redirect"
},
"idempotency_key": "5d1c…"
}
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"task_id": "b9b3f9a4-…",
"state": "input-required",
"artifacts": {
"sca_redirect_url": "https://your-store.com/checkout/order-pay/…"
}
}
}
A task walks a strict state machine: submitted → working → input-required → completed | failed | canceled. The shopper completes SCA on the redirect URL exactly as a normal customer; the signed Redsys IPN settles the order and the webhook glue mirrors the result onto the task. Successful calls and business errors both use HTTP 200 with a JSON-RPC envelope; transport rejections (missing bearer, rate limit) use HTTP 401/429 and still carry a JSON-RPC error.
UCP — discovery
The UCP manifest advertises the supported capabilities, their spec/schema URIs and the OAuth authorization server. Discovery requires no authentication.
| Method | Path | Description |
|---|---|---|
| GET | /.well-known/ucp.json | UCP manifest (also served at /.well-known/ucp) |
| GET | /wp-json/redsys-ucp/v1/discovery | UCP capability discovery document |
| POST | /wp-json/redsys-ucp/v1/negotiate | Negotiate capability versions and the preferred transport |
UCP — catalog & products
Read-only catalog discovery for agentic shopping. Product ids are WooCommerce product ids. A pre-built JSON product feed is available for bulk ingestion.
| Method | Path | Description |
|---|---|---|
| GET | /wp-json/redsys-ucp/v1/catalog/search | Search the catalog |
| GET | /wp-json/redsys-ucp/v1/catalog/{id} | Look up a single catalog item |
| GET | /wp-json/redsys-ucp/v1/products | List products |
| GET | /wp-json/redsys-ucp/v1/products/{id} | Retrieve a single product |
| GET | /wp-json/redsys-ucp/v1/products/feed.json | Full product feed (JSON) |
| GET | /wp-json/redsys-ucp/v1/products/feed/manifest | Feed manifest (chunking / freshness metadata) |
Search products for an agent. Parameters below are typical; the exact accepted set follows the UCP catalog search schema advertised in the discovery document.
| Name | Type | Description |
|---|---|---|
q | string | Free-text query (example) |
limit | int | Maximum results to return (example) |
UCP — cart sessions
A cart session holds line items before checkout. Create one, then read or update it by id.
| Method | Path | Description |
|---|---|---|
| POST | /wp-json/redsys-ucp/v1/cart-sessions | Create a cart session |
| GET | /wp-json/redsys-ucp/v1/cart-sessions/{id} | Retrieve a cart session |
| PUT | /wp-json/redsys-ucp/v1/cart-sessions/{id} | Update line items / quantities |
UCP — checkout sessions
A checkout session turns a cart into a payable order. Complete it to trigger the signed Redsys payment, or cancel it. The same routes are also exposed under the generic /sessions alias.
| Method | Path | Description |
|---|---|---|
| POST | /wp-json/redsys-ucp/v1/checkout-sessions | Create a checkout session |
| GET | /wp-json/redsys-ucp/v1/checkout-sessions/{id} | Retrieve a checkout session |
| PUT | /wp-json/redsys-ucp/v1/checkout-sessions/{id} | Update buyer / shipping / payment details |
| POST | /wp-json/redsys-ucp/v1/checkout-sessions/{id}/complete | Complete the session and start payment |
| POST | /wp-json/redsys-ucp/v1/checkout-sessions/{id}/cancel | Cancel the session |
Alias routes: POST /sessions, GET /sessions/{id}, PATCH /sessions/{id}, POST /sessions/{id}/complete, POST /sessions/{id}/cancel.
UCP — orders
Read orders created through the commerce surface and act on them. Order ids are WooCommerce order ids.
| Method | Path | Description |
|---|---|---|
| GET | /wp-json/redsys-ucp/v1/orders | List orders |
| GET | /wp-json/redsys-ucp/v1/orders/{id} | Retrieve a single order |
| POST | /wp-json/redsys-ucp/v1/orders/{id}/cancel | Cancel an order |
| POST | /wp-json/redsys-ucp/v1/orders/{id}/refund | Create a full or partial refund (synced with Redsys) |
Refund all or part of a paid order. The refund is executed against Redsys and recorded on the WooCommerce order.
| Name | Type | Description |
|---|---|---|
id | int | WooCommerce order id (path parameter) |
amount | int | Amount in cents to refund (omit for a full refund) (example) |
reason | string | Optional refund reason (example) |
{
"order_id": 10432,
"status": "refunded",
"refunded_amount": 1250,
"currency": "EUR"
}
UCP — webhooks
Register HTTPS endpoints to receive signed event notifications (for example when an order is paid or refunded) instead of polling.
| Method | Path | Description |
|---|---|---|
| POST | /wp-json/redsys-ucp/v1/webhooks | Register a webhook subscription |
| GET | /wp-json/redsys-ucp/v1/webhooks | List webhook subscriptions |
| DELETE | /wp-json/redsys-ucp/v1/webhooks/{id} | Delete a webhook subscription |
Error handling
UCP REST endpoints return standard HTTP status codes with a WordPress-style JSON error body (code, message, data.status). A2A endpoints return JSON-RPC error envelopes; transport-level failures additionally carry the matching HTTP status.
| Status | Meaning | When |
|---|---|---|
400 | Bad request | Invalid or missing parameters / schema validation failure |
401 | Unauthorized | Missing, invalid, expired or revoked bearer token |
403 | Forbidden | Token lacks the required scope, IP not whitelisted, or outside the allowed hours window |
404 | Not found | No resource (task, session, order) matches the id |
429 | Too many requests | Per-client rate limit exceeded (minute / hour / day window) |
503 | Service unavailable | The A2A or UCP surface is not enabled by the merchant |
500 | Server error | Unexpected gateway or Redsys error (see the Redsys logs) |
Representative A2A JSON-RPC error codes: -32002 scope_denied (with data.required_scope), -32003 rate_limited (with data.window and data.limit), and a2a_client_revoked when a real token maps to a revoked client.
Get full API access
The REST API ships with the WooCommerce Redsys Gateway Premium plugin.