1+ openapi : 3.0.3
2+ info :
3+ title : CloudShopt Payment Service API
4+ version : 1.0.0
5+ tags :
6+ - name : Health
7+ - name : Diagnostics
8+ - name : Checkout
9+ - name : Webhooks
10+
11+ paths :
12+ /healthz :
13+ get :
14+ tags : [Health]
15+ summary : Health check
16+ responses :
17+ " 200 " :
18+ description : OK
19+ content :
20+ application/json :
21+ schema :
22+ $ref : " #/components/schemas/StatusOkBool"
23+
24+ /info :
25+ get :
26+ tags : [Diagnostics]
27+ summary : Service info (sha, time)
28+ responses :
29+ " 200 " :
30+ description : Info
31+ content :
32+ application/json :
33+ schema :
34+ $ref : " #/components/schemas/InfoResponse"
35+
36+ /database :
37+ get :
38+ tags : [Diagnostics]
39+ summary : Database connectivity check (optional)
40+ responses :
41+ " 200 " :
42+ description : DB OK (or not used)
43+ content :
44+ application/json :
45+ schema :
46+ $ref : " #/components/schemas/DatabaseOkResponse"
47+ " 500 " :
48+ description : DB connection failed
49+ content :
50+ application/json :
51+ schema :
52+ $ref : " #/components/schemas/DatabaseFailResponse"
53+
54+ /checkout-session :
55+ post :
56+ tags : [Checkout]
57+ summary : Create Stripe Checkout Session (JWT)
58+ description : Returns Stripe hosted checkout URL. Amount is derived from order total (cents).
59+ security :
60+ - bearerAuth : []
61+ requestBody :
62+ required : true
63+ content :
64+ application/json :
65+ schema :
66+ $ref : " #/components/schemas/CreateCheckoutSessionRequest"
67+ responses :
68+ " 200 " :
69+ description : Session created
70+ content :
71+ application/json :
72+ schema :
73+ $ref : " #/components/schemas/CreateCheckoutSessionResponse"
74+ " 401 " :
75+ $ref : " #/components/responses/Unauthorized"
76+ " 404 " :
77+ $ref : " #/components/responses/NotFound"
78+ " 422 " :
79+ $ref : " #/components/responses/ValidationError"
80+
81+ /webhooks/stripe :
82+ post :
83+ tags : [Webhooks]
84+ summary : Stripe webhook receiver
85+ description : Stripe calls this endpoint. Signature is verified using STRIPE_WEBHOOK_SECRET.
86+ requestBody :
87+ required : true
88+ content :
89+ application/json :
90+ schema :
91+ type : object
92+ responses :
93+ " 200 " :
94+ description : Received
95+ content :
96+ application/json :
97+ schema :
98+ $ref : " #/components/schemas/WebhookReceived"
99+ " 400 " :
100+ description : Invalid signature / bad request
101+ content :
102+ application/json :
103+ schema :
104+ $ref : " #/components/schemas/ErrorMessage"
105+
106+ components :
107+ securitySchemes :
108+ bearerAuth :
109+ type : http
110+ scheme : bearer
111+ bearerFormat : JWT
112+
113+ responses :
114+ Unauthorized :
115+ description : Unauthorized
116+ content :
117+ application/json :
118+ schema :
119+ $ref : " #/components/schemas/ErrorMessage"
120+
121+ NotFound :
122+ description : Not found
123+ content :
124+ application/json :
125+ schema :
126+ $ref : " #/components/schemas/ErrorMessage"
127+
128+ ValidationError :
129+ description : Validation error
130+ content :
131+ application/json :
132+ schema :
133+ $ref : " #/components/schemas/ValidationError"
134+
135+ schemas :
136+ ErrorMessage :
137+ type : object
138+ required : [message]
139+ properties :
140+ message : { type: string }
141+
142+ ValidationError :
143+ type : object
144+ required : [message, errors]
145+ properties :
146+ message : { type: string }
147+ errors :
148+ type : object
149+ additionalProperties :
150+ type : array
151+ items : { type: string }
152+
153+ StatusOkBool :
154+ type : object
155+ required : [ok]
156+ properties :
157+ ok : { type: boolean, example: true }
158+
159+ InfoResponse :
160+ type : object
161+ required : [ok, service, sha, time]
162+ properties :
163+ ok : { type: boolean, example: true }
164+ service : { type: string, example: payment-service }
165+ sha : { type: string, nullable: true, example: 0.0.1 }
166+ time : { type: string, format: date-time, example: "2026-01-29T10:15:30.123Z" }
167+
168+ DatabaseOkResponse :
169+ type : object
170+ required : [ok, db, time]
171+ properties :
172+ ok : { type: boolean, example: true }
173+ db :
174+ type : object
175+ required : [connection, database, ping_ms]
176+ properties :
177+ connection : { type: string, example: mysql }
178+ database : { type: string, example: cloudshopt_payments_dev }
179+ ping_ms : { type: number, format: float, example: 1.25 }
180+ time : { type: string, format: date-time, example: "2026-01-29T10:15:30.123Z" }
181+
182+ DatabaseFailResponse :
183+ type : object
184+ required : [ok, error, message]
185+ properties :
186+ ok : { type: boolean, example: false }
187+ error : { type: string, example: DB connection failed }
188+ message : { type: string, nullable: true, example: "SQLSTATE[HY000] ..." }
189+
190+ CreateCheckoutSessionRequest :
191+ type : object
192+ required : [order_id]
193+ properties :
194+ order_id : { type: integer, minimum: 1, example: 10 }
195+
196+ CreateCheckoutSessionResponse :
197+ type : object
198+ required : [url, session_id]
199+ properties :
200+ url : { type: string, example: https://checkout.stripe.com/c/pay/cs_test_... }
201+ session_id : { type: string, example: cs_test_a11lqwy13iFvK69o... }
202+
203+ WebhookReceived :
204+ type : object
205+ required : [received]
206+ properties :
207+ received : { type: boolean, example: true }
0 commit comments