@@ -93,94 +93,6 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
9393- Website - [ https://nestjs.com ] ( https://nestjs.com/ )
9494- Twitter - [ @nestframework ] ( https://twitter.com/nestframework )
9595
96- ## Payment Request Validation
97-
98- The backend supports validation and normalization of payment requests (including direct fields, serialized JSON strings, and URI schemes).
99-
100- ### Endpoint
101- ` POST /v1/payment-requests/validate `
102-
103- ### Curl Examples
104-
105- #### 1. Direct Structured Request (Valid)
106- ``` bash
107- curl -X POST http://localhost:3000/v1/payment-requests/validate \
108- -H " Content-Type: application/json" \
109- -d ' {
110- "asset": "USDC",
111- "recipient": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
112- "amount": 250.0
113- }'
114- ```
115-
116- Response:
117- ``` json
118- {
119- "valid" : true ,
120- "normalizedPayload" : {
121- "asset" : " USDC" ,
122- "recipient" : " 0x742d35Cc6634C0532925a3b844Bc454e4438f44e" ,
123- "amount" : 250
124- }
125- }
126- ```
127-
128- #### 2. URI String Payment Request (Valid)
129- ``` bash
130- curl -X POST http://localhost:3000/v1/payment-requests/validate \
131- -H " Content-Type: application/json" \
132- -d ' {
133- "payload": "ethereum:0x742d35Cc6634C0532925a3b844Bc454e4438f44e?amount=150.0&asset=USDC"
134- }'
135- ```
136-
137- Response:
138- ``` json
139- {
140- "valid" : true ,
141- "normalizedPayload" : {
142- "asset" : " USDC" ,
143- "recipient" : " 0x742d35Cc6634C0532925a3b844Bc454e4438f44e" ,
144- "amount" : 150
145- }
146- }
147- ```
148-
149- #### 3. Request with Validation Errors (Invalid)
150- ``` bash
151- curl -X POST http://localhost:3000/v1/payment-requests/validate \
152- -H " Content-Type: application/json" \
153- -d ' {
154- "asset": "DOGE",
155- "recipient": "0xInvalidEthAddress",
156- "amount": -100
157- }'
158- ```
159-
160- Response:
161- ``` json
162- {
163- "valid" : false ,
164- "errors" : [
165- {
166- "code" : " INVALID_ASSET" ,
167- "message" : " Asset 'DOGE' is not supported. Supported assets are: USDC, USDT, ETH, BTC, SOL, USD, EUR." ,
168- "field" : " asset"
169- },
170- {
171- "code" : " INVALID_RECIPIENT" ,
172- "message" : " Recipient address starts with 0x but is not a valid Ethereum address." ,
173- "field" : " recipient"
174- },
175- {
176- "code" : " INVALID_AMOUNT" ,
177- "message" : " Amount must be greater than zero." ,
178- "field" : " amount"
179- }
180- ]
181- }
182- ```
183-
18496## License
18597
18698Nest is [ MIT licensed] ( https://github.com/nestjs/nest/blob/master/LICENSE ) .
0 commit comments