Customer Link and Checkout API
Routes: backend-main/customerlink/urls.py. Lifecycle: Customer link lifecycle. Views: customerlink/views.py (backend-main/customerlink/views.py), catalog: customerlink/catalog_views.py (backend-main/customerlink/catalog_views.py).
Auth
| Surface | Auth |
|---|---|
POS manage (/api/customer-links/…) | X-POS-Access-Key (get_pos_from_access_key) |
| Admin archived / restore | JWT (IsAdminUser on those views) |
Public checkout (/api/checkout/<pos_slug>/<link_code>/…) | None — URL identifies the link |
Public catalog checkout (…/catalog/<link_code>/…) | None |
Archived public links return 410 via archived_gone_response / SSE JSON where applicable.
POS-managed customer links
| Method | Path | Notes |
|---|---|---|
GET/POST | /api/customer-links/ | List (optional status) / create |
GET | /api/customer-links/archived/ | POS archived list |
GET/PUT/PATCH | /api/customer-links/<link_id>/ | Detail / update / status |
GET/POST | /api/customer-links/<link_id>/comments/ | POS-side chat |
GET | /api/customer-links/<link_id>/comments/stream/ | Per-link SSE (POS) |
GET | /api/customer-links/stream/ | Global POS SSE (all links) |
Catalog links (POS)
| Method | Path |
|---|---|
GET/POST | /api/customer-links/catalogs/ |
GET | /api/customer-links/catalogs/picker/ |
GET/… | /api/customer-links/catalogs/<link_code>/ |
Admin archive
| Method | Path |
|---|---|
GET | /api/admin/customer-links/archived/ |
POST | /api/admin/customer-links/<link_id>/restore/ |
Public customer-link checkout
Base: /api/checkout/<pos_slug>/<link_code>/
| Method | Path suffix | Purpose |
|---|---|---|
GET | / | Load link (CustomerLinkPublicView) |
POST | /submit/ | One-shot submit (CustomerLinkSubmitSerializer) when status is Empty |
GET | /addons/ | Available addons for POS |
GET | /upi-qr/ | UPI QR download/response |
POST | /step1/ | Upload assets + optional addons (product_images, selected_addons) → step1_completed |
POST | /step2/ | Shipping details → step2_completed |
POST | /step3/ | Payment screenshot URL → step3_completed, status Submitted, SSE notify_link_submission |
GET/POST | /comments/ | Public chat |
GET | /comments/stream/ | Public SSE |
POST | /workflow-units/<unit_id>/approve/ | Customer approve design unit |
POST | /workflow-units/<unit_id>/reject/ | Customer reject |
Also: POST /api/checkout/upload-image/ — multipart; requires pos_slug + link_code in form data for a live link.
Step rules (code)
- Steps only allowed while
CustomerLink.status == Empty. - Step 3 requires
step1_completedandstep2_completed. - Step 1 sets per-product
custom_imagesand optional addon rows; Step 2 writes shipping_* fields; Step 3 setspayment_screenshotand status Submitted (backend-main/customerlink/serializers.py).
/submit/ is an alternate all-in-one path (same Empty → Submitted gate) used alongside or instead of the step endpoints — both notify SSE on success.
Public catalog-link checkout
Base: /api/checkout/<pos_slug>/catalog/<link_code>/
| Method | Path suffix | Purpose |
|---|---|---|
GET | / | Public catalog link |
POST | /submit/ | Creates/submits via catalog flow |
GET | /addons/ | Addons |
GET | /upi-qr/ | UPI QR |
GET | /collections/<slug>/ | Collection browse |
GET | /designs/<slug>/ | Design detail |
GET | /designs/<slug>/wizard/ | Design wizard |
SSE pointers
Event types and connection params: SSE and realtime.