API pipeline: Redeem a coupon

Goal: check a coupon code, clip it into your wallet, see the price with it, and pay Pro or a plan with it.

Steps

1. Check (signed in).

GET /v0/graph/coupons/validate?code=SPRING25
→ {"valid": true, "message": "…", "terms": {"title": "…", "area": "PROMOTIONAL", "discount_type": "PERCENTAGE", "discount_value": 50.0, …}}

2. Clip.

POST /v0/my/coupons/clip
{"code": "SPRING25"}
→ {"coupon": {"nonce": "<clip>", "code": "SPRING25", "area": "PROMOTIONAL", "clipped": {"remaining": …, "can_use": true, "valid_until": "…"}, …},
   "already_clipped": false}

3. Your wallet. GET /v0/my/coupons?kind=clipped → your clips with remaining, can_use, use_block_reason.

4. Quote.

GET /v0/my/coupons/quote?coupon=<clip>&target=pro&project=<project>
→ {"target": "pro", "clip": "<clip>", "list_usd": 18.0, "discount_usd": 9.0, "charged_usd": 9.0,
   "wallet_left_usd": 0.0, "balance_usd": 31.0, "enough": true}

target: pro (one month on project) or monthly, yearly, lifetime.

5. Pay. POST /v0/my/projects/<project>/pro {"coupon": "<clip>"} or POST /v0/my/plan {"kind": "yearly", "coupon": "<clip>"} → list_usd, discount_usd, charged_usd. API pipeline: Make a project Pro API pipeline: Buy a Pro plan for up to 10 projects

Rules

API surface

Endpoint Purpose FE AI / oracle
GET /v0/graph/coupons/validate Check a code no yes
POST /v0/my/coupons/clip Clip into your wallet yes yes
GET /v0/my/coupons?kind=clipped Your wallet yes yes
GET /v0/my/coupons/quote Price with a coupon yes yes
POST /v0/my/projects/{nonce}/pro, POST /v0/my/plan Pay with coupon yes yes

Index: API pipelines — index

Mentioned