Documentation

UCP REST API

UCP REST API

PerfectPay's UCP shopping service gives partner agents a standard way to discover catalogs, create checkouts, and complete purchases.

Base URL Discovery

Do not hardcode the REST base URL.

Discover it from the merchant profile at:

Text
/.well-known/ucp

Use the endpoint published under:

Text
services["dev.ucp.shopping"][transport=rest].endpoint

Core Endpoints

EndpointPurpose
POST /catalog/searchSearch the merchant catalog
POST /catalog/lookupResolve known catalog ids
POST /checkout-sessionsCreate a checkout session
GET /checkout-sessions/{id}Retrieve a checkout session
POST /checkout-sessions/{id}/completePlace the order
POST /checkout-sessions/{id}/cancelCancel a checkout session
GET /carts/{id}Retrieve a cart
POST /carts/{id}/cancelCancel a cart

Required Headers

The UCP spec uses protocol headers in addition to auth:

HeaderPurpose
UCP-AgentRequired profile URI for the calling agent
AuthorizationOAuth-style platform auth when used
X-API-KeyReusable API key auth allocated to the platform
SignatureHTTP message signature
Signature-InputSignature metadata
Content-DigestBody digest for signed requests
Idempotency-KeyRequired for create and complete flows
X-Request-IdRequest tracing

Search Example

HTTP
POST /catalog/search
UCP-Agent: profile="https://buyer.example/.well-known/ucp"
X-API-Key: partner_key_123
Signature: sig1=:base64url...:
Signature-Input: sig1=("@method" "@target-uri" "content-digest");created=1760000000
Content-Digest: sha-256=:base64url...:
Content-Type: application/json

{
  "query": "wireless headphones",
  "limit": 10
}

Checkout Example

HTTP
POST /checkout-sessions
UCP-Agent: profile="https://buyer.example/.well-known/ucp"
X-API-Key: partner_key_123
Idempotency-Key: chk_1001
Content-Type: application/json

{
  "items": [
    {
      "id": "sku_123",
      "quantity": 1
    }
  ],
  "currency_code": "USD"
}

Completion

POST /checkout-sessions/{id}/complete is the order placement step and uses the same protocol headers, including Idempotency-Key.