Add discoveries api endpoint. This GET endpoint returns payment railes available by currency and country#298
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
✱ Stainless preview buildsThis PR will update the kotlin openapi python typescript Edit this comment to update them. They will appear in their respective SDK's changelogs.
|
⚠️ grid-python studio · code · diff
Your SDK build had at least one "warning" diagnostic, which is a regression from the base state.
generate ⚠️(prev:generate ✅) →build ✅→lint ❗→test ✅pip install https://pkg.stainless.com/s/grid-python/bbc1009b6773057cb74edea0c6cfa52ba70858e9/grid-0.0.1-py3-none-any.whlNew diagnostics (1 warning)
⚠️ Method/PaginatedWithoutMatchingScheme: Skipped pagination for method `get /discoveries` (no matching pagination scheme).
⚠️ grid-kotlin studio · code · diff
Your SDK build had at least one "warning" diagnostic, which is a regression from the base state.
generate ⚠️(prev:generate ✅) →build ✅→lint ✅→test ✅New diagnostics (1 warning)
⚠️ Method/PaginatedWithoutMatchingScheme: Skipped pagination for method `get /discoveries` (no matching pagination scheme).
⚠️ grid-typescript studio · code · diff
Your SDK build had at least one "warning" diagnostic, which is a regression from the base state.
generate ⚠️(prev:generate ✅) →build ✅→lint ❗→test ✅npm install https://pkg.stainless.com/s/grid-typescript/eb479070c0f849b3ef9c2e5b2f878c66d3427d75/dist.tar.gzNew diagnostics (1 warning)
⚠️ Method/PaginatedWithoutMatchingScheme: Skipped pagination for method `get /discoveries` (no matching pagination scheme).
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-03-27 00:59:30 UTC
01c98e8 to
76b15e1
Compare
| - Discoveries | ||
| security: | ||
| - BasicAuth: [] | ||
| parameters: |
There was a problem hiding this comment.
should this be a searchable list? Eg instead of a drop down of however many banks, it's a searchable list and we return options starting with the search param they pass in.
There was a problem hiding this comment.
I'm open to this list - would you structure that as /discoveries providing a string parameter to narrow down the results?
| schema: | ||
| type: object | ||
| properties: | ||
| payment_rails: |
There was a problem hiding this comment.
This should follow our standard pagination scheme I think? https://github.com/lightsparkdev/grid-api/tree/main/openapi#pagination
| - country | ||
| - currency | ||
| properties: | ||
| id: |
There was a problem hiding this comment.
what's teh difference between id, name and display name? Should it only be id / display_name?
There was a problem hiding this comment.
short answer, yes should be id and display_name. long answer, the name field is a kludge because the external account integration api requires a name rather than an id for bankName / provider etc. I think the right thing to do would be to change the external account to require an id instead, then have discoveries return {id, display_name}
| description: > | ||
| Human-friendly display name. Falls back to name if the provider | ||
| has not set a distinct display name. | ||
| country: |
There was a problem hiding this comment.
i forget the use case for including these. Is it if a country supports multiple currencies? or if a currency is across multiple countries?
Should the country / currency url params both be required instead?
There was a problem hiding this comment.
Just trying to think about how SoFi and others would build the flow. I think the user would have already selected the country + currency
There was a problem hiding this comment.
the immediate use case for us is currencies used in multiple countries, like XOF. we don't support this yet, but conceivably we could have multiple currencies per country, like EUR & DKK for denmark
There was a problem hiding this comment.
if country and currency are required on the request, and we limit to those, is there any benefit to returning them for every entry on the response?
There was a problem hiding this comment.
I don't think there is. But I was ok leaving them since I'm not sure exactly how integrators will use it.
Does it make sense to make country required?
There was a problem hiding this comment.
it seems kind of weird to me.. id rather leave it out and add if we see a need later
There was a problem hiding this comment.
i don't feel too strongly either way
There was a problem hiding this comment.
we don't need to require it. I think the present list of bank names is small enough we could send it back in one block. I assume this api will most often be called with a country_code parameter
76b15e1 to
7ddcc07
Compare
7ddcc07 to
f9196d4
Compare
f9196d4 to
b7b43e5
Compare
|
@pengying trying to remember, we were 'no' on pagination for now? |
|
Yeah - if they're going to implement filtering on the client, I think pagination would slow down the UI. And 100 * ~100-150 bytes is not terrible. |
Greptile SummaryThis PR adds a new Confidence Score: 4/5Safe to merge after the small The core implementation is correct and follows existing patterns. One concrete schema inconsistency ( openapi/paths/discoveries/discoveries.yaml — missing
|
| Filename | Overview |
|---|---|
| openapi/paths/discoveries/discoveries.yaml | New endpoint definition for GET /discoveries; missing required: [data] on the 200 response schema and no pagination support on the list response. |
| openapi/openapi.yaml | Root spec updated to add the Discoveries tag and $ref the new path; looks correct. |
| openapi.yaml | Generated bundle (via make build) — changes mirror the source spec, no issues. |
| mintlify/openapi.yaml | Generated Mintlify bundle — changes are consistent with the source edits in openapi/, no issues. |
Sequence Diagram
sequenceDiagram
participant Dev as Developer
participant Grid as Grid API
participant EA as External Accounts
Dev->>Grid: GET /discoveries?country=PH¤cy=PHP
Grid-->>Dev: 200 { data: [{ bankName, displayName, country, currency }] }
Note over Dev: Pick bankName from list
Dev->>EA: POST /customers/external-accounts<br/>{ accountInfo: { bankName: "Bank of the Philippine Islands", ... } }
EA-->>Dev: 201 External Account created
Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi/paths/discoveries/discoveries.yaml
Line: 33-40
Comment:
**`data` not marked as required in the 200 response schema**
Unlike every other list endpoint in this spec (e.g. `customers_external_accounts.yaml` marks `required: [data, hasMore]`), the 200 response here omits a `required` block. This means OpenAPI validators and generated client code will treat `data` as optional even on a successful response, which is inconsistent and could cause null-pointer issues in generated SDKs.
```suggestion
type: object
required:
- data
properties:
data:
type: array
description: List of payment rails matching the filter criteria
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: openapi/paths/discoveries/discoveries.yaml
Line: 1-30
Comment:
**No pagination support on a potentially unbounded list**
All other collection endpoints (`/customers/external-accounts`, `/transactions`, etc.) support `limit`/`cursor` pagination and return `hasMore` + `nextCursor`. The `GET /discoveries` endpoint returns a plain array with no pagination controls.
For most corridors today, payment-rail lists are likely short, so this may be fine for the initial release. However, if the list grows (e.g., the Philippines alone has 40+ InstaPay-enabled banks), clients will have no way to paginate without a breaking API change. Consider at least stubbing out the optional `limit` and `cursor` parameters now, or documenting that this list is intentionally non-paginated and expected to stay small.
How can I resolve this? If you propose a fix, please make it concise.Reviews (2): Last reviewed commit: "remove pagination" | Re-trigger Greptile
b7b43e5 to
236f653
Compare
done, pagination removed |
| displayName: BDO Unibank | ||
| country: PH | ||
| currency: PHP | ||
| - bankName: Bank of the Philippine Islands |
There was a problem hiding this comment.
is the bankName / displayName for thie example reversed?

TL;DR
Added a new
/discoveriesendpoint to retrieve available payment rails for specific country and currency combinations.What changed?
GET /discoveriesendpoint that acceptscountry(ISO 3166-1 alpha-2) andcurrency(ISO 4217) query parametersidfield serves as the stable identifier to use when creating external accountsHow to test?
/discoveries?country=PH¤cy=PHPwith proper authenticationpayment_railsarray with bank informationidvalues can be used asbankNamewhen creating external accounts viaPOST /customers/{id}/external-accountsWhy make this change?
This endpoint enables developers to programmatically discover which payment rails, banks, and providers are available for specific country-currency corridors supported by Grid's partners, eliminating the need to hardcode bank names and providing a dynamic way to populate payment options in applications.