docs: add the /v2/secure-payments surface to openapi.v2.json - #111
Open
rodrigopavezi wants to merge 2 commits into
Open
docs: add the /v2/secure-payments surface to openapi.v2.json#111rodrigopavezi wants to merge 2 commits into
rodrigopavezi wants to merge 2 commits into
Conversation
The spec was missing every secure-payments endpoint, including
POST /v2/secure-payments — the primary flow the prose docs teach — and
POST /v2/secure-payments/multicall-payouts. Because docs.json auto-generates
the "Endpoints (V2)" playground pages from this file, none of them had a
reference page, and rules like the optionality of requests[].destinationId
could only be sourced from prose.
Adds all 12 operations across 11 paths under the V2/Secure Payment tag,
reconciled against the request-api implementation (RequestNetwork/request-api
@ 0.28.0, identical on main and staging).
Schemas are generated from the zod schemas in
src/validation/schemas/secure-payment.schema.ts rather than copied from the
live /open-api/openapi.json, because the Route decorator's generateSchema()
helper takes Object.keys(components.schemas)[0] and so mis-picks a nested
component whenever a schema references another registered one. The served
spec is wrong for SecurePaymentResponse (shows the fee plan snapshot),
GetSecurePaymentResponse, GetSecurePaymentCalldataResponse,
SecurePaymentInfoResponse, MulticallPayoutDetailsResponse,
RecordSecurePaymentIntent(Response), and the TRON broadcast body.
Also corrected against the source:
- Added the missing `token` path parameter on GET /v2/secure-payments/{token}
and /{token}/pay. The served spec only declares the same-named *query*
parameter (the crosschain source currency), which left the path parameter
undeclared and the two meanings conflated. Both are now documented.
- Added the `Authorization` header to the operations whose guard accepts a
session, with the guard's actual precedence (orchestrator key, then
api key / client id, then session).
- Added `enum: ["true", "false"]` to the `isSafe` query parameter, which the
decorator drops because the zod enum sits behind a transform.
- Documented `requests[].destinationId` from the service: the server always
resolves the destination itself, a mismatched value is rejected with 403,
and a backend Client ID must be bound to a payee destination.
- Added 401 to every operation, plus the 400/403 cases on
POST /v2/secure-payments.
Schemas are emitted as OpenAPI 3.0 (nullable, boolean exclusiveMinimum) to
match the "openapi": "3.0.0" this file declares. The additions validate
cleanly; the one pre-existing validation error on
/v2/payee-destination/{destinationId} is untouched and unrelated.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Greptile SummaryAdds the Secure Payments V2 API surface to the OpenAPI specification.
Confidence Score: 5/5The PR appears safe to merge. The previously reported batch-payment example is corrected at api-reference/openapi.v2.json:5648-5652, where both items now use the same destination ID, and no blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "docs: fix the batch example to respect t..." | Re-trigger Greptile |
The batchPayment example, copied verbatim from the @route decorator in request-api, gave its two items different destinationId values. Since createSecurePayment resolves one destination for the caller and rejects any supplied destinationId that differs from it, copying that example produces a 403 "Destination does not match the configured payment destination." rather than a batch payment. Both items now use the same destinationId, and the summary says so. Also states the constraint on the requests[] array itself, so it is visible to callers who omit destinationId and never read that field's description, and adds an example of the omitted form — the flow the destinationId docs describe but had no example for.
LeoSlrRf
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
api-reference/openapi.v2.jsonwas missing the entire/v2/secure-paymentssurface — includingPOST /v2/secure-payments, the primary flow the prose docs teach (secure-payments.mdx, secure-payment-integration-guide.mdx, programmatic-payment-links.mdx, llm-integration-guide.mdx) — andPOST /v2/secure-payments/multicall-payouts.docs.jsonauto-generates the Endpoints (V2) playground pages from this file, so none of these endpoints had a reference page, and rules like the optionality ofrequests[].destinationIdcould only be sourced from prose. Found while fixing a review comment on #106.What
Adds 12 operations across 11 paths under the
V2/Secure Paymenttag (which was already listed inx-tagGroupsbut had no tag entry and no paths), reconciled againstRequestNetwork/request-api@0.28.0— verified identical onmainandstaging./v2/secure-paymentsPOST,GET/v2/secure-payments/payoutsPOST/v2/secure-payments/batch-payoutsPOST/v2/secure-payments/fees/previewPOST/v2/secure-payments/{token}GET/v2/secure-payments/{token}/payGET/v2/secure-payments/{token}/intentPOST/v2/secure-payments/{token}/tron/broadcastPOST/v2/secure-payments/{token}/refresh-step-transactionPOST/v2/secure-payments/multicall-payoutsPOST/v2/secure-payments/multicall-payouts/{token}GETPurely additive — 6803 insertions, 0 deletions.
The live spec could not be copied verbatim
Schemas here are generated from the zod schemas in
src/validation/schemas/secure-payment.schema.ts, not copied fromhttps://api.request.network/open-api/openapi.json.The
@Routedecorator'sgenerateSchema()helper does:When a schema references another
.openapi()-registered schema, the nested one is registered first, so[0]returns the wrong component. Concretely, the live spec advertises the fee plan snapshot as the201body ofPOST /v2/secure-payments, when the real body is{ requestIds, securePaymentUrl, token, feePlan }. Same failure mode forGetSecurePaymentResponse,GetSecurePaymentCalldataResponse,SecurePaymentInfoResponse,MulticallPayoutDetailsResponse,RecordSecurePaymentIntent(Response), and the TRON broadcast body — several of which the served spec truncates to a fraction of the real shape.The generated schemas are fully inlined (this file has no
components.schemas) and emitted as OpenAPI 3.0 —nullable: truerather thantype: [..., "null"], booleanexclusiveMinimum— matching the"openapi": "3.0.0"this file declares.Corrections beyond the served spec
tokenpath parameter added onGET /{token}andGET /{token}/pay. The served spec declares only the same-named query parameter (the crosschain source currencyUSDC/USDT/EURC/USDT0), leaving the path parameter undeclared entirely. Both are now present, each describing what it is and that they are different values.Authorizationheader added to the operations whose guard accepts a session (POST /,/payouts,/batch-payouts,/fees/preview,/multicall-payouts). The decorator emits it only forauth: "session"endpoints, so session auth was silently undocumented on the combined guards. Described with the guard's real precedence: orchestrator key → api key / client id → session.isSafeenum restored ("true"/"false") — dropped by the decorator because the zod enum sits behind a.transform().requests[].destinationIddocumented fromsecure-payment.service.ts, not just as "optional":401added to every operation, plus the concrete400and403cases onPOST /v2/secure-payments(mixed networks, TRON batch, no active destination, destination mismatch, non-wallet platform, unbound backend Client ID).batchPaymentexample fixed (flagged by Greptile). Upstream it gives its two items differentdestinationIdvalues, which 403s under the invariant above. Both items now share one destination, the constraint is restated onrequests[]itself, and asinglePaymentResolvedDestinationexample shows the omitted form the field description recommends.Verification
openapi-spec-validatoragainst OpenAPI 3.0: everything added validates cleanly. The single remaining error is pre-existing and unrelated —/v2/payee-destination/{destinationId}has nodestinationIdpath parameter on itsget/delete. It fails onmaintoday and is untouched here.(name, in)parameter pairs, and every{param}in the added path templates has a matchingin: pathparameter.secure-payment.controller.ts,secure-payment-multicall.controller.ts,secure-payment.service.ts, and the guards.Follow-ups (not in this PR)
request-api:generateSchema()insrc/decorators/route.decorator.tsshould resolve the schema by its registeredrefIdinstead ofObject.keys(...)[0]. Until then the live/open-apispec and Scalar UI keep serving wrong response shapes for any schema that nests a registered one.request-api: neitherGET /{token}nor/{token}/paydeclares atokenpath parameter, and the combined-auth endpoints never documentAuthorization. Fixing the decorator would let this file be regenerated rather than hand-reconciled.request-api: thebatchPaymentbody example onSecurePaymentController.createSecurePaymentuses two differentdestinationIdvalues, which the service rejects with 403. The stale example is the origin of the one corrected here, and it is still what the live Scalar UI shows.api-reference/secure-payments.mdx: theGET /v2/secure-payments/:tokencURL example sendsx-api-key, but that endpoint isauth: "clientId"(needsx-client-id+Origin); the crosschain source-token list omitsEURCandUSDT0; and the201response examples omitfeePlan.api-reference/endpoints-overview.mdxhas no Secure Payments section — it also already omits Currencies, Client IDs, and Payee Destination, so it wants one pass rather than a partial addition.