{"openapi":"3.1.0","info":{"title":"qrbaton","version":"1.0.0","description":"Turn a UPI QR or UPI details (plus an optional cart) into a review-and-pay page link that opens GPay, PhonePe, Paytm or any UPI app. No API key needed."},"servers":[{"url":"https://qrbaton.vercel.app"}],"paths":{"/api/sessions":{"post":{"operationId":"createPayLink","summary":"Create a pay link","description":"Send exactly one of upi or qr, or payee.pa on its own; payee fields override what the QR says (e.g. add an amount to a static QR). Amount: payee.am, else order.total, else the sum of order.items (only when there are no charges; charges are the full bill as displayed, so send total with them). When both am and total are given they must match. Limit: 60 per hour per IP. Also accepts multipart/form-data with a qr file plus upi/payee/order/ttlSec fields (objects as JSON strings).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"upi":{"type":"string","maxLength":2000},"qr":{"type":"string","maxLength":5600000},"payee":{"type":"object","properties":{"pa":{"type":"string","maxLength":100},"pn":{"type":"string","maxLength":100},"am":{"anyOf":[{"type":"number","exclusiveMinimum":0,"maximum":10000000},{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"}]},"tn":{"type":"string","maxLength":100},"tr":{"type":"string","maxLength":50}}},"order":{"type":"object","properties":{"merchant":{"type":"string","minLength":1,"maxLength":60},"logo":{"type":"string","maxLength":1000},"total":{"type":"number","minimum":-10000000,"maximum":10000000},"items":{"default":[],"maxItems":200,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"unit":{"type":"string","maxLength":60},"qty":{"type":"integer","minimum":1,"maximum":999},"price":{"type":"number","minimum":-10000000,"maximum":10000000},"mrp":{"type":"number","minimum":-10000000,"maximum":10000000},"image":{"type":"string","maxLength":1000}},"required":["name","qty","price"]}},"charges":{"default":[],"maxItems":30,"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":60},"amount":{"type":"number","minimum":-10000000,"maximum":10000000}},"required":["label","amount"]}},"delivery":{"type":"object","properties":{"slot":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"label":{"type":"string","maxLength":60},"text":{"type":"string","maxLength":500}}}}},"orderId":{"type":"string","maxLength":40},"site":{"type":"string","maxLength":1000},"agent":{"type":"string","maxLength":60},"note":{"type":"string","maxLength":300}},"required":["merchant"]},"ttlSec":{"type":"integer","minimum":60,"maximum":86400},"callbackUrl":{"type":"string","maxLength":1000}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"qr":{"type":"string","format":"binary"},"upi":{"type":"string"},"payee":{"type":"string","description":"JSON"},"order":{"type":"string","description":"JSON"},"ttlSec":{"type":"integer"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","description":"The pay page. Send this to the person who pays."},"statusUrl":{"type":"string"},"manageToken":{"type":"string","description":"Bearer token for PATCH on this session. Shown once; keep it private."},"expiresAt":{"type":"integer","description":"Unix ms"},"payee":{"type":"object","properties":{"pa":{"type":"string"},"pn":{"type":"string"},"am":{"type":"string"}}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/api/sessions/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"operationId":"getPaymentStatus","summary":"Payment status (public)","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["pending","paid","failed","expired"]},"paidBy":{"enum":["creator","payer"],"description":"payer = the payer tapped \"I've paid\" (unverified)"},"utr":{"type":"string"},"updatedAt":{"type":"integer"},"expiresAt":{"type":"integer"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}},"patch":{"operationId":"setPaymentStatus","summary":"Report the outcome; the pay page updates live","security":[{"manageToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["paid","failed","expired"]},"utr":{"type":"string","pattern":"^[A-Za-z0-9]{6,35}$"}},"required":["status"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["pending","paid","failed","expired"]},"paidBy":{"enum":["creator","payer"],"description":"payer = the payer tapped \"I've paid\" (unverified)"},"utr":{"type":"string"},"updatedAt":{"type":"integer"},"expiresAt":{"type":"integer"}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/api/sessions/{id}/claim":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"operationId":"claimPaid","summary":"Payer says \"I've paid\" (used by the pay page; sets paidBy: payer)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"utr":{"type":"string","pattern":"^[A-Za-z0-9]{6,35}$"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["pending","paid","failed","expired"]},"paidBy":{"enum":["creator","payer"],"description":"payer = the payer tapped \"I've paid\" (unverified)"},"utr":{"type":"string"},"updatedAt":{"type":"integer"},"expiresAt":{"type":"integer"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}},"components":{"securitySchemes":{"manageToken":{"type":"http","scheme":"bearer","description":"manageToken from createPayLink"}}}}