Skip to content

Commit bf5925f

Browse files
authored
feat: auto-expand api lists (#104)
When Stripe sends webhooks with nested lists, Stripe only sends the first 10 items. For example, if you get a webhook for an invoice and you have more than 10 line items, Stripe won't send the exhaustive list, but only the first 10 items. This leads to missing data in the synced database. PR introduces a new AUTO_EXPAND_LISTS (opt-in) environment variable to automatically expand API lists that are not exhaustive. Supported lists: -invoice.lines -charges.refunds -subscription.items When the nested lists are not exhaustive (hasMore: true), we query the Stripe API to fetch the full list before persisting. the entry. Misc - Update Github actions to latest majors - Update local Supabase Postgres image to latest - Cleaned up duplicate imports from stripe
1 parent 03fef42 commit bf5925f

15 files changed

+903
-369
lines changed

.env.sample

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ PORT=8080
1313

1414
# optional
1515
STRIPE_API_VERSION="2020-08-27"
16+
17+
# optional, needed if you want to automatically fetch related lists that extend 10 entries (Stripe limits the number of entries returned to 10)
18+
# STRIPE_SECRET_KEY needs to be set in order for this to work, as the Stripe API is queried
19+
# Supported lists so far:
20+
## - invoice.lines
21+
## - charges.refunds
22+
## - subscription.items
23+
AUTO_EXPAND_LISTS=false

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: actions/cache@v3
23+
- uses: actions/cache@v4
2424
with:
2525
path: ~/.npm
2626
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
new-release-version: ${{ steps.semantic-release.outputs.new_release_version }}
2222

2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525

2626
- name: Set up Node
2727
uses: actions/setup-node@v4
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Run semantic-release
3636
id: semantic-release
37-
uses: cycjimmy/semantic-release-action@v3
37+
uses: cycjimmy/semantic-release-action@v4
3838
with:
3939
semantic_version: 19
4040
env:

0 commit comments

Comments
 (0)