UCP Integration
Connect QWED-Finance to the Universal Commerce Protocol for verified e-commerce payments.
Quick Startβ
from qwed_finance import UCPIntegration
ucp = UCPIntegration(
max_transaction_amount=100000,
allowed_currencies=["USD", "EUR"],
require_kyc=True
)
# Verify payment token
result = ucp.verify_payment_token({
"amount": 15000,
"currency": "USD",
"customer_country": "US",
"kyc_verified": True
})
print(result.can_proceed) # True β
print(result.status) # PaymentStatus.APPROVED
Capability Discoveryβ
For UCP's Dynamic Discovery, declare your capability:
capability = UCPIntegration.get_capability_definition()
Add to .well-known/ucp.jsonβ
{
"business": {
"name": "Your Bank",
"verification": {
"qwed-finance": {
"enabled": true,
"endpoint": "/api/qwed/verify",
"version": "1.0.0",
"operations": [
"verify_payment_token",
"verify_iso20022_payment",
"verify_loan_terms"
]
}
}
}
}
Middleware Patternβ
Drop into your UCP flow:
# Create middleware
middleware = ucp.create_ucp_middleware()
# Use in your payment handler
@app.post("/ucp/checkout")
def checkout(request: UCPRequest):
# QWED intercepts
verification = middleware({
"action": "payment",
"payload": request.payment_token
})
if not verification["allowed"]:
raise HTTPException(400, verification["violations"])
# Proceed with payment
return process_payment(request)
ISO 20022 Paymentsβ
For bank transfers using ISO 20022:
result = ucp.verify_iso20022_payment(
xml_message=pacs008_xml,
sanctions_list=["ACME Corp", "Bad Bank"]
)
if result.can_proceed:
send_to_swift(pacs008_xml)
else:
flag_for_compliance(result.violations)
Verification Flowβ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Checkout ββββββΆβ QWED ββββββΆβ Payment β
β Request β β Verify β β Gateway β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β
ββββββββ΄βββββββ
β Checks: β
β β’ Amount β
β β’ Currency β
β β’ AML β
β β’ KYC β
β β’ Sanctions β
βββββββββββββββ
Receipt IDsβ
Every verification returns receipt IDs for audit:
result = ucp.verify_payment_token(token_data)
for receipt in result.receipts:
print(f"Receipt: {receipt.receipt_id}")
print(f" Guard: {receipt.guard_name}")
print(f" Hash: {receipt.input_hash}")