🚀 Production-ready .NET API template implementing Universal Commerce Protocol (UCP) - Google's new standard for commerce integration.
Universal Commerce Protocol (UCP) is a new open standard developed by Google, Shopify, Target, Walmart, and other major e-commerce players to standardize commerce operations across platforms. This template provides a complete UCP REST API implementation for merchants.
- ✅ Complete UCP REST API - All standard endpoints implemented
- ✅ UCP Discovery -
/.well-known/ucpmerchant profile endpoint - ✅ Checkout Sessions - Create, get, update, complete, cancel
- ✅ Order Management - Get and update orders
- ✅ Strongly-typed models - Full C# models for all UCP types
- ✅ TODO-based implementation - Clear markers for your business logic
- ✅ No database dependencies - Use any database you want
- ✅ Lightweight - Minimal dependencies, maximum flexibility
- ✅ Swagger/OpenAPI - Interactive API documentation
git clone https://github.com/sahinhurcan/ucp.NET.git
cd ucp.NET/template/UCP.API
dotnet runNavigate to http://localhost:5000 to see Swagger documentation.
All UCP REST API endpoints per the official specification:
GET /.well-known/ucp- Merchant profile discovery
POST /checkout-sessions- Create checkout sessionGET /checkout-sessions/{id}- Get checkout detailsPUT /checkout-sessions/{id}- Update checkoutPOST /checkout-sessions/{id}/complete- Complete checkout and create orderPOST /checkout-sessions/{id}/cancel- Cancel checkout session
POST /checkout-sessions- Create checkout sessionGET /checkout-sessions/{id}- Get checkout detailsPUT /checkout-sessions/{id}- Update checkoutPOST /checkout-sessions/{id}/complete- Complete checkout and create orderPOST /checkout-sessions/{id}/cancel- Cancel checkout session
GET /orders/{id}- Get order detailsPUT /orders/{id}- Update order
Each endpoint has clear TODO comments:
[HttpPost]
public async Task<IActionResult> CreateCheckout([FromBody] CheckoutCreateRequest request)
{
// TODO: Implement your business logic here
// 1. Validate line items against your product catalog
// 2. Check inventory availability
// 3. Calculate totals, taxes, and shipping costs
// 4. Save checkout session to your database
// 5. Return checkout response with calculated values
throw new NotImplementedException("Implement in your business layer");
}The template has TODO markers where you implement your business logic. You can:
- Store data in a database (SQL Server, PostgreSQL, MongoDB, etc.)
- Make API calls to external services
- Use in-memory storage
- Integrate with existing systems
- Any combination of the above
Simply fill in the TODO sections in each controller with your implementation!
All UCP protocol models in UCP.NET library:
CheckoutCreateRequest/CheckoutUpdateRequest/CheckoutResponseLineItem/LineItemResponsePayment/PaymentResponseFulfillment/FulfillmentResponseOrder/OrderSummaryUcpMetadata/CapabilityPrice/PaymentHandler/PaymentCredentialsFulfillmentMethod/ShippingDestination- And more...
-
Platform discovers merchant capabilities
GET /.well-known/ucp → Merchant profile with capabilities -
Create checkout session
POST /checkout-sessions { "line_items": [...], "currency": "USD", "buyer": {...}, "payment": {...} } → Checkout ID and details -
Update with payment/shipping
PUT /checkout-sessions/{id} { "payment": {...}, "fulfillment": {...} } → Updated checkout -
Complete checkout
POST /checkout-sessions/{id}/complete → Order created -
Check order status
GET /orders/{id} → Order details with fulfillment status
ucp.NET/
├── src/
│ └── UCP.NET/ # UCP Protocol Library
│ ├── Models/ # All UCP data models
│ ├── Client/ # HTTP client (for calling other UCP APIs)
│ └── Configuration/ # Configuration options
└── template/
└── UCP.API/ # Your API Implementation
├── Controllers/
│ ├── CheckoutController.cs # Checkout endpoints
│ ├── OrderController.cs # Order endpoints
│ └── DiscoveryController.cs # UCP discovery
├── Program.cs # App configuration
└── appsettings.json # Your settings
- UCP Protocol: https://ucp.dev/
- UCP Specification: https://github.com/Universal-Commerce-Protocol
- Python SDK: https://github.com/Universal-Commerce-Protocol/python-sdk
- Sample Implementations: https://github.com/Universal-Commerce-Protocol/samples
Apache License 2.0
Build UCP-compliant commerce APIs for the future! 🚀