├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── apps └── docs │ ├── docs │ ├── .vitepress │ │ └── config.ts │ ├── index.md │ └── supabase-schema-settings.png │ └── package.json ├── bunny.md ├── examples ├── nextjs │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── next-env.d.ts │ ├── next.config.mjs │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── env │ │ │ ├── client.mjs │ │ │ ├── schema.mjs │ │ │ └── server.mjs │ │ ├── pages │ │ │ ├── _app.tsx │ │ │ ├── api │ │ │ │ └── stripe.ts │ │ │ ├── index.module.css │ │ │ └── index.tsx │ │ └── styles │ │ │ └── globals.css │ └── tsconfig.json └── supabase-edge-functions │ ├── .vscode │ ├── extensions.json │ └── settings.json │ └── supabase │ ├── config.toml │ └── functions │ └── stripe │ └── index.ts ├── package.json ├── packages └── stripe-sync │ ├── generated │ ├── dereferencedResources.json │ ├── eventTableMap.ts │ ├── mysql.sql │ ├── postgres-schemaless-no-prefix.sql │ ├── postgres-schemaless.sql │ ├── postgres.sql │ ├── stripeTables.ts │ └── tableColumns.json │ ├── package.json │ ├── spec │ ├── enabledEvents.txt │ ├── eventTableMap.ts │ ├── resources.txt │ ├── uniqueResources.txt │ └── webhookResources.json │ ├── src │ ├── adapters │ │ ├── deno.ts │ │ ├── express.ts │ │ ├── fetch.ts │ │ └── next.ts │ ├── databaseAdapters │ │ ├── createDatabaseAdapter.ts │ │ └── supabase.ts │ ├── entry-node.ts │ ├── generate.ts │ ├── handler.ts │ ├── index.ts │ ├── utils │ │ ├── eventToResource.ts │ │ └── logger.ts │ └── xod │ │ ├── README.md │ │ ├── foo.ts │ │ └── index.ts │ ├── tests │ └── all-events.ts │ └── tsconfig.json ├── pnpm-lock.yaml └── pnpm-workspace.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist 3 | build 4 | 5 | .env 6 | 7 | # Supabase 8 | **/supabase/.branches 9 | **/supabase/.temp 10 | 11 | .DS_Store -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "packages/stripe-sync/stripe-openapi"] 2 | path = packages/stripe-sync/stripe-openapi 3 | url = https://github.com/stripe/openapi.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-present, Lawrence Chen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stripe Sync 2 | 3 | Sync Stripe webhook events directly into your database. 4 | 5 | - ✅ Automatically verify webhook signatures 6 | - ✅ Webhook callbacks 7 | - ✅ Sync every Stripe webhook to database tables 8 | 9 | Note: this is experimental. Stuff might be broken. 10 | 11 | ## Setup 12 | 13 | Detailed setup instructions can be found here: 14 | 15 | https://stripe-sync.vercel.app/ 16 | 17 | ### Supabase 18 | 19 | Synced Webhook events may contain sensitive information. Make sure to access this data using a service role Supabase client in a protected server environment. 20 | 21 | #### Add `stripe` schema: 22 | 23 | - [postgres.sql](/packages/stripe-sync/generated/postgres.sql) 24 | 25 | #### Grant service role permissions 26 | 27 | ```sql 28 | grant usage on schema stripe to service_role; 29 | grant all privileges on all tables in schema stripe to service_role; 30 | ``` 31 | 32 | #### Deploy 33 | 34 | Make sure to pass the `--no-verify-jwt` flat, since we want Stripe to be able to give us POST reqeusts. 35 | 36 | ``` 37 | supabase functions deploy stripe --no-verify-jwt 38 | supabase secrets set --env-file ./supabase/.env 39 | ``` 40 | 41 | ## Adapters 42 | 43 | ** Work in progress. Only Deno/Supabase Edge Functions are documented right now ** 44 | 45 | https://github.com/hattipjs/hattip 46 | 47 | - ✅ Supabase Edge Functions 48 | - ✅ Deno (including Deno Deploy) 49 | - ✅ Node.js 50 | - ✅ Cloudflare Workers 51 | - ✅ Express.js 52 | - ✅ Fastify 53 | - ✅ Vercel Serverless Functions 54 | - ✅ Vercel Edge Functions 55 | - ✅ Netlify Functions 56 | - ✅ Netlify Edge Functions 57 | - ✅ Bun 58 | 59 | ## Limitations 60 | 61 | Supabase-js cannot do cross schema joins. This may change, but in the meantime your options are: 62 | 63 | 1. put all stripe tables in public (with a `stripe_` prefix) 64 | 2. use another database client (eg. [Kysely](https://github.com/koskimas/kysely)) 65 | 66 | Additionally, the Supabase Studio dashboard/table editor becomes very slow for large numbers of tables. 67 | 68 | - for now, stripe-sync only works on the 2022-08-01 api version. 69 | 70 | ## Prior Work 71 | 72 | This project is inspired by all of the projects listed below. 73 | 74 | - https://github.com/supabase/stripe-sync-engine 75 | 76 | - Needs a full blown Docker setup to run. This is a bit overkill for a simple webhook syncer. 77 | - Can sync only a limited subset of Webhook events as of August 2022 78 | - Only syncs to Supabase/Postgrest 79 | 80 | - https://www.sequin.io/ 81 | 82 | - Their stripe sync is pretty pricey, but it's currently more mature/robust 83 | - Not open source 84 | - Only syncs to Postgres 85 | 86 | - https://github.com/supabase/examples/blob/main/supabase-js-v1/edge-functions/supabase/functions/stripe-webhooks/index.ts 87 | 88 | ## Todos 89 | 90 | - [x] make ids primary keys 91 | - [ ] automatically register webhooks with stripe 92 | - [x] `stripe_` prefix ddl option 93 | - [x] webhook callback functions on for custom logic 94 | - [ ] implement all stripe best practices 95 | - [ ] make event handling idempotent (https://stripe.com/docs/webhooks/best-practices) 96 | - [ ] check that request comes from valid ip or is local development (https://stripe.com/files/ips/ips_webhooks.json) 97 | - [x] next.js adapter 98 | - [ ] fetch adapter (remix/cloudflare/deno/bun) 99 | - [ ] add tests 100 | - [ ] add resync 101 | - [ ] add relations 102 | - [ ] fix external accounts 103 | 104 | ## Tests 105 | 106 | Currently tested on every trigger supported by the Stripe CLI. 107 | 108 | More robust tests coming soon. 109 | 110 | ## License 111 | 112 | [MIT](https://github.com/lawrencecchen/stripe-sync/blob/main/LICENSE) 113 | 114 | Copyright (c) 2022-present, Lawrence Chen 115 | -------------------------------------------------------------------------------- /apps/docs/docs/.vitepress/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitepress"; 2 | 3 | export default defineConfig({ 4 | lang: "en-US", 5 | title: "Stripe Sync", 6 | description: "Sync Stripe Webhook events directly into your database.", 7 | themeConfig: { 8 | socialLinks: [ 9 | { icon: "github", link: "https://github.com/lawrencecchen/stripe-sync" }, 10 | ], 11 | footer: { 12 | message: "Released under the MIT License.", 13 | copyright: "Copyright © 2022-present Lawrence Chen", 14 | }, 15 | }, 16 | }); 17 | -------------------------------------------------------------------------------- /apps/docs/docs/supabase-schema-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lawrencecchen/stripe-sync/fe3e2418b40de596b562e964ec507526fbb3c59c/apps/docs/docs/supabase-schema-settings.png -------------------------------------------------------------------------------- /apps/docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "private": true, 4 | "description": "", 5 | "scripts": { 6 | "docs:dev": "vitepress dev docs", 7 | "docs:build": "vitepress build docs", 8 | "docs:serve": "vitepress serve docs" 9 | }, 10 | "keywords": [], 11 | "author": "Lawrence Chen", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "vitepress": "1.0.0-alpha.8", 15 | "vue": "^3.2.37" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /bunny.md: -------------------------------------------------------------------------------- 1 | ## webhook testing 2 | 3 | # stripe openapi 4 | 5 | https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ 6 | https://stripe.com/files/ips/ips_webhooks.json 7 | 8 | # future features 9 | 10 | - maybe refetch event? 11 | 12 | - https://github.com/supabase/examples/blob/main/supabase-js-v1/edge-functions/supabase/functions/stripe-webhooks/index.ts 13 | 14 | ## Webhook Progress 15 | 16 | (They're all supported) 17 | 18 | - ✅ `account.application.authorized` 19 | - ✅ `account.application.deauthorized` 20 | - ✅ `account.external_account.created` 21 | - ✅ `account.external_account.deleted` 22 | - ✅ `account.external_account.updated` 23 | - ✅ `account.updated` 24 | - ✅ `application_fee.created` 25 | - ✅ `application_fee.refund.updated` 26 | - ✅ `application_fee.refunded` 27 | - ✅ `balance.available` 28 | - ✅ `billing_portal.configuration.created` 29 | - ✅ `billing_portal.configuration.updated` 30 | - ✅ `billing_portal.session.created` 31 | - ✅ `capability.updated` 32 | - ✅ `cash_balance.funds_available` 33 | - ✅ `charge.captured` 34 | - ✅ `charge.dispute.closed` 35 | - ✅ `charge.dispute.created` 36 | - ✅ `charge.dispute.funds_reinstated` 37 | - ✅ `charge.dispute.funds_withdrawn` 38 | - ✅ `charge.dispute.updated` 39 | - ✅ `charge.expired` 40 | - ✅ `charge.failed` 41 | - ✅ `charge.pending` 42 | - ✅ `charge.refund.updated` 43 | - ✅ `charge.refunded` 44 | - ✅ `charge.succeeded` 45 | - ✅ `charge.updated` 46 | - ✅ `checkout.session.async_payment_failed` 47 | - ✅ `checkout.session.async_payment_succeeded` 48 | - ✅ `checkout.session.completed` 49 | - ✅ `checkout.session.expired` 50 | - ✅ `coupon.created` 51 | - ✅ `coupon.deleted` 52 | - ✅ `coupon.updated` 53 | - ✅ `credit_note.created` 54 | - ✅ `credit_note.updated` 55 | - ✅ `credit_note.voided` 56 | - ✅ `customer.created` 57 | - ✅ `customer.deleted` 58 | - ✅ `customer.discount.created` 59 | - ✅ `customer.discount.deleted` 60 | - ✅ `customer.discount.updated` 61 | - ✅ `customer.source.created` 62 | - ✅ `customer.source.deleted` 63 | - ✅ `customer.source.expiring` 64 | - ✅ `customer.source.updated` 65 | - ✅ `customer.subscription.created` 66 | - ✅ `customer.subscription.deleted` 67 | - ✅ `customer.subscription.pending_update_applied` 68 | - ✅ `customer.subscription.pending_update_expired` 69 | - ✅ `customer.subscription.trial_will_end` 70 | - ✅ `customer.subscription.updated` 71 | - ✅ `customer.tax_id.created` 72 | - ✅ `customer.tax_id.deleted` 73 | - ✅ `customer.tax_id.updated` 74 | - ✅ `customer.updated` 75 | - ✅ `file.created` 76 | - ✅ `financial_connections.account.created` 77 | - ✅ `financial_connections.account.deactivated` 78 | - ✅ `financial_connections.account.disconnected` 79 | - ✅ `financial_connections.account.reactivated` 80 | - ✅ `financial_connections.account.refreshed_balance` 81 | - ✅ `identity.verification_session.canceled` 82 | - ✅ `identity.verification_session.created` 83 | - ✅ `identity.verification_session.processing` 84 | - ✅ `identity.verification_session.redacted` 85 | - ✅ `identity.verification_session.requires_input` 86 | - ✅ `identity.verification_session.verified` 87 | - ✅ `invoice.created` 88 | - ✅ `invoice.deleted` 89 | - ✅ `invoice.finalization_failed` 90 | - ✅ `invoice.finalized` 91 | - ✅ `invoice.marked_uncollectible` 92 | - ✅ `invoice.paid` 93 | - ✅ `invoice.payment_action_required` 94 | - ✅ `invoice.payment_failed` 95 | - ✅ `invoice.payment_succeeded` 96 | - ✅ `invoice.sent` 97 | - ✅ `invoice.upcoming` 98 | - ✅ `invoice.updated` 99 | - ✅ `invoice.voided` 100 | - ✅ `invoiceitem.created` 101 | - ✅ `invoiceitem.deleted` 102 | - ✅ `invoiceitem.updated` 103 | - ✅ `issuing_authorization.created` 104 | - ✅ `issuing_authorization.request` 105 | - ✅ `issuing_authorization.updated` 106 | - ✅ `issuing_card.created` 107 | - ✅ `issuing_card.updated` 108 | - ✅ `issuing_cardholder.created` 109 | - ✅ `issuing_cardholder.updated` 110 | - ✅ `issuing_dispute.closed` 111 | - ✅ `issuing_dispute.created` 112 | - ✅ `issuing_dispute.funds_reinstated` 113 | - ✅ `issuing_dispute.submitted` 114 | - ✅ `issuing_dispute.updated` 115 | - ✅ `issuing_transaction.created` 116 | - ✅ `issuing_transaction.updated` 117 | - ✅ `mandate.updated` 118 | - ✅ `order.created` 119 | - ✅ `payment_intent.amount_capturable_updated` 120 | - ✅ `payment_intent.canceled` 121 | - ✅ `payment_intent.created` 122 | - ✅ `payment_intent.partially_funded` 123 | - ✅ `payment_intent.payment_failed` 124 | - ✅ `payment_intent.processing` 125 | - ✅ `payment_intent.requires_action` 126 | - ✅ `payment_intent.succeeded` 127 | - ✅ `payment_link.created` 128 | - ✅ `payment_link.updated` 129 | - ✅ `payment_method.attached` 130 | - ✅ `payment_method.automatically_updated` 131 | - ✅ `payment_method.detached` 132 | - ✅ `payment_method.updated` 133 | - ✅ `payout.canceled` 134 | - ✅ `payout.created` 135 | - ✅ `payout.failed` 136 | - ✅ `payout.paid` 137 | - ✅ `payout.updated` 138 | - ✅ `person.created` 139 | - ✅ `person.deleted` 140 | - ✅ `person.updated` 141 | - ✅ `plan.created` 142 | - ✅ `plan.deleted` 143 | - ✅ `plan.updated` 144 | - ✅ `price.created` 145 | - ✅ `price.deleted` 146 | - ✅ `price.updated` 147 | - ✅ `product.created` 148 | - ✅ `product.deleted` 149 | - ✅ `product.updated` 150 | - ✅ `promotion_code.created` 151 | - ✅ `promotion_code.updated` 152 | - ✅ `quote.accepted` 153 | - ✅ `quote.canceled` 154 | - ✅ `quote.created` 155 | - ✅ `quote.finalized` 156 | - ✅ `radar.early_fraud_warning.created` 157 | - ✅ `radar.early_fraud_warning.updated` 158 | - ✅ `recipient.created` 159 | - ✅ `recipient.deleted` 160 | - ✅ `recipient.updated` 161 | - ✅ `reporting.report_run.failed` 162 | - ✅ `reporting.report_run.succeeded` 163 | - ✅ `reporting.report_type.updated` 164 | - ✅ `review.closed` 165 | - ✅ `review.opened` 166 | - ✅ `setup_intent.canceled` 167 | - ✅ `setup_intent.created` 168 | - ✅ `setup_intent.requires_action` 169 | - ✅ `setup_intent.setup_failed` 170 | - ✅ `setup_intent.succeeded` 171 | - ✅ `sigma.scheduled_query_run.created` 172 | - ✅ `sku.created` 173 | - ✅ `sku.deleted` 174 | - ✅ `sku.updated` 175 | - ✅ `source.canceled` 176 | - ✅ `source.chargeable` 177 | - ✅ `source.failed` 178 | - ✅ `source.mandate_notification` 179 | - ✅ `source.refund_attributes_required` 180 | - ✅ `source.transaction.created` 181 | - ✅ `source.transaction.updated` 182 | - ✅ `subscription_schedule.aborted` 183 | - ✅ `subscription_schedule.canceled` 184 | - ✅ `subscription_schedule.completed` 185 | - ✅ `subscription_schedule.created` 186 | - ✅ `subscription_schedule.expiring` 187 | - ✅ `subscription_schedule.released` 188 | - ✅ `subscription_schedule.updated` 189 | - ✅ `tax_rate.created` 190 | - ✅ `tax_rate.updated` 191 | - ✅ `terminal.reader.action_failed` 192 | - ✅ `terminal.reader.action_succeeded` 193 | - ✅ `test_helpers.test_clock.advancing` 194 | - ✅ `test_helpers.test_clock.created` 195 | - ✅ `test_helpers.test_clock.deleted` 196 | - ✅ `test_helpers.test_clock.internal_failure` 197 | - ✅ `test_helpers.test_clock.ready` 198 | - ✅ `topup.canceled` 199 | - ✅ `topup.created` 200 | - ✅ `topup.failed` 201 | - ✅ `topup.reversed` 202 | - ✅ `topup.succeeded` 203 | - ✅ `transfer.created` 204 | - ✅ `transfer.reversed` 205 | - ✅ `transfer.updated` 206 | - ✅ `treasury.credit_reversal.created` 207 | - ✅ `treasury.credit_reversal.posted` 208 | - ✅ `treasury.debit_reversal.completed` 209 | - ✅ `treasury.debit_reversal.created` 210 | - ✅ `treasury.debit_reversal.initial_credit_granted` 211 | - ✅ `treasury.financial_account.closed` 212 | - ✅ `treasury.financial_account.created` 213 | - ✅ `treasury.financial_account.features_status_updated` 214 | - ✅ `treasury.inbound_transfer.canceled` 215 | - ✅ `treasury.inbound_transfer.created` 216 | - ✅ `treasury.inbound_transfer.failed` 217 | - ✅ `treasury.inbound_transfer.succeeded` 218 | - ✅ `treasury.outbound_payment.canceled` 219 | - ✅ `treasury.outbound_payment.created` 220 | - ✅ `treasury.outbound_payment.expected_arrival_date_updated` 221 | - ✅ `treasury.outbound_payment.failed` 222 | - ✅ `treasury.outbound_payment.posted` 223 | - ✅ `treasury.outbound_payment.returned` 224 | - ✅ `treasury.outbound_transfer.canceled` 225 | - ✅ `treasury.outbound_transfer.created` 226 | - ✅ `treasury.outbound_transfer.expected_arrival_date_updated` 227 | - ✅ `treasury.outbound_transfer.failed` 228 | - ✅ `treasury.outbound_transfer.posted` 229 | - ✅ `treasury.outbound_transfer.returned` 230 | - ✅ `treasury.received_credit.created` 231 | - ✅ `treasury.received_credit.failed` 232 | - ✅ `treasury.received_credit.succeeded` 233 | - ✅ `treasury.received_debit.created` 234 | -------------------------------------------------------------------------------- /examples/nextjs/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { 4 | "project": "./tsconfig.json" 5 | }, 6 | "plugins": ["@typescript-eslint"], 7 | "extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], 8 | "rules": { 9 | "@typescript-eslint/consistent-type-imports": "warn" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/nextjs/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # database 12 | /prisma/db.sqlite 13 | /prisma/db.sqlite-journal 14 | 15 | # next.js 16 | /.next/ 17 | /out/ 18 | 19 | # production 20 | /build 21 | 22 | # misc 23 | .DS_Store 24 | *.pem 25 | 26 | # debug 27 | npm-debug.log* 28 | yarn-debug.log* 29 | yarn-error.log* 30 | .pnpm-debug.log* 31 | 32 | # local env files 33 | .env 34 | .env*.local 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | -------------------------------------------------------------------------------- /examples/nextjs/README.md: -------------------------------------------------------------------------------- 1 | # Create T3 App 2 | 3 | This is an app bootstrapped according to the [init.tips](https://init.tips) stack, also known as the T3-Stack. 4 | 5 | ## What's next? How do I make an app with this? 6 | 7 | We try to keep this project as simple as possible, so you can start with the most basic configuration and then move on to more advanced configuration. 8 | 9 | If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help. 10 | 11 | - [Next-Auth.js](https://next-auth.js.org) 12 | - [Prisma](https://prisma.io) 13 | - [TailwindCSS](https://tailwindcss.com) 14 | - [tRPC](https://trpc.io) 15 | 16 | We also [roll our own docs](https://beta.create.t3.gg) with some summary information and links to the respective documentation. 17 | 18 | Also checkout these awesome tutorials on `create-t3-app`. 19 | 20 | - [Build a Blog With the T3 Stack - tRPC, TypeScript, Next.js, Prisma & Zod](https://www.youtube.com/watch?v=syEWlxVFUrY) 21 | - [Build a Live Chat Application with the T3 Stack - TypeScript, Tailwind, tRPC](https://www.youtube.com/watch?v=dXRRY37MPuk) 22 | - [Build a full stack app with create-t3-app](https://www.nexxel.dev/blog/ct3a-guestbook) 23 | - [A first look at create-t3-app](https://dev.to/ajcwebdev/a-first-look-at-create-t3-app-1i8f) 24 | 25 | ## How do I deploy this? 26 | 27 | Follow our deployment guides for [Vercel](https://beta.create.t3.gg/en/deployment/vercel) and [Docker](https://beta.create.t3.gg/en/deployment/docker) for more information. 28 | -------------------------------------------------------------------------------- /examples/nextjs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /examples/nextjs/next.config.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | /** 3 | * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. 4 | * This is especially useful for Docker builds. 5 | */ 6 | !process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs")); 7 | 8 | /** @type {import("next").NextConfig} */ 9 | const config = { 10 | reactStrictMode: true, 11 | swcMinify: true, 12 | i18n: { 13 | locales: ["en"], 14 | defaultLocale: "en", 15 | }, 16 | }; 17 | export default config; 18 | -------------------------------------------------------------------------------- /examples/nextjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nextjs", 3 | "version": "0.1.4", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "next": "13.0.2", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0", 15 | "stripe": "^10.2.0", 16 | "stripe-sync": "^0.1.4", 17 | "zod": "^3.18.0" 18 | }, 19 | "devDependencies": { 20 | "@types/node": "^18.0.0", 21 | "@types/react": "^18.0.14", 22 | "@types/react-dom": "^18.0.5", 23 | "@typescript-eslint/eslint-plugin": "^5.33.0", 24 | "@typescript-eslint/parser": "^5.33.0", 25 | "eslint": "^8.26.0", 26 | "eslint-config-next": "13.0.2", 27 | "typescript": "^4.8.4" 28 | }, 29 | "ct3aMetadata": { 30 | "initVersion": "6.8.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/nextjs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lawrencecchen/stripe-sync/fe3e2418b40de596b562e964ec507526fbb3c59c/examples/nextjs/public/favicon.ico -------------------------------------------------------------------------------- /examples/nextjs/src/env/client.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import { clientEnv, clientSchema } from "./schema.mjs"; 3 | 4 | const _clientEnv = clientSchema.safeParse(clientEnv); 5 | 6 | export const formatErrors = ( 7 | /** @type {import('zod').ZodFormattedError,string>} */ 8 | errors, 9 | ) => 10 | Object.entries(errors) 11 | .map(([name, value]) => { 12 | if (value && "_errors" in value) 13 | return `${name}: ${value._errors.join(", ")}\n`; 14 | }) 15 | .filter(Boolean); 16 | 17 | if (!_clientEnv.success) { 18 | console.error( 19 | "❌ Invalid environment variables:\n", 20 | ...formatErrors(_clientEnv.error.format()), 21 | ); 22 | throw new Error("Invalid environment variables"); 23 | } 24 | 25 | for (let key of Object.keys(_clientEnv.data)) { 26 | if (!key.startsWith("NEXT_PUBLIC_")) { 27 | console.warn( 28 | `❌ Invalid public environment variable name: ${key}. It must begin with 'NEXT_PUBLIC_'`, 29 | ); 30 | 31 | throw new Error("Invalid public environment variable name"); 32 | } 33 | } 34 | 35 | export const env = _clientEnv.data; 36 | -------------------------------------------------------------------------------- /examples/nextjs/src/env/schema.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import { z } from "zod"; 3 | 4 | /** 5 | * Specify your server-side environment variables schema here. 6 | * This way you can ensure the app isn't built with invalid env vars. 7 | */ 8 | export const serverSchema = z.object({ 9 | NODE_ENV: z.enum(["development", "test", "production"]), 10 | STRIPE_SK: z.string(), 11 | STRIPE_ENDPOINT_SECRET: z.string(), 12 | }); 13 | 14 | /** 15 | * Specify your client-side environment variables schema here. 16 | * This way you can ensure the app isn't built with invalid env vars. 17 | * To expose them to the client, prefix them with `NEXT_PUBLIC_`. 18 | */ 19 | export const clientSchema = z.object({ 20 | // NEXT_PUBLIC_CLIENTVAR: z.string(), 21 | }); 22 | 23 | /** 24 | * You can't destruct `process.env` as a regular object, so you have to do 25 | * it manually here. This is because Next.js evaluates this at build time, 26 | * and only used environment variables are included in the build. 27 | * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} 28 | */ 29 | export const clientEnv = { 30 | // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, 31 | }; 32 | -------------------------------------------------------------------------------- /examples/nextjs/src/env/server.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | /** 3 | * This file is included in `/next.config.mjs` which ensures the app isn't built with invalid env vars. 4 | * It has to be a `.mjs`-file to be imported there. 5 | */ 6 | import { serverSchema } from "./schema.mjs"; 7 | import { env as clientEnv, formatErrors } from "./client.mjs"; 8 | 9 | const _serverEnv = serverSchema.safeParse(process.env); 10 | 11 | if (!_serverEnv.success) { 12 | console.error( 13 | "❌ Invalid environment variables:\n", 14 | ...formatErrors(_serverEnv.error.format()), 15 | ); 16 | throw new Error("Invalid environment variables"); 17 | } 18 | 19 | for (let key of Object.keys(_serverEnv.data)) { 20 | if (key.startsWith("NEXT_PUBLIC_")) { 21 | console.warn("❌ You are exposing a server-side env-variable:", key); 22 | 23 | throw new Error("You are exposing a server-side env-variable"); 24 | } 25 | } 26 | 27 | export const env = { ..._serverEnv.data, ...clientEnv }; 28 | -------------------------------------------------------------------------------- /examples/nextjs/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { type AppType } from "next/dist/shared/lib/utils"; 2 | 3 | import "../styles/globals.css"; 4 | 5 | const MyApp: AppType = ({ Component, pageProps }) => { 6 | return ; 7 | }; 8 | 9 | export default MyApp; 10 | -------------------------------------------------------------------------------- /examples/nextjs/src/pages/api/stripe.ts: -------------------------------------------------------------------------------- 1 | import Stripe from "stripe"; 2 | import { createNextHandler } from "stripe-sync/adapters/next"; 3 | import { env } from "../../env/server.mjs"; 4 | 5 | const stripe = new Stripe(env.STRIPE_SK, { 6 | apiVersion: "2022-08-01", 7 | }); 8 | 9 | export default createNextHandler({ 10 | stripe, 11 | stripeEndpointSecret: env.STRIPE_ENDPOINT_SECRET, 12 | stripeSecretKey: env.STRIPE_SK, 13 | callbacks: { 14 | "payment_intent.created": async (event) => { 15 | console.log(event); 16 | }, 17 | }, 18 | }); 19 | 20 | export const config = { 21 | api: { 22 | bodyParser: false, 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /examples/nextjs/src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | .containerOuter { 2 | --color-gray-500: rgba(107, 114, 128, 100%); 3 | --color-gray-600: rgba(75, 85, 99, 100%); 4 | --color-gray-700: rgba(55, 65, 81, 100%); 5 | --color-purple-300: rgba(216, 180, 254, 100%); 6 | --color-blue-500: rgba(59, 130, 246, 100%); 7 | --color-violet-500: rgba(139, 92, 246, 100%); 8 | --tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 9 | 0 8px 10px -6px rgb(0 0 0 / 0.1); 10 | 11 | display: flex; 12 | align-items: center; 13 | justify-content: center; 14 | width: 100vw; 15 | min-height: 100vh; 16 | } 17 | 18 | .containerInner { 19 | width: 100%; 20 | min-height: 100vh; 21 | padding: 16px; 22 | display: flex; 23 | flex-direction: column; 24 | align-items: center; 25 | justify-content: center; 26 | font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 27 | "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, 28 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 29 | } 30 | 31 | @media (min-width: 640px) { 32 | .containerInner { 33 | max-width: 640px; 34 | } 35 | } 36 | 37 | @media (min-width: 768px) { 38 | .containerInner { 39 | max-width: 768px; 40 | } 41 | } 42 | 43 | @media (min-width: 1024px) { 44 | .containerInner { 45 | max-width: 1024px; 46 | } 47 | } 48 | 49 | @media (min-width: 1280px) { 50 | .containerInner { 51 | max-width: 1280px; 52 | } 53 | } 54 | 55 | @media (min-width: 1536px) { 56 | .containerInner { 57 | max-width: 1536px; 58 | } 59 | } 60 | 61 | .title { 62 | margin: 0; 63 | font-size: 3rem; 64 | font-weight: 800; 65 | line-height: 1.5; 66 | color: var(--color-gray-700); 67 | } 68 | 69 | @media (min-width: 768px) { 70 | .title { 71 | font-size: 5rem; 72 | } 73 | } 74 | 75 | .titlePink { 76 | color: var(--color-purple-300); 77 | } 78 | 79 | .subtitle { 80 | margin: 0; 81 | color: var(--color-gray-700); 82 | font-weight: 400; 83 | font-size: 1.5rem; 84 | line-height: 2rem; 85 | } 86 | 87 | .cardGrid { 88 | display: grid; 89 | gap: 0.75rem; 90 | padding-top: 0.75rem; 91 | margin-top: 0.75rem; 92 | text-align: center; 93 | } 94 | 95 | @media (min-width: 768px) { 96 | .cardGrid { 97 | grid-template-columns: repeat(2, minmax(0, 1fr)); 98 | } 99 | } 100 | 101 | @media (min-width: 1024px) { 102 | .cardGrid { 103 | width: calc(200% / 3); 104 | } 105 | } 106 | 107 | .card { 108 | display: flex; 109 | flex-direction: column; 110 | justify-content: center; 111 | padding: 1.5rem; 112 | transition-duration: 500ms; 113 | border: 2px solid var(--color-gray-500); 114 | border-radius: 0.25rem; 115 | box-shadow: var(--tw-shadow); 116 | } 117 | 118 | .card:hover { 119 | transform: scale(1.05); 120 | } 121 | 122 | @media (prefers-reduced-motion) { 123 | .card:hover { 124 | transform: none; 125 | } 126 | } 127 | 128 | .cardTitle { 129 | margin: 0; 130 | font-size: 1.125rem; 131 | line-height: 1.75rem; 132 | font-weight: 400; 133 | color: var(--color-gray-500); 134 | } 135 | 136 | .cardDescription { 137 | margin: 0; 138 | font-size: 0.875rem; 139 | line-height: 1.25rem; 140 | color: var(--color-gray-600); 141 | } 142 | 143 | .cardDocumentation { 144 | margin-top: 0.75rem; 145 | font-size: 0.875rem; 146 | line-height: 1.25rem; 147 | text-decoration-line: underline; 148 | -webkit-text-decoration-line: underline; 149 | text-decoration-style: dotted; 150 | -webkit-text-decoration-style: dotted; 151 | text-underline-offset: 2px; 152 | color: var(--color-violet-500); 153 | } 154 | 155 | .helloFrom { 156 | padding-top: 1.5rem; 157 | font-size: 1.5rem; 158 | line-height: 2rem; 159 | color: var(--color-blue-500); 160 | display: flex; 161 | align-items: center; 162 | justify-content: center; 163 | width: 100%; 164 | } 165 | 166 | .helloFrom p { 167 | margin: 0; 168 | } 169 | 170 | .authShowcase { 171 | margin: 2rem; 172 | display: flex; 173 | flex-direction: column; 174 | align-items: center; 175 | gap: 16px; 176 | } 177 | 178 | .loginInfo { 179 | color: var(--color-blue-500); 180 | font-size: 1.5rem; 181 | line-height: 2rem; 182 | } 183 | 184 | .signInButton { 185 | padding: 0.5rem 1rem; 186 | border: 1px solid black; 187 | background-color: rgba(245, 243, 255, 100%); 188 | font-size: 1.25rem; 189 | line-height: 1.75rem; 190 | border-radius: 0.375rem; 191 | box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); 192 | } 193 | 194 | .signInButton:hover { 195 | background-color: rgba(237, 233, 254, 100%); 196 | } 197 | -------------------------------------------------------------------------------- /examples/nextjs/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { type NextPage } from "next"; 2 | import Head from "next/head"; 3 | import Link from "next/link"; 4 | 5 | import styles from "./index.module.css"; 6 | 7 | const Home: NextPage = () => { 8 | return ( 9 | <> 10 | 11 | Create T3 App 12 | 13 | 14 | 15 | 16 | 17 | 18 | Create T3 App 19 | 20 | 21 | This stack uses: 22 | 23 | 28 | 33 | 38 | 43 | 48 | 53 | 54 | 55 | 56 | > 57 | ); 58 | }; 59 | 60 | export default Home; 61 | 62 | type TechnologyCardProps = { 63 | name: string; 64 | description: string; 65 | documentation: string; 66 | }; 67 | 68 | const TechnologyCard: React.FC = ({ 69 | name, 70 | description, 71 | documentation, 72 | }) => { 73 | return ( 74 | 75 | {name} 76 | {description} 77 | 83 | Documentation 84 | 85 | 86 | ); 87 | }; 88 | -------------------------------------------------------------------------------- /examples/nextjs/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | } 8 | 9 | a { 10 | color: inherit; 11 | text-decoration: none; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | -------------------------------------------------------------------------------- /examples/nextjs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true, 17 | "noUncheckedIndexedAccess": true 18 | }, 19 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.cjs", "**/*.mjs"], 20 | "exclude": ["node_modules"] 21 | } 22 | -------------------------------------------------------------------------------- /examples/supabase-edge-functions/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "denoland.vscode-deno" 4 | ] 5 | } -------------------------------------------------------------------------------- /examples/supabase-edge-functions/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.unstable": true 4 | } -------------------------------------------------------------------------------- /examples/supabase-edge-functions/supabase/config.toml: -------------------------------------------------------------------------------- 1 | # A string used to distinguish different Supabase projects on the same host. Defaults to the working 2 | # directory name when running `supabase init`. 3 | project_id = "supabase-edge-functions" 4 | 5 | [api] 6 | # Port to use for the API URL. 7 | port = 54321 8 | # Schemas to expose in your API. Tables, views and stored procedures in this schema will get API 9 | # endpoints. public and storage are always included. 10 | schemas = [] 11 | # Extra schemas to add to the search_path of every request. 12 | extra_search_path = ["extensions"] 13 | # The maximum number of rows returns from a view, table, or stored procedure. Limits payload size 14 | # for accidental or malicious requests. 15 | max_rows = 1000 16 | 17 | [db] 18 | # Port to use for the local database URL. 19 | port = 54322 20 | # The database major version to use. This has to be the same as your remote database's. Run `SHOW 21 | # server_version;` on the remote database to check. 22 | major_version = 14 23 | 24 | [studio] 25 | # Port to use for Supabase Studio. 26 | port = 54323 27 | 28 | # Email testing server. Emails sent with the local dev setup are not actually sent - rather, they 29 | # are monitored, and you can view the emails that would have been sent from the web interface. 30 | [inbucket] 31 | # Port to use for the email testing server web interface. 32 | port = 54324 33 | 34 | [auth] 35 | # The base URL of your website. Used as an allow-list for redirects and for constructing URLs used 36 | # in emails. 37 | site_url = "http://localhost:3000" 38 | # A list of *exact* URLs that auth providers are permitted to redirect to post authentication. 39 | additional_redirect_urls = ["https://localhost:3000"] 40 | # How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 seconds (one 41 | # week). 42 | jwt_expiry = 3600 43 | # Allow/disallow new user signups to your project. 44 | enable_signup = true 45 | 46 | [auth.email] 47 | # Allow/disallow new user signups via email to your project. 48 | enable_signup = true 49 | # If enabled, a user will be required to confirm any email change on both the old, and new email 50 | # addresses. If disabled, only the new email is required to confirm. 51 | double_confirm_changes = true 52 | # If enabled, users need to confirm their email address before signing in. 53 | enable_confirmations = false 54 | 55 | # Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`, 56 | # `discord`, `facebook`, `github`, `gitlab`, `google`, `twitch`, `twitter`, `slack`, `spotify`. 57 | [auth.external.apple] 58 | enabled = false 59 | client_id = "" 60 | secret = "" 61 | -------------------------------------------------------------------------------- /examples/supabase-edge-functions/supabase/functions/stripe/index.ts: -------------------------------------------------------------------------------- 1 | import { serve } from "https://deno.land/std@0.131.0/http/server.ts"; 2 | import { createClient } from "https://esm.sh/@supabase/supabase-js@2.1.0"; 3 | import { createDenoHandler } from "https://esm.sh/stripe-sync@0.1.4/adapters/deno"; 4 | import { createSupabaseAdapter } from "https://esm.sh/stripe-sync@0.1.4/databaseAdapters/supabase"; 5 | import Stripe from "https://esm.sh/stripe@10.17.0?target=deno&no-check"; 6 | import invariant from "https://esm.sh/tiny-invariant@1.3.1"; 7 | 8 | const stripe = new Stripe(Deno.env.get("STRIPE_API_KEY"), { 9 | httpClient: Stripe.createFetchHttpClient(), 10 | apiVersion: "2022-08-01", 11 | }); 12 | const cryptoProvider = Stripe.createSubtleCryptoProvider(); 13 | 14 | const supabaseUrl = Deno.env.get("SUPABASE_URL"); 15 | const supabaseServiceKey = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY"); 16 | { 17 | invariant(typeof supabaseUrl === "string", "SUPABASE_URL is required"); 18 | invariant( 19 | typeof supabaseServiceKey === "string", 20 | "SUPABASE_SERVICE_ROLE_KEY is required" 21 | ); 22 | } 23 | 24 | export const supabaseClient = createClient(supabaseUrl, supabaseServiceKey, { 25 | db: { 26 | schema: "stripe", 27 | }, 28 | }); 29 | 30 | const handler = createDenoHandler({ 31 | databaseAdapter: createSupabaseAdapter({ 32 | supabase: supabaseClient, 33 | }), 34 | stripe, 35 | cryptoProvider, 36 | stripeEndpointSecret: Deno.env.get("STRIPE_ENDPOINT_SECRET") ?? "", 37 | stripeSecretKey: Deno.env.get("STRIPE_SK") ?? "", 38 | callbacks: { 39 | "payment_intent.created": (event) => { 40 | console.log(event); 41 | }, 42 | }, 43 | }); 44 | 45 | serve(handler); 46 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stripe-sync-root", 3 | "private": true, 4 | "workspaces": { 5 | "packages": [ 6 | "apps/*", 7 | "packages/*", 8 | "examples/*" 9 | ] 10 | }, 11 | "version": "0.0.1", 12 | "description": "", 13 | "main": "index.js", 14 | "scripts": { 15 | "test": "echo \"Error: no test specified\" && exit 1" 16 | }, 17 | "keywords": [], 18 | "author": "Lawrence Chen", 19 | "license": "MIT" 20 | } 21 | -------------------------------------------------------------------------------- /packages/stripe-sync/generated/eventTableMap.ts: -------------------------------------------------------------------------------- 1 | export const STRIPE_EVENT_TABLE_MAP = { 2 | "account.application.authorized": "application", 3 | "account.application.deauthorized": "application", 4 | "account.updated": "account", 5 | "application_fee.created": "application_fee", 6 | "application_fee.refund.updated": "refund", 7 | "application_fee.refunded": "application_fee", 8 | "balance.available": "balance", 9 | "billing_portal.configuration.created": "configuration", 10 | "billing_portal.configuration.updated": "configuration", 11 | "billing_portal.session.created": "session", 12 | "capability.updated": "capability", 13 | "cash_balance.funds_available": "cash_balance", 14 | "charge.captured": "charge", 15 | "charge.dispute.closed": "dispute", 16 | "charge.dispute.created": "dispute", 17 | "charge.dispute.funds_reinstated": "dispute", 18 | "charge.dispute.funds_withdrawn": "dispute", 19 | "charge.dispute.updated": "dispute", 20 | "charge.expired": "charge", 21 | "charge.failed": "charge", 22 | "charge.pending": "charge", 23 | "charge.refund.updated": "refund", 24 | "charge.refunded": "charge", 25 | "charge.succeeded": "charge", 26 | "charge.updated": "charge", 27 | "checkout.session.async_payment_failed": "checkout_session", 28 | "checkout.session.async_payment_succeeded": "checkout_session", 29 | "checkout.session.completed": "checkout_session", 30 | "checkout.session.expired": "checkout_session", 31 | "coupon.created": "coupon", 32 | "coupon.deleted": "coupon", 33 | "coupon.updated": "coupon", 34 | "credit_note.created": "credit_note", 35 | "credit_note.updated": "credit_note", 36 | "credit_note.voided": "credit_note", 37 | "customer.created": "customer", 38 | "customer.deleted": "customer", 39 | "customer.discount.created": "discount", 40 | "customer.discount.deleted": "discount", 41 | "customer.discount.updated": "discount", 42 | "customer.source.created": "source", 43 | "customer.source.deleted": "source", 44 | "customer.source.expiring": "source", 45 | "customer.source.updated": "source", 46 | "customer.subscription.created": "subscription", 47 | "customer.subscription.deleted": "subscription", 48 | "customer.subscription.pending_update_applied": "subscription", 49 | "customer.subscription.pending_update_expired": "subscription", 50 | "customer.subscription.trial_will_end": "subscription", 51 | "customer.subscription.updated": "subscription", 52 | "customer.tax_id.created": "tax_id", 53 | "customer.tax_id.deleted": "tax_id", 54 | "customer.tax_id.updated": "tax_id", 55 | "customer.updated": "customer", 56 | "customer_cash_balance_transaction.created": "customer_cash_balance_transaction", 57 | "file.created": "file", 58 | "financial_connections.account.created": "account", 59 | "financial_connections.account.deactivated": "account", 60 | "financial_connections.account.disconnected": "account", 61 | "financial_connections.account.reactivated": "account", 62 | "financial_connections.account.refreshed_balance": "account", 63 | "identity.verification_session.canceled": "verification_session", 64 | "identity.verification_session.created": "verification_session", 65 | "identity.verification_session.processing": "verification_session", 66 | "identity.verification_session.redacted": "verification_session", 67 | "identity.verification_session.requires_input": "verification_session", 68 | "identity.verification_session.verified": "verification_session", 69 | "invoice.created": "invoice", 70 | "invoice.deleted": "invoice", 71 | "invoice.finalization_failed": "invoice", 72 | "invoice.finalized": "invoice", 73 | "invoice.marked_uncollectible": "invoice", 74 | "invoice.paid": "invoice", 75 | "invoice.payment_action_required": "invoice", 76 | "invoice.payment_failed": "invoice", 77 | "invoice.payment_succeeded": "invoice", 78 | "invoice.sent": "invoice", 79 | "invoice.upcoming": "invoice", 80 | "invoice.updated": "invoice", 81 | "invoice.voided": "invoice", 82 | "invoiceitem.created": "invoiceitem", 83 | "invoiceitem.deleted": "invoiceitem", 84 | "invoiceitem.updated": "invoiceitem", 85 | "issuing_authorization.created": "issuing_authorization", 86 | "issuing_authorization.request": "issuing_authorization", 87 | "issuing_authorization.updated": "issuing_authorization", 88 | "issuing_card.created": "issuing_card", 89 | "issuing_card.updated": "issuing_card", 90 | "issuing_cardholder.created": "issuing_cardholder", 91 | "issuing_cardholder.updated": "issuing_cardholder", 92 | "issuing_dispute.closed": "issuing_dispute", 93 | "issuing_dispute.created": "issuing_dispute", 94 | "issuing_dispute.funds_reinstated": "issuing_dispute", 95 | "issuing_dispute.submitted": "issuing_dispute", 96 | "issuing_dispute.updated": "issuing_dispute", 97 | "issuing_transaction.created": "issuing_transaction", 98 | "issuing_transaction.updated": "issuing_transaction", 99 | "mandate.updated": "mandate", 100 | "order.created": "order", 101 | "payment_intent.amount_capturable_updated": "payment_intent", 102 | "payment_intent.canceled": "payment_intent", 103 | "payment_intent.created": "payment_intent", 104 | "payment_intent.partially_funded": "payment_intent", 105 | "payment_intent.payment_failed": "payment_intent", 106 | "payment_intent.processing": "payment_intent", 107 | "payment_intent.requires_action": "payment_intent", 108 | "payment_intent.succeeded": "payment_intent", 109 | "payment_link.created": "payment_link", 110 | "payment_link.updated": "payment_link", 111 | "payment_method.attached": "payment_method", 112 | "payment_method.automatically_updated": "payment_method", 113 | "payment_method.detached": "payment_method", 114 | "payment_method.updated": "payment_method", 115 | "payout.canceled": "payout", 116 | "payout.created": "payout", 117 | "payout.failed": "payout", 118 | "payout.paid": "payout", 119 | "payout.updated": "payout", 120 | "person.created": "person", 121 | "person.deleted": "person", 122 | "person.updated": "person", 123 | "plan.created": "plan", 124 | "plan.deleted": "plan", 125 | "plan.updated": "plan", 126 | "price.created": "price", 127 | "price.deleted": "price", 128 | "price.updated": "price", 129 | "product.created": "product", 130 | "product.deleted": "product", 131 | "product.updated": "product", 132 | "promotion_code.created": "promotion_code", 133 | "promotion_code.updated": "promotion_code", 134 | "quote.accepted": "quote", 135 | "quote.canceled": "quote", 136 | "quote.created": "quote", 137 | "quote.finalized": "quote", 138 | "radar.early_fraud_warning.created": "early_fraud_warning", 139 | "radar.early_fraud_warning.updated": "early_fraud_warning", 140 | "recipient.created": "recipient", 141 | "recipient.deleted": "recipient", 142 | "recipient.updated": "recipient", 143 | "reporting.report_run.failed": "report_run", 144 | "reporting.report_run.succeeded": "report_run", 145 | "reporting.report_type.updated": "report_type", 146 | "review.closed": "review", 147 | "review.opened": "review", 148 | "setup_intent.canceled": "setup_intent", 149 | "setup_intent.created": "setup_intent", 150 | "setup_intent.requires_action": "setup_intent", 151 | "setup_intent.setup_failed": "setup_intent", 152 | "setup_intent.succeeded": "setup_intent", 153 | "sigma.scheduled_query_run.created": "scheduled_query_run", 154 | "sku.created": "sku", 155 | "sku.deleted": "sku", 156 | "sku.updated": "sku", 157 | "source.canceled": "source", 158 | "source.chargeable": "source", 159 | "source.failed": "source", 160 | "source.mandate_notification": "source", 161 | "source.refund_attributes_required": "source", 162 | "source.transaction.created": "transaction", 163 | "source.transaction.updated": "transaction", 164 | "subscription_schedule.aborted": "subscription_schedule", 165 | "subscription_schedule.canceled": "subscription_schedule", 166 | "subscription_schedule.completed": "subscription_schedule", 167 | "subscription_schedule.created": "subscription_schedule", 168 | "subscription_schedule.expiring": "subscription_schedule", 169 | "subscription_schedule.released": "subscription_schedule", 170 | "subscription_schedule.updated": "subscription_schedule", 171 | "tax_rate.created": "tax_rate", 172 | "tax_rate.updated": "tax_rate", 173 | "terminal.reader.action_failed": "reader", 174 | "terminal.reader.action_succeeded": "reader", 175 | "test_helpers.test_clock.advancing": "test_clock", 176 | "test_helpers.test_clock.created": "test_clock", 177 | "test_helpers.test_clock.deleted": "test_clock", 178 | "test_helpers.test_clock.internal_failure": "test_clock", 179 | "test_helpers.test_clock.ready": "test_clock", 180 | "topup.canceled": "topup", 181 | "topup.created": "topup", 182 | "topup.failed": "topup", 183 | "topup.reversed": "topup", 184 | "topup.succeeded": "topup", 185 | "transfer.created": "transfer", 186 | "transfer.reversed": "transfer", 187 | "transfer.updated": "transfer", 188 | "treasury.credit_reversal.created": "credit_reversal", 189 | "treasury.credit_reversal.posted": "credit_reversal", 190 | "treasury.debit_reversal.completed": "debit_reversal", 191 | "treasury.debit_reversal.created": "debit_reversal", 192 | "treasury.debit_reversal.initial_credit_granted": "debit_reversal", 193 | "treasury.financial_account.closed": "financial_account", 194 | "treasury.financial_account.created": "financial_account", 195 | "treasury.financial_account.features_status_updated": "financial_account", 196 | "treasury.inbound_transfer.canceled": "inbound_transfer", 197 | "treasury.inbound_transfer.created": "inbound_transfer", 198 | "treasury.inbound_transfer.failed": "inbound_transfer", 199 | "treasury.inbound_transfer.succeeded": "inbound_transfer", 200 | "treasury.outbound_payment.canceled": "outbound_payment", 201 | "treasury.outbound_payment.created": "outbound_payment", 202 | "treasury.outbound_payment.expected_arrival_date_updated": "outbound_payment", 203 | "treasury.outbound_payment.failed": "outbound_payment", 204 | "treasury.outbound_payment.posted": "outbound_payment", 205 | "treasury.outbound_payment.returned": "outbound_payment", 206 | "treasury.outbound_transfer.canceled": "outbound_transfer", 207 | "treasury.outbound_transfer.created": "outbound_transfer", 208 | "treasury.outbound_transfer.expected_arrival_date_updated": "outbound_transfer", 209 | "treasury.outbound_transfer.failed": "outbound_transfer", 210 | "treasury.outbound_transfer.posted": "outbound_transfer", 211 | "treasury.outbound_transfer.returned": "outbound_transfer", 212 | "treasury.received_credit.created": "received_credit", 213 | "treasury.received_credit.failed": "received_credit", 214 | "treasury.received_credit.succeeded": "received_credit", 215 | "treasury.received_debit.created": "received_debit" 216 | } -------------------------------------------------------------------------------- /packages/stripe-sync/generated/mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE stripe_application ( 2 | `id` text PRIMARY KEY NOT NULL, 3 | `name` text, 4 | `object` text NOT NULL 5 | ); 6 | CREATE TABLE stripe_account ( 7 | `business_profile` json, 8 | `business_type` text, 9 | `capabilities` json, 10 | `charges_enabled` boolean, 11 | `company` json, 12 | `controller` json, 13 | `country` text, 14 | `created` integer, 15 | `default_currency` text, 16 | `details_submitted` boolean, 17 | `email` text, 18 | `external_accounts` json, 19 | `future_requirements` json, 20 | `id` text PRIMARY KEY NOT NULL, 21 | `individual` json, 22 | `metadata` json, 23 | `object` text NOT NULL, 24 | `payouts_enabled` boolean, 25 | `requirements` json, 26 | `settings` json, 27 | `tos_acceptance` json, 28 | `type` text 29 | ); 30 | CREATE TABLE stripe_application_fee ( 31 | `account` json NOT NULL, 32 | `amount` integer NOT NULL, 33 | `amount_refunded` integer NOT NULL, 34 | `application` json NOT NULL, 35 | `balance_transaction` json, 36 | `charge` json NOT NULL, 37 | `created` integer, 38 | `currency` text NOT NULL, 39 | `id` text PRIMARY KEY NOT NULL, 40 | `livemode` boolean, 41 | `object` text NOT NULL, 42 | `originating_transaction` json, 43 | `refunded` boolean NOT NULL, 44 | `refunds` json NOT NULL 45 | ); 46 | CREATE TABLE stripe_refund ( 47 | `amount` integer NOT NULL, 48 | `balance_transaction` json, 49 | `charge` json, 50 | `created` integer, 51 | `currency` text NOT NULL, 52 | `description` text, 53 | `failure_balance_transaction` json, 54 | `failure_reason` text, 55 | `id` text PRIMARY KEY NOT NULL, 56 | `instructions_email` text, 57 | `metadata` json, 58 | `next_action` json, 59 | `object` text NOT NULL, 60 | `payment_intent` json, 61 | `reason` text, 62 | `receipt_number` text, 63 | `source_transfer_reversal` json, 64 | `status` text, 65 | `transfer_reversal` json 66 | ); 67 | CREATE TABLE stripe_balance ( 68 | `available` json NOT NULL, 69 | `connect_reserved` json, 70 | `instant_available` json, 71 | `issuing` json, 72 | `livemode` boolean, 73 | `object` text NOT NULL, 74 | `pending` json NOT NULL 75 | ); 76 | CREATE TABLE stripe_configuration ( 77 | `active` boolean NOT NULL, 78 | `application` json, 79 | `business_profile` json NOT NULL, 80 | `created` integer, 81 | `default_return_url` text, 82 | `features` json NOT NULL, 83 | `id` text PRIMARY KEY NOT NULL, 84 | `is_default` boolean NOT NULL, 85 | `livemode` boolean, 86 | `metadata` json, 87 | `object` text NOT NULL, 88 | `updated` integer NOT NULL 89 | ); 90 | CREATE TABLE stripe_session ( 91 | `configuration` json, 92 | `created` integer, 93 | `customer` text NOT NULL, 94 | `id` text PRIMARY KEY NOT NULL, 95 | `livemode` boolean, 96 | `locale` text, 97 | `object` text NOT NULL, 98 | `on_behalf_of` text, 99 | `return_url` text, 100 | `url` text NOT NULL 101 | ); 102 | CREATE TABLE stripe_capability ( 103 | `account` json NOT NULL, 104 | `future_requirements` json, 105 | `id` text PRIMARY KEY NOT NULL, 106 | `object` text NOT NULL, 107 | `requested` boolean NOT NULL, 108 | `requested_at` integer, 109 | `requirements` json, 110 | `status` text 111 | ); 112 | CREATE TABLE stripe_cash_balance ( 113 | `available` json, 114 | `customer` text NOT NULL, 115 | `livemode` boolean, 116 | `object` text NOT NULL, 117 | `settings` json NOT NULL 118 | ); 119 | CREATE TABLE stripe_charge ( 120 | `amount` integer NOT NULL, 121 | `amount_captured` integer NOT NULL, 122 | `amount_refunded` integer NOT NULL, 123 | `application` json, 124 | `application_fee` json, 125 | `application_fee_amount` integer, 126 | `balance_transaction` json, 127 | `billing_details` json NOT NULL, 128 | `calculated_statement_descriptor` text, 129 | `captured` boolean NOT NULL, 130 | `created` integer, 131 | `currency` text NOT NULL, 132 | `customer` json, 133 | `description` text, 134 | `disputed` boolean NOT NULL, 135 | `failure_balance_transaction` json, 136 | `failure_code` text, 137 | `failure_message` text, 138 | `fraud_details` json, 139 | `id` text PRIMARY KEY NOT NULL, 140 | `invoice` json, 141 | `livemode` boolean, 142 | `metadata` json NOT NULL, 143 | `object` text NOT NULL, 144 | `on_behalf_of` json, 145 | `outcome` json, 146 | `paid` boolean NOT NULL, 147 | `payment_intent` json, 148 | `payment_method` text, 149 | `payment_method_details` json, 150 | `radar_options` json, 151 | `receipt_email` text, 152 | `receipt_number` text, 153 | `receipt_url` text, 154 | `refunded` boolean NOT NULL, 155 | `refunds` json NOT NULL, 156 | `review` json, 157 | `shipping` json, 158 | `source_transfer` json, 159 | `statement_descriptor` text, 160 | `statement_descriptor_suffix` text, 161 | `status` text, 162 | `transfer` json, 163 | `transfer_data` json, 164 | `transfer_group` text 165 | ); 166 | CREATE TABLE stripe_dispute ( 167 | `amount` integer NOT NULL, 168 | `balance_transactions` json NOT NULL, 169 | `charge` json NOT NULL, 170 | `created` integer, 171 | `currency` text NOT NULL, 172 | `evidence` json NOT NULL, 173 | `evidence_details` json NOT NULL, 174 | `id` text PRIMARY KEY NOT NULL, 175 | `is_charge_refundable` boolean NOT NULL, 176 | `livemode` boolean, 177 | `metadata` json NOT NULL, 178 | `object` text NOT NULL, 179 | `payment_intent` json, 180 | `reason` text NOT NULL, 181 | `status` text 182 | ); 183 | CREATE TABLE stripe_checkout_session ( 184 | `after_expiration` json, 185 | `allow_promotion_codes` boolean, 186 | `amount_subtotal` integer, 187 | `amount_total` integer, 188 | `automatic_tax` json NOT NULL, 189 | `billing_address_collection` text, 190 | `cancel_url` text NOT NULL, 191 | `client_reference_id` text, 192 | `consent` json, 193 | `consent_collection` json, 194 | `currency` text, 195 | `customer` json, 196 | `customer_creation` text, 197 | `customer_details` json, 198 | `customer_email` text, 199 | `expires_at` integer NOT NULL, 200 | `id` text PRIMARY KEY NOT NULL, 201 | `line_items` json, 202 | `livemode` boolean, 203 | `locale` text, 204 | `metadata` json, 205 | `mode` text NOT NULL, 206 | `object` text NOT NULL, 207 | `payment_intent` json, 208 | `payment_link` json, 209 | `payment_method_collection` text, 210 | `payment_method_options` json, 211 | `payment_method_types` json NOT NULL, 212 | `payment_status` text NOT NULL, 213 | `phone_number_collection` json, 214 | `recovered_from` text, 215 | `setup_intent` json, 216 | `shipping_address_collection` json, 217 | `shipping_cost` json, 218 | `shipping_details` json, 219 | `shipping_options` json NOT NULL, 220 | `status` text, 221 | `submit_type` text, 222 | `subscription` json, 223 | `success_url` text NOT NULL, 224 | `tax_id_collection` json, 225 | `total_details` json, 226 | `url` text 227 | ); 228 | CREATE TABLE stripe_coupon ( 229 | `amount_off` integer, 230 | `applies_to` json, 231 | `created` integer, 232 | `currency` text, 233 | `currency_options` json, 234 | `duration` text NOT NULL, 235 | `duration_in_months` integer, 236 | `id` text PRIMARY KEY NOT NULL, 237 | `livemode` boolean, 238 | `max_redemptions` integer, 239 | `metadata` json, 240 | `name` text, 241 | `object` text NOT NULL, 242 | `percent_off` integer, 243 | `redeem_by` integer, 244 | `times_redeemed` integer NOT NULL, 245 | `valid` boolean NOT NULL 246 | ); 247 | CREATE TABLE stripe_credit_note ( 248 | `amount` integer NOT NULL, 249 | `created` integer, 250 | `currency` text NOT NULL, 251 | `customer` json NOT NULL, 252 | `customer_balance_transaction` json, 253 | `discount_amount` integer NOT NULL, 254 | `discount_amounts` json NOT NULL, 255 | `id` text PRIMARY KEY NOT NULL, 256 | `invoice` json NOT NULL, 257 | `lines` json NOT NULL, 258 | `livemode` boolean, 259 | `memo` text, 260 | `metadata` json, 261 | `number` text NOT NULL, 262 | `object` text NOT NULL, 263 | `out_of_band_amount` integer, 264 | `pdf` text NOT NULL, 265 | `reason` text, 266 | `refund` json, 267 | `status` text, 268 | `subtotal` integer NOT NULL, 269 | `subtotal_excluding_tax` integer, 270 | `tax_amounts` json NOT NULL, 271 | `total` integer NOT NULL, 272 | `total_excluding_tax` integer, 273 | `type` text NOT NULL, 274 | `voided_at` integer 275 | ); 276 | CREATE TABLE stripe_customer ( 277 | `address` json, 278 | `balance` integer, 279 | `cash_balance` json, 280 | `created` integer, 281 | `currency` text, 282 | `default_source` json, 283 | `delinquent` boolean, 284 | `description` text, 285 | `discount` json, 286 | `email` text, 287 | `id` text PRIMARY KEY NOT NULL, 288 | `invoice_credit_balance` json, 289 | `invoice_prefix` text, 290 | `invoice_settings` json, 291 | `livemode` boolean, 292 | `metadata` json, 293 | `name` text, 294 | `next_invoice_sequence` integer, 295 | `object` text NOT NULL, 296 | `phone` text, 297 | `preferred_locales` json, 298 | `shipping` json, 299 | `sources` json, 300 | `subscriptions` json, 301 | `tax` json, 302 | `tax_exempt` text, 303 | `tax_ids` json, 304 | `test_clock` json 305 | ); 306 | CREATE TABLE stripe_discount ( 307 | `checkout_session` text, 308 | `coupon` json NOT NULL, 309 | `customer` json, 310 | `end` integer, 311 | `id` text PRIMARY KEY NOT NULL, 312 | `invoice` text, 313 | `invoice_item` text, 314 | `object` text NOT NULL, 315 | `promotion_code` json, 316 | `start` integer NOT NULL, 317 | `subscription` text 318 | ); 319 | CREATE TABLE stripe_source ( 320 | `ach_credit_transfer` json, 321 | `ach_debit` json, 322 | `acss_debit` json, 323 | `alipay` json, 324 | `amount` integer, 325 | `au_becs_debit` json, 326 | `bancontact` json, 327 | `card` json, 328 | `card_present` json, 329 | `client_secret` text, 330 | `code_verification` json, 331 | `created` integer, 332 | `currency` text, 333 | `customer` text, 334 | `eps` json, 335 | `flow` text, 336 | `giropay` json, 337 | `id` text PRIMARY KEY NOT NULL, 338 | `ideal` json, 339 | `klarna` json, 340 | `livemode` boolean, 341 | `metadata` json, 342 | `multibanco` json, 343 | `object` text NOT NULL, 344 | `owner` json, 345 | `p24` json, 346 | `receiver` json, 347 | `redirect` json, 348 | `sepa_debit` json, 349 | `sofort` json, 350 | `source_order` json, 351 | `statement_descriptor` text, 352 | `status` text, 353 | `three_d_secure` json, 354 | `type` text, 355 | `usage` text, 356 | `wechat` json 357 | ); 358 | CREATE TABLE stripe_subscription ( 359 | `application` json, 360 | `application_fee_percent` integer, 361 | `automatic_tax` json NOT NULL, 362 | `billing_cycle_anchor` integer NOT NULL, 363 | `billing_thresholds` json, 364 | `cancel_at` integer, 365 | `cancel_at_period_end` boolean NOT NULL, 366 | `canceled_at` integer, 367 | `collection_method` text NOT NULL, 368 | `created` integer, 369 | `currency` text NOT NULL, 370 | `current_period_end` integer NOT NULL, 371 | `current_period_start` integer NOT NULL, 372 | `customer` json NOT NULL, 373 | `days_until_due` integer, 374 | `default_payment_method` json, 375 | `default_source` json, 376 | `default_tax_rates` json, 377 | `description` text, 378 | `discount` json, 379 | `ended_at` integer, 380 | `id` text PRIMARY KEY NOT NULL, 381 | `items` json NOT NULL, 382 | `latest_invoice` json, 383 | `livemode` boolean, 384 | `metadata` json NOT NULL, 385 | `next_pending_invoice_item_invoice` integer, 386 | `object` text NOT NULL, 387 | `pause_collection` json, 388 | `payment_settings` json, 389 | `pending_invoice_item_interval` json, 390 | `pending_setup_intent` json, 391 | `pending_update` json, 392 | `schedule` json, 393 | `start_date` integer NOT NULL, 394 | `status` text, 395 | `test_clock` json, 396 | `transfer_data` json, 397 | `trial_end` integer, 398 | `trial_start` integer 399 | ); 400 | CREATE TABLE stripe_tax_id ( 401 | `country` text, 402 | `created` integer, 403 | `customer` json, 404 | `id` text PRIMARY KEY NOT NULL, 405 | `livemode` boolean, 406 | `object` text NOT NULL, 407 | `type` text NOT NULL, 408 | `value` text NOT NULL, 409 | `verification` json 410 | ); 411 | CREATE TABLE stripe_customer_cash_balance_transaction ( 412 | `applied_to_payment` json, 413 | `created` integer, 414 | `currency` text NOT NULL, 415 | `customer` json NOT NULL, 416 | `ending_balance` integer NOT NULL, 417 | `funded` json, 418 | `id` text PRIMARY KEY NOT NULL, 419 | `livemode` boolean, 420 | `net_amount` integer NOT NULL, 421 | `object` text NOT NULL, 422 | `refunded_from_payment` json, 423 | `type` text NOT NULL, 424 | `unapplied_from_payment` json 425 | ); 426 | CREATE TABLE stripe_file ( 427 | `created` integer, 428 | `expires_at` integer, 429 | `filename` text, 430 | `id` text PRIMARY KEY NOT NULL, 431 | `links` json, 432 | `object` text NOT NULL, 433 | `purpose` text, 434 | `size` integer NOT NULL, 435 | `title` text, 436 | `type` text, 437 | `url` text 438 | ); 439 | CREATE TABLE stripe_verification_session ( 440 | `client_secret` text, 441 | `created` integer, 442 | `id` text PRIMARY KEY NOT NULL, 443 | `last_error` json, 444 | `last_verification_report` json, 445 | `livemode` boolean, 446 | `metadata` json NOT NULL, 447 | `object` text NOT NULL, 448 | `options` json NOT NULL, 449 | `redaction` json, 450 | `status` text, 451 | `type` text, 452 | `url` text, 453 | `verified_outputs` json 454 | ); 455 | CREATE TABLE stripe_invoice ( 456 | `account_country` text, 457 | `account_name` text, 458 | `account_tax_ids` json, 459 | `amount_due` integer NOT NULL, 460 | `amount_paid` integer NOT NULL, 461 | `amount_remaining` integer NOT NULL, 462 | `application` json, 463 | `application_fee_amount` integer, 464 | `attempt_count` integer NOT NULL, 465 | `attempted` boolean NOT NULL, 466 | `auto_advance` boolean, 467 | `automatic_tax` json NOT NULL, 468 | `billing_reason` text, 469 | `charge` json, 470 | `collection_method` text NOT NULL, 471 | `created` integer, 472 | `currency` text NOT NULL, 473 | `custom_fields` json, 474 | `customer` json, 475 | `customer_address` json, 476 | `customer_email` text, 477 | `customer_name` text, 478 | `customer_phone` text, 479 | `customer_shipping` json, 480 | `customer_tax_exempt` text, 481 | `customer_tax_ids` json, 482 | `default_payment_method` json, 483 | `default_source` json, 484 | `default_tax_rates` json NOT NULL, 485 | `description` text, 486 | `discount` json, 487 | `discounts` json, 488 | `due_date` integer, 489 | `ending_balance` integer, 490 | `footer` text, 491 | `hosted_invoice_url` text, 492 | `id` text PRIMARY KEY NOT NULL, 493 | `invoice_pdf` text, 494 | `last_finalization_error` json, 495 | `lines` json NOT NULL, 496 | `livemode` boolean, 497 | `metadata` json, 498 | `next_payment_attempt` integer, 499 | `number` text, 500 | `object` text NOT NULL, 501 | `on_behalf_of` json, 502 | `paid` boolean NOT NULL, 503 | `paid_out_of_band` boolean NOT NULL, 504 | `payment_intent` json, 505 | `payment_settings` json NOT NULL, 506 | `period_end` integer NOT NULL, 507 | `period_start` integer NOT NULL, 508 | `post_payment_credit_notes_amount` integer NOT NULL, 509 | `pre_payment_credit_notes_amount` integer NOT NULL, 510 | `quote` json, 511 | `receipt_number` text, 512 | `rendering_options` json, 513 | `starting_balance` integer NOT NULL, 514 | `statement_descriptor` text, 515 | `status` text, 516 | `status_transitions` json NOT NULL, 517 | `subscription` json, 518 | `subscription_proration_date` integer, 519 | `subtotal` integer NOT NULL, 520 | `subtotal_excluding_tax` integer, 521 | `tax` integer, 522 | `test_clock` json, 523 | `threshold_reason` json, 524 | `total` integer NOT NULL, 525 | `total_discount_amounts` json, 526 | `total_excluding_tax` integer, 527 | `total_tax_amounts` json NOT NULL, 528 | `transfer_data` json, 529 | `webhooks_delivered_at` integer 530 | ); 531 | CREATE TABLE stripe_invoiceitem ( 532 | `amount` integer NOT NULL, 533 | `currency` text NOT NULL, 534 | `customer` json NOT NULL, 535 | `date` integer NOT NULL, 536 | `description` text, 537 | `discountable` boolean NOT NULL, 538 | `discounts` json, 539 | `id` text PRIMARY KEY NOT NULL, 540 | `invoice` json, 541 | `livemode` boolean, 542 | `metadata` json, 543 | `object` text NOT NULL, 544 | `period` json NOT NULL, 545 | `price` json, 546 | `proration` boolean NOT NULL, 547 | `quantity` integer NOT NULL, 548 | `subscription` json, 549 | `subscription_item` text, 550 | `tax_rates` json, 551 | `test_clock` json, 552 | `unit_amount` integer, 553 | `unit_amount_decimal` text 554 | ); 555 | CREATE TABLE stripe_issuing_authorization ( 556 | `amount` integer NOT NULL, 557 | `amount_details` json, 558 | `approved` boolean NOT NULL, 559 | `authorization_method` text NOT NULL, 560 | `balance_transactions` json NOT NULL, 561 | `card` json NOT NULL, 562 | `cardholder` json, 563 | `created` integer, 564 | `currency` text NOT NULL, 565 | `id` text PRIMARY KEY NOT NULL, 566 | `livemode` boolean, 567 | `merchant_amount` integer NOT NULL, 568 | `merchant_currency` text NOT NULL, 569 | `merchant_data` json NOT NULL, 570 | `metadata` json NOT NULL, 571 | `object` text NOT NULL, 572 | `pending_request` json, 573 | `request_history` json NOT NULL, 574 | `status` text, 575 | `transactions` json NOT NULL, 576 | `treasury` json, 577 | `verification_data` json NOT NULL, 578 | `wallet` text 579 | ); 580 | CREATE TABLE stripe_issuing_card ( 581 | `brand` text NOT NULL, 582 | `cancellation_reason` text, 583 | `cardholder` json NOT NULL, 584 | `created` integer, 585 | `currency` text NOT NULL, 586 | `cvc` text, 587 | `exp_month` integer NOT NULL, 588 | `exp_year` integer NOT NULL, 589 | `financial_account` text, 590 | `id` text PRIMARY KEY NOT NULL, 591 | `last4` text NOT NULL, 592 | `livemode` boolean, 593 | `metadata` json NOT NULL, 594 | `number` text, 595 | `object` text NOT NULL, 596 | `replaced_by` json, 597 | `replacement_for` json, 598 | `replacement_reason` text, 599 | `shipping` json, 600 | `spending_controls` json NOT NULL, 601 | `status` text, 602 | `type` text NOT NULL, 603 | `wallets` json 604 | ); 605 | CREATE TABLE stripe_issuing_cardholder ( 606 | `billing` json NOT NULL, 607 | `company` json, 608 | `created` integer, 609 | `email` text, 610 | `id` text PRIMARY KEY NOT NULL, 611 | `individual` json, 612 | `livemode` boolean, 613 | `metadata` json NOT NULL, 614 | `name` text NOT NULL, 615 | `object` text NOT NULL, 616 | `phone_number` text, 617 | `requirements` json NOT NULL, 618 | `spending_controls` json, 619 | `status` text, 620 | `type` text 621 | ); 622 | CREATE TABLE stripe_issuing_dispute ( 623 | `amount` integer NOT NULL, 624 | `balance_transactions` json, 625 | `created` integer, 626 | `currency` text NOT NULL, 627 | `evidence` json NOT NULL, 628 | `id` text PRIMARY KEY NOT NULL, 629 | `livemode` boolean, 630 | `metadata` json NOT NULL, 631 | `object` text NOT NULL, 632 | `status` text, 633 | `transaction` json NOT NULL, 634 | `treasury` json 635 | ); 636 | CREATE TABLE stripe_issuing_transaction ( 637 | `amount` integer NOT NULL, 638 | `amount_details` json, 639 | `authorization` json, 640 | `balance_transaction` json, 641 | `card` json NOT NULL, 642 | `cardholder` json, 643 | `created` integer, 644 | `currency` text NOT NULL, 645 | `dispute` json, 646 | `id` text PRIMARY KEY NOT NULL, 647 | `livemode` boolean, 648 | `merchant_amount` integer NOT NULL, 649 | `merchant_currency` text NOT NULL, 650 | `merchant_data` json NOT NULL, 651 | `metadata` json NOT NULL, 652 | `object` text NOT NULL, 653 | `purchase_details` json, 654 | `treasury` json, 655 | `type` text, 656 | `wallet` text 657 | ); 658 | CREATE TABLE stripe_mandate ( 659 | `customer_acceptance` json NOT NULL, 660 | `id` text PRIMARY KEY NOT NULL, 661 | `livemode` boolean, 662 | `multi_use` json, 663 | `object` text NOT NULL, 664 | `payment_method` json NOT NULL, 665 | `payment_method_details` json NOT NULL, 666 | `single_use` json, 667 | `status` text, 668 | `type` text NOT NULL 669 | ); 670 | CREATE TABLE stripe_order ( 671 | `amount_subtotal` integer NOT NULL, 672 | `amount_total` integer NOT NULL, 673 | `application` json, 674 | `automatic_tax` json, 675 | `billing_details` json, 676 | `client_secret` text, 677 | `created` integer, 678 | `currency` text NOT NULL, 679 | `customer` json, 680 | `description` text, 681 | `discounts` json, 682 | `id` text PRIMARY KEY NOT NULL, 683 | `ip_address` text, 684 | `line_items` json, 685 | `livemode` boolean, 686 | `metadata` json, 687 | `object` text NOT NULL, 688 | `payment` json NOT NULL, 689 | `shipping_cost` json, 690 | `shipping_details` json, 691 | `status` text, 692 | `tax_details` json, 693 | `total_details` json NOT NULL 694 | ); 695 | CREATE TABLE stripe_payment_intent ( 696 | `amount` integer NOT NULL, 697 | `amount_capturable` integer, 698 | `amount_details` json, 699 | `amount_received` integer, 700 | `application` json, 701 | `application_fee_amount` integer, 702 | `automatic_payment_methods` json, 703 | `canceled_at` integer, 704 | `cancellation_reason` text, 705 | `capture_method` text NOT NULL, 706 | `charges` json, 707 | `client_secret` text, 708 | `confirmation_method` text NOT NULL, 709 | `created` integer, 710 | `currency` text NOT NULL, 711 | `customer` json, 712 | `description` text, 713 | `id` text PRIMARY KEY NOT NULL, 714 | `invoice` json, 715 | `last_payment_error` json, 716 | `livemode` boolean, 717 | `metadata` json, 718 | `next_action` json, 719 | `object` text NOT NULL, 720 | `on_behalf_of` json, 721 | `payment_method` json, 722 | `payment_method_options` json, 723 | `payment_method_types` json NOT NULL, 724 | `processing` json, 725 | `receipt_email` text, 726 | `review` json, 727 | `setup_future_usage` text, 728 | `shipping` json, 729 | `statement_descriptor` text, 730 | `statement_descriptor_suffix` text, 731 | `status` text, 732 | `transfer_data` json, 733 | `transfer_group` text 734 | ); 735 | CREATE TABLE stripe_payment_link ( 736 | `active` boolean NOT NULL, 737 | `after_completion` json NOT NULL, 738 | `allow_promotion_codes` boolean NOT NULL, 739 | `application_fee_amount` integer, 740 | `application_fee_percent` integer, 741 | `automatic_tax` json NOT NULL, 742 | `billing_address_collection` text NOT NULL, 743 | `consent_collection` json, 744 | `currency` text NOT NULL, 745 | `customer_creation` text NOT NULL, 746 | `id` text PRIMARY KEY NOT NULL, 747 | `line_items` json, 748 | `livemode` boolean, 749 | `metadata` json NOT NULL, 750 | `object` text NOT NULL, 751 | `on_behalf_of` json, 752 | `payment_intent_data` json, 753 | `payment_method_collection` text NOT NULL, 754 | `payment_method_types` json, 755 | `phone_number_collection` json NOT NULL, 756 | `shipping_address_collection` json, 757 | `shipping_options` json NOT NULL, 758 | `submit_type` text NOT NULL, 759 | `subscription_data` json, 760 | `tax_id_collection` json NOT NULL, 761 | `transfer_data` json, 762 | `url` text NOT NULL 763 | ); 764 | CREATE TABLE stripe_payment_method ( 765 | `acss_debit` json, 766 | `affirm` json, 767 | `afterpay_clearpay` json, 768 | `alipay` json, 769 | `au_becs_debit` json, 770 | `bacs_debit` json, 771 | `bancontact` json, 772 | `billing_details` json NOT NULL, 773 | `blik` json, 774 | `boleto` json, 775 | `card` json, 776 | `card_present` json, 777 | `created` integer, 778 | `customer` json, 779 | `customer_balance` json, 780 | `eps` json, 781 | `fpx` json, 782 | `giropay` json, 783 | `grabpay` json, 784 | `id` text PRIMARY KEY NOT NULL, 785 | `ideal` json, 786 | `interac_present` json, 787 | `klarna` json, 788 | `konbini` json, 789 | `link` json, 790 | `livemode` boolean, 791 | `metadata` json, 792 | `object` text NOT NULL, 793 | `oxxo` json, 794 | `p24` json, 795 | `paynow` json, 796 | `promptpay` json, 797 | `radar_options` json, 798 | `sepa_debit` json, 799 | `sofort` json, 800 | `type` text, 801 | `us_bank_account` json, 802 | `wechat_pay` json 803 | ); 804 | CREATE TABLE stripe_payout ( 805 | `amount` integer NOT NULL, 806 | `arrival_date` integer NOT NULL, 807 | `automatic` boolean NOT NULL, 808 | `balance_transaction` json, 809 | `created` integer, 810 | `currency` text NOT NULL, 811 | `description` text, 812 | `destination` json, 813 | `failure_balance_transaction` json, 814 | `failure_code` text, 815 | `failure_message` text, 816 | `id` text PRIMARY KEY NOT NULL, 817 | `livemode` boolean, 818 | `metadata` json, 819 | `method` text NOT NULL, 820 | `object` text NOT NULL, 821 | `original_payout` json, 822 | `reversed_by` json, 823 | `source_type` text NOT NULL, 824 | `statement_descriptor` text, 825 | `status` text, 826 | `type` text 827 | ); 828 | CREATE TABLE stripe_person ( 829 | `account` text NOT NULL, 830 | `address` json, 831 | `address_kana` json, 832 | `address_kanji` json, 833 | `created` integer, 834 | `dob` json, 835 | `email` text, 836 | `first_name` text, 837 | `first_name_kana` text, 838 | `first_name_kanji` text, 839 | `full_name_aliases` json, 840 | `future_requirements` json, 841 | `gender` text, 842 | `id` text PRIMARY KEY NOT NULL, 843 | `id_number_provided` boolean, 844 | `id_number_secondary_provided` boolean, 845 | `last_name` text, 846 | `last_name_kana` text, 847 | `last_name_kanji` text, 848 | `maiden_name` text, 849 | `metadata` json, 850 | `nationality` text, 851 | `object` text NOT NULL, 852 | `phone` text, 853 | `political_exposure` text, 854 | `registered_address` json, 855 | `relationship` json, 856 | `requirements` json, 857 | `ssn_last_4_provided` boolean, 858 | `verification` json 859 | ); 860 | CREATE TABLE stripe_plan ( 861 | `active` boolean NOT NULL, 862 | `aggregate_usage` text, 863 | `amount` integer, 864 | `amount_decimal` text, 865 | `billing_scheme` text NOT NULL, 866 | `created` integer, 867 | `currency` text NOT NULL, 868 | `id` text PRIMARY KEY NOT NULL, 869 | `interval` text NOT NULL, 870 | `interval_count` integer NOT NULL, 871 | `livemode` boolean, 872 | `metadata` json, 873 | `nickname` text, 874 | `object` text NOT NULL, 875 | `product` json, 876 | `tiers` json, 877 | `tiers_mode` text, 878 | `transform_usage` json, 879 | `trial_period_days` integer, 880 | `usage_type` text NOT NULL 881 | ); 882 | CREATE TABLE stripe_price ( 883 | `active` boolean NOT NULL, 884 | `billing_scheme` text NOT NULL, 885 | `created` integer, 886 | `currency` text NOT NULL, 887 | `currency_options` json, 888 | `custom_unit_amount` json, 889 | `id` text PRIMARY KEY NOT NULL, 890 | `livemode` boolean, 891 | `lookup_key` text, 892 | `metadata` json NOT NULL, 893 | `nickname` text, 894 | `object` text NOT NULL, 895 | `product` json NOT NULL, 896 | `recurring` json, 897 | `tax_behavior` text, 898 | `tiers` json, 899 | `tiers_mode` text, 900 | `transform_quantity` json, 901 | `type` text NOT NULL, 902 | `unit_amount` integer, 903 | `unit_amount_decimal` text 904 | ); 905 | CREATE TABLE stripe_product ( 906 | `active` boolean NOT NULL, 907 | `created` integer, 908 | `default_price` json, 909 | `description` text, 910 | `id` text PRIMARY KEY NOT NULL, 911 | `images` json NOT NULL, 912 | `livemode` boolean, 913 | `metadata` json NOT NULL, 914 | `name` text NOT NULL, 915 | `object` text NOT NULL, 916 | `package_dimensions` json, 917 | `shippable` boolean, 918 | `statement_descriptor` text, 919 | `tax_code` json, 920 | `unit_label` text, 921 | `updated` integer NOT NULL, 922 | `url` text 923 | ); 924 | CREATE TABLE stripe_promotion_code ( 925 | `active` boolean NOT NULL, 926 | `code` text NOT NULL, 927 | `coupon` json NOT NULL, 928 | `created` integer, 929 | `customer` json, 930 | `expires_at` integer, 931 | `id` text PRIMARY KEY NOT NULL, 932 | `livemode` boolean, 933 | `max_redemptions` integer, 934 | `metadata` json, 935 | `object` text NOT NULL, 936 | `restrictions` json NOT NULL, 937 | `times_redeemed` integer NOT NULL 938 | ); 939 | CREATE TABLE stripe_quote ( 940 | `amount_subtotal` integer NOT NULL, 941 | `amount_total` integer NOT NULL, 942 | `application` json, 943 | `application_fee_amount` integer, 944 | `application_fee_percent` integer, 945 | `automatic_tax` json NOT NULL, 946 | `collection_method` text NOT NULL, 947 | `computed` json NOT NULL, 948 | `created` integer, 949 | `currency` text, 950 | `customer` json, 951 | `default_tax_rates` json, 952 | `description` text, 953 | `discounts` json NOT NULL, 954 | `expires_at` integer NOT NULL, 955 | `footer` text, 956 | `from_quote` json, 957 | `header` text, 958 | `id` text PRIMARY KEY NOT NULL, 959 | `invoice` json, 960 | `invoice_settings` json, 961 | `line_items` json, 962 | `livemode` boolean, 963 | `metadata` json NOT NULL, 964 | `number` text, 965 | `object` text NOT NULL, 966 | `on_behalf_of` json, 967 | `status` text, 968 | `status_transitions` json NOT NULL, 969 | `subscription` json, 970 | `subscription_data` json NOT NULL, 971 | `subscription_schedule` json, 972 | `test_clock` json, 973 | `total_details` json NOT NULL, 974 | `transfer_data` json 975 | ); 976 | CREATE TABLE stripe_early_fraud_warning ( 977 | `actionable` boolean NOT NULL, 978 | `charge` json NOT NULL, 979 | `created` integer, 980 | `fraud_type` text NOT NULL, 981 | `id` text PRIMARY KEY NOT NULL, 982 | `livemode` boolean, 983 | `object` text NOT NULL, 984 | `payment_intent` json 985 | ); 986 | CREATE TABLE stripe_recipient ( 987 | `active_account` json, 988 | `cards` json, 989 | `created` integer, 990 | `default_card` json, 991 | `description` text, 992 | `email` text, 993 | `id` text PRIMARY KEY NOT NULL, 994 | `livemode` boolean, 995 | `metadata` json NOT NULL, 996 | `migrated_to` json, 997 | `name` text, 998 | `object` text NOT NULL, 999 | `rolled_back_from` json, 1000 | `type` text NOT NULL 1001 | ); 1002 | CREATE TABLE stripe_report_run ( 1003 | `created` integer, 1004 | `error` text, 1005 | `id` text PRIMARY KEY NOT NULL, 1006 | `livemode` boolean, 1007 | `object` text NOT NULL, 1008 | `parameters` json NOT NULL, 1009 | `report_type` text NOT NULL, 1010 | `result` json, 1011 | `status` text, 1012 | `succeeded_at` integer 1013 | ); 1014 | CREATE TABLE stripe_report_type ( 1015 | `data_available_end` integer NOT NULL, 1016 | `data_available_start` integer NOT NULL, 1017 | `default_columns` json, 1018 | `id` text PRIMARY KEY NOT NULL, 1019 | `livemode` boolean, 1020 | `name` text NOT NULL, 1021 | `object` text NOT NULL, 1022 | `updated` integer NOT NULL, 1023 | `version` integer NOT NULL 1024 | ); 1025 | CREATE TABLE stripe_review ( 1026 | `billing_zip` text, 1027 | `charge` json, 1028 | `closed_reason` text, 1029 | `created` integer, 1030 | `id` text PRIMARY KEY NOT NULL, 1031 | `ip_address` text, 1032 | `ip_address_location` json, 1033 | `livemode` boolean, 1034 | `object` text NOT NULL, 1035 | `open` boolean NOT NULL, 1036 | `opened_reason` text NOT NULL, 1037 | `payment_intent` json, 1038 | `reason` text NOT NULL, 1039 | `session` json 1040 | ); 1041 | CREATE TABLE stripe_setup_intent ( 1042 | `application` json, 1043 | `attach_to_self` boolean, 1044 | `cancellation_reason` text, 1045 | `client_secret` text, 1046 | `created` integer, 1047 | `customer` json, 1048 | `description` text, 1049 | `flow_directions` json, 1050 | `id` text PRIMARY KEY NOT NULL, 1051 | `last_setup_error` json, 1052 | `latest_attempt` json, 1053 | `livemode` boolean, 1054 | `mandate` json, 1055 | `metadata` json, 1056 | `next_action` json, 1057 | `object` text NOT NULL, 1058 | `on_behalf_of` json, 1059 | `payment_method` json, 1060 | `payment_method_options` json, 1061 | `payment_method_types` json NOT NULL, 1062 | `single_use_mandate` json, 1063 | `status` text, 1064 | `usage` text NOT NULL 1065 | ); 1066 | CREATE TABLE stripe_scheduled_query_run ( 1067 | `created` integer, 1068 | `data_load_time` integer NOT NULL, 1069 | `error` json, 1070 | `file` json, 1071 | `id` text PRIMARY KEY NOT NULL, 1072 | `livemode` boolean, 1073 | `object` text NOT NULL, 1074 | `result_available_until` integer NOT NULL, 1075 | `sql` text NOT NULL, 1076 | `status` text, 1077 | `title` text NOT NULL 1078 | ); 1079 | CREATE TABLE stripe_sku ( 1080 | `active` boolean NOT NULL, 1081 | `attributes` json NOT NULL, 1082 | `created` integer, 1083 | `currency` text NOT NULL, 1084 | `id` text PRIMARY KEY NOT NULL, 1085 | `image` text, 1086 | `inventory` json NOT NULL, 1087 | `livemode` boolean, 1088 | `metadata` json NOT NULL, 1089 | `object` text NOT NULL, 1090 | `package_dimensions` json, 1091 | `price` integer NOT NULL, 1092 | `product` json NOT NULL, 1093 | `updated` integer NOT NULL 1094 | ); 1095 | CREATE TABLE stripe_transaction ( 1096 | `ach_credit_transfer` json, 1097 | `amount` integer NOT NULL, 1098 | `chf_credit_transfer` json, 1099 | `created` integer, 1100 | `currency` text NOT NULL, 1101 | `gbp_credit_transfer` json, 1102 | `id` text PRIMARY KEY NOT NULL, 1103 | `livemode` boolean, 1104 | `object` text NOT NULL, 1105 | `paper_check` json, 1106 | `sepa_credit_transfer` json, 1107 | `source` text NOT NULL, 1108 | `status` text, 1109 | `type` text NOT NULL 1110 | ); 1111 | CREATE TABLE stripe_subscription_schedule ( 1112 | `application` json, 1113 | `canceled_at` integer, 1114 | `completed_at` integer, 1115 | `created` integer, 1116 | `current_phase` json, 1117 | `customer` json NOT NULL, 1118 | `default_settings` json NOT NULL, 1119 | `end_behavior` text NOT NULL, 1120 | `id` text PRIMARY KEY NOT NULL, 1121 | `livemode` boolean, 1122 | `metadata` json, 1123 | `object` text NOT NULL, 1124 | `phases` json NOT NULL, 1125 | `released_at` integer, 1126 | `released_subscription` text, 1127 | `status` text, 1128 | `subscription` json, 1129 | `test_clock` json 1130 | ); 1131 | CREATE TABLE stripe_tax_rate ( 1132 | `active` boolean NOT NULL, 1133 | `country` text, 1134 | `created` integer, 1135 | `description` text, 1136 | `display_name` text NOT NULL, 1137 | `id` text PRIMARY KEY NOT NULL, 1138 | `inclusive` boolean NOT NULL, 1139 | `jurisdiction` text, 1140 | `livemode` boolean, 1141 | `metadata` json, 1142 | `object` text NOT NULL, 1143 | `percentage` integer NOT NULL, 1144 | `state` text, 1145 | `tax_type` text 1146 | ); 1147 | CREATE TABLE stripe_reader ( 1148 | `action` json, 1149 | `device_sw_version` text, 1150 | `device_type` text NOT NULL, 1151 | `id` text PRIMARY KEY NOT NULL, 1152 | `ip_address` text, 1153 | `label` text NOT NULL, 1154 | `livemode` boolean, 1155 | `location` json, 1156 | `metadata` json NOT NULL, 1157 | `object` text NOT NULL, 1158 | `serial_number` text NOT NULL, 1159 | `status` text 1160 | ); 1161 | CREATE TABLE stripe_test_clock ( 1162 | `created` integer, 1163 | `deletes_after` integer NOT NULL, 1164 | `frozen_time` integer NOT NULL, 1165 | `id` text PRIMARY KEY NOT NULL, 1166 | `livemode` boolean, 1167 | `name` text, 1168 | `object` text NOT NULL, 1169 | `status` text 1170 | ); 1171 | CREATE TABLE stripe_topup ( 1172 | `amount` integer NOT NULL, 1173 | `balance_transaction` json, 1174 | `created` integer, 1175 | `currency` text NOT NULL, 1176 | `description` text, 1177 | `expected_availability_date` integer, 1178 | `failure_code` text, 1179 | `failure_message` text, 1180 | `id` text PRIMARY KEY NOT NULL, 1181 | `livemode` boolean, 1182 | `metadata` json NOT NULL, 1183 | `object` text NOT NULL, 1184 | `source` json, 1185 | `statement_descriptor` text, 1186 | `status` text, 1187 | `transfer_group` text 1188 | ); 1189 | CREATE TABLE stripe_transfer ( 1190 | `amount` integer NOT NULL, 1191 | `amount_reversed` integer NOT NULL, 1192 | `balance_transaction` json, 1193 | `created` integer, 1194 | `currency` text NOT NULL, 1195 | `description` text, 1196 | `destination` json, 1197 | `destination_payment` json, 1198 | `id` text PRIMARY KEY NOT NULL, 1199 | `livemode` boolean, 1200 | `metadata` json NOT NULL, 1201 | `object` text NOT NULL, 1202 | `reversals` json NOT NULL, 1203 | `reversed` boolean NOT NULL, 1204 | `source_transaction` json, 1205 | `source_type` text, 1206 | `transfer_group` text 1207 | ); 1208 | CREATE TABLE stripe_credit_reversal ( 1209 | `amount` integer NOT NULL, 1210 | `currency` text NOT NULL, 1211 | `financial_account` text NOT NULL, 1212 | `hosted_regulatory_receipt_url` text, 1213 | `id` text PRIMARY KEY NOT NULL, 1214 | `livemode` boolean, 1215 | `metadata` json NOT NULL, 1216 | `network` text NOT NULL, 1217 | `object` text NOT NULL, 1218 | `received_credit` text NOT NULL, 1219 | `status` text, 1220 | `status_transitions` json NOT NULL, 1221 | `transaction` json 1222 | ); 1223 | CREATE TABLE stripe_debit_reversal ( 1224 | `amount` integer NOT NULL, 1225 | `currency` text NOT NULL, 1226 | `financial_account` text, 1227 | `hosted_regulatory_receipt_url` text, 1228 | `id` text PRIMARY KEY NOT NULL, 1229 | `linked_flows` json, 1230 | `livemode` boolean, 1231 | `metadata` json NOT NULL, 1232 | `network` text NOT NULL, 1233 | `object` text NOT NULL, 1234 | `received_debit` text NOT NULL, 1235 | `status` text, 1236 | `status_transitions` json NOT NULL, 1237 | `transaction` json 1238 | ); 1239 | CREATE TABLE stripe_financial_account ( 1240 | `active_features` json NOT NULL, 1241 | `balance` json NOT NULL, 1242 | `country` text NOT NULL, 1243 | `created` integer, 1244 | `features` json, 1245 | `financial_addresses` json NOT NULL, 1246 | `id` text PRIMARY KEY NOT NULL, 1247 | `livemode` boolean, 1248 | `metadata` json, 1249 | `object` text NOT NULL, 1250 | `pending_features` json NOT NULL, 1251 | `platform_restrictions` json, 1252 | `restricted_features` json NOT NULL, 1253 | `status` text, 1254 | `status_details` json NOT NULL, 1255 | `supported_currencies` json NOT NULL 1256 | ); 1257 | CREATE TABLE stripe_inbound_transfer ( 1258 | `amount` integer NOT NULL, 1259 | `cancelable` boolean NOT NULL, 1260 | `created` integer, 1261 | `currency` text NOT NULL, 1262 | `description` text, 1263 | `failure_details` json, 1264 | `financial_account` text NOT NULL, 1265 | `hosted_regulatory_receipt_url` text, 1266 | `id` text PRIMARY KEY NOT NULL, 1267 | `linked_flows` json NOT NULL, 1268 | `livemode` boolean, 1269 | `metadata` json NOT NULL, 1270 | `object` text NOT NULL, 1271 | `origin_payment_method` text NOT NULL, 1272 | `origin_payment_method_details` json, 1273 | `returned` boolean, 1274 | `statement_descriptor` text NOT NULL, 1275 | `status` text, 1276 | `status_transitions` json NOT NULL, 1277 | `transaction` json 1278 | ); 1279 | CREATE TABLE stripe_outbound_payment ( 1280 | `amount` integer NOT NULL, 1281 | `cancelable` boolean NOT NULL, 1282 | `created` integer, 1283 | `currency` text NOT NULL, 1284 | `customer` text, 1285 | `description` text, 1286 | `destination_payment_method` text, 1287 | `destination_payment_method_details` json, 1288 | `end_user_details` json, 1289 | `expected_arrival_date` integer NOT NULL, 1290 | `financial_account` text NOT NULL, 1291 | `hosted_regulatory_receipt_url` text, 1292 | `id` text PRIMARY KEY NOT NULL, 1293 | `livemode` boolean, 1294 | `metadata` json NOT NULL, 1295 | `object` text NOT NULL, 1296 | `returned_details` json, 1297 | `statement_descriptor` text NOT NULL, 1298 | `status` text, 1299 | `status_transitions` json NOT NULL, 1300 | `transaction` json NOT NULL 1301 | ); 1302 | CREATE TABLE stripe_outbound_transfer ( 1303 | `amount` integer NOT NULL, 1304 | `cancelable` boolean NOT NULL, 1305 | `created` integer, 1306 | `currency` text NOT NULL, 1307 | `description` text, 1308 | `destination_payment_method` text NOT NULL, 1309 | `destination_payment_method_details` json NOT NULL, 1310 | `expected_arrival_date` integer NOT NULL, 1311 | `financial_account` text NOT NULL, 1312 | `hosted_regulatory_receipt_url` text, 1313 | `id` text PRIMARY KEY NOT NULL, 1314 | `livemode` boolean, 1315 | `metadata` json NOT NULL, 1316 | `object` text NOT NULL, 1317 | `returned_details` json, 1318 | `statement_descriptor` text NOT NULL, 1319 | `status` text, 1320 | `status_transitions` json NOT NULL, 1321 | `transaction` json NOT NULL 1322 | ); 1323 | CREATE TABLE stripe_received_credit ( 1324 | `amount` integer NOT NULL, 1325 | `created` integer, 1326 | `currency` text NOT NULL, 1327 | `description` text NOT NULL, 1328 | `failure_code` text, 1329 | `financial_account` text, 1330 | `hosted_regulatory_receipt_url` text, 1331 | `id` text PRIMARY KEY NOT NULL, 1332 | `initiating_payment_method_details` json NOT NULL, 1333 | `linked_flows` json NOT NULL, 1334 | `livemode` boolean, 1335 | `network` text, 1336 | `object` text NOT NULL, 1337 | `reversal_details` json, 1338 | `status` text, 1339 | `transaction` json 1340 | ); 1341 | CREATE TABLE stripe_received_debit ( 1342 | `amount` integer NOT NULL, 1343 | `created` integer, 1344 | `currency` text NOT NULL, 1345 | `description` text NOT NULL, 1346 | `failure_code` text, 1347 | `financial_account` text, 1348 | `hosted_regulatory_receipt_url` text, 1349 | `id` text PRIMARY KEY NOT NULL, 1350 | `initiating_payment_method_details` json, 1351 | `linked_flows` json NOT NULL, 1352 | `livemode` boolean, 1353 | `network` text, 1354 | `object` text NOT NULL, 1355 | `reversal_details` json, 1356 | `status` text, 1357 | `transaction` json 1358 | ); 1359 | -------------------------------------------------------------------------------- /packages/stripe-sync/generated/stripeTables.ts: -------------------------------------------------------------------------------- 1 | export const STRIPE_TABLES = { 2 | "application": [ 3 | "id", 4 | "name", 5 | "object" 6 | ], 7 | "account": [ 8 | "business_profile", 9 | "business_type", 10 | "capabilities", 11 | "charges_enabled", 12 | "company", 13 | "controller", 14 | "country", 15 | "created", 16 | "default_currency", 17 | "details_submitted", 18 | "email", 19 | "external_accounts", 20 | "future_requirements", 21 | "id", 22 | "individual", 23 | "metadata", 24 | "object", 25 | "payouts_enabled", 26 | "requirements", 27 | "settings", 28 | "tos_acceptance", 29 | "type" 30 | ], 31 | "application_fee": [ 32 | "account", 33 | "amount", 34 | "amount_refunded", 35 | "application", 36 | "balance_transaction", 37 | "charge", 38 | "created", 39 | "currency", 40 | "id", 41 | "livemode", 42 | "object", 43 | "originating_transaction", 44 | "refunded", 45 | "refunds" 46 | ], 47 | "refund": [ 48 | "amount", 49 | "balance_transaction", 50 | "charge", 51 | "created", 52 | "currency", 53 | "description", 54 | "failure_balance_transaction", 55 | "failure_reason", 56 | "id", 57 | "instructions_email", 58 | "metadata", 59 | "next_action", 60 | "object", 61 | "payment_intent", 62 | "reason", 63 | "receipt_number", 64 | "source_transfer_reversal", 65 | "status", 66 | "transfer_reversal" 67 | ], 68 | "balance": [ 69 | "available", 70 | "connect_reserved", 71 | "instant_available", 72 | "issuing", 73 | "livemode", 74 | "object", 75 | "pending" 76 | ], 77 | "configuration": [ 78 | "active", 79 | "application", 80 | "business_profile", 81 | "created", 82 | "default_return_url", 83 | "features", 84 | "id", 85 | "is_default", 86 | "livemode", 87 | "metadata", 88 | "object", 89 | "updated" 90 | ], 91 | "session": [ 92 | "configuration", 93 | "created", 94 | "customer", 95 | "id", 96 | "livemode", 97 | "locale", 98 | "object", 99 | "on_behalf_of", 100 | "return_url", 101 | "url" 102 | ], 103 | "capability": [ 104 | "account", 105 | "future_requirements", 106 | "id", 107 | "object", 108 | "requested", 109 | "requested_at", 110 | "requirements", 111 | "status" 112 | ], 113 | "cash_balance": [ 114 | "available", 115 | "customer", 116 | "livemode", 117 | "object", 118 | "settings" 119 | ], 120 | "charge": [ 121 | "amount", 122 | "amount_captured", 123 | "amount_refunded", 124 | "application", 125 | "application_fee", 126 | "application_fee_amount", 127 | "balance_transaction", 128 | "billing_details", 129 | "calculated_statement_descriptor", 130 | "captured", 131 | "created", 132 | "currency", 133 | "customer", 134 | "description", 135 | "disputed", 136 | "failure_balance_transaction", 137 | "failure_code", 138 | "failure_message", 139 | "fraud_details", 140 | "id", 141 | "invoice", 142 | "livemode", 143 | "metadata", 144 | "object", 145 | "on_behalf_of", 146 | "outcome", 147 | "paid", 148 | "payment_intent", 149 | "payment_method", 150 | "payment_method_details", 151 | "radar_options", 152 | "receipt_email", 153 | "receipt_number", 154 | "receipt_url", 155 | "refunded", 156 | "refunds", 157 | "review", 158 | "shipping", 159 | "source_transfer", 160 | "statement_descriptor", 161 | "statement_descriptor_suffix", 162 | "status", 163 | "transfer", 164 | "transfer_data", 165 | "transfer_group" 166 | ], 167 | "dispute": [ 168 | "amount", 169 | "balance_transactions", 170 | "charge", 171 | "created", 172 | "currency", 173 | "evidence", 174 | "evidence_details", 175 | "id", 176 | "is_charge_refundable", 177 | "livemode", 178 | "metadata", 179 | "object", 180 | "payment_intent", 181 | "reason", 182 | "status" 183 | ], 184 | "checkout_session": [ 185 | "after_expiration", 186 | "allow_promotion_codes", 187 | "amount_subtotal", 188 | "amount_total", 189 | "automatic_tax", 190 | "billing_address_collection", 191 | "cancel_url", 192 | "client_reference_id", 193 | "consent", 194 | "consent_collection", 195 | "currency", 196 | "customer", 197 | "customer_creation", 198 | "customer_details", 199 | "customer_email", 200 | "expires_at", 201 | "id", 202 | "line_items", 203 | "livemode", 204 | "locale", 205 | "metadata", 206 | "mode", 207 | "object", 208 | "payment_intent", 209 | "payment_link", 210 | "payment_method_collection", 211 | "payment_method_options", 212 | "payment_method_types", 213 | "payment_status", 214 | "phone_number_collection", 215 | "recovered_from", 216 | "setup_intent", 217 | "shipping_address_collection", 218 | "shipping_cost", 219 | "shipping_details", 220 | "shipping_options", 221 | "status", 222 | "submit_type", 223 | "subscription", 224 | "success_url", 225 | "tax_id_collection", 226 | "total_details", 227 | "url" 228 | ], 229 | "coupon": [ 230 | "amount_off", 231 | "applies_to", 232 | "created", 233 | "currency", 234 | "currency_options", 235 | "duration", 236 | "duration_in_months", 237 | "id", 238 | "livemode", 239 | "max_redemptions", 240 | "metadata", 241 | "name", 242 | "object", 243 | "percent_off", 244 | "redeem_by", 245 | "times_redeemed", 246 | "valid" 247 | ], 248 | "credit_note": [ 249 | "amount", 250 | "created", 251 | "currency", 252 | "customer", 253 | "customer_balance_transaction", 254 | "discount_amount", 255 | "discount_amounts", 256 | "id", 257 | "invoice", 258 | "lines", 259 | "livemode", 260 | "memo", 261 | "metadata", 262 | "number", 263 | "object", 264 | "out_of_band_amount", 265 | "pdf", 266 | "reason", 267 | "refund", 268 | "status", 269 | "subtotal", 270 | "subtotal_excluding_tax", 271 | "tax_amounts", 272 | "total", 273 | "total_excluding_tax", 274 | "type", 275 | "voided_at" 276 | ], 277 | "customer": [ 278 | "address", 279 | "balance", 280 | "cash_balance", 281 | "created", 282 | "currency", 283 | "default_source", 284 | "delinquent", 285 | "description", 286 | "discount", 287 | "email", 288 | "id", 289 | "invoice_credit_balance", 290 | "invoice_prefix", 291 | "invoice_settings", 292 | "livemode", 293 | "metadata", 294 | "name", 295 | "next_invoice_sequence", 296 | "object", 297 | "phone", 298 | "preferred_locales", 299 | "shipping", 300 | "sources", 301 | "subscriptions", 302 | "tax", 303 | "tax_exempt", 304 | "tax_ids", 305 | "test_clock" 306 | ], 307 | "discount": [ 308 | "checkout_session", 309 | "coupon", 310 | "customer", 311 | "end", 312 | "id", 313 | "invoice", 314 | "invoice_item", 315 | "object", 316 | "promotion_code", 317 | "start", 318 | "subscription" 319 | ], 320 | "source": [ 321 | "ach_credit_transfer", 322 | "ach_debit", 323 | "acss_debit", 324 | "alipay", 325 | "amount", 326 | "au_becs_debit", 327 | "bancontact", 328 | "card", 329 | "card_present", 330 | "client_secret", 331 | "code_verification", 332 | "created", 333 | "currency", 334 | "customer", 335 | "eps", 336 | "flow", 337 | "giropay", 338 | "id", 339 | "ideal", 340 | "klarna", 341 | "livemode", 342 | "metadata", 343 | "multibanco", 344 | "object", 345 | "owner", 346 | "p24", 347 | "receiver", 348 | "redirect", 349 | "sepa_debit", 350 | "sofort", 351 | "source_order", 352 | "statement_descriptor", 353 | "status", 354 | "three_d_secure", 355 | "type", 356 | "usage", 357 | "wechat" 358 | ], 359 | "subscription": [ 360 | "application", 361 | "application_fee_percent", 362 | "automatic_tax", 363 | "billing_cycle_anchor", 364 | "billing_thresholds", 365 | "cancel_at", 366 | "cancel_at_period_end", 367 | "canceled_at", 368 | "collection_method", 369 | "created", 370 | "currency", 371 | "current_period_end", 372 | "current_period_start", 373 | "customer", 374 | "days_until_due", 375 | "default_payment_method", 376 | "default_source", 377 | "default_tax_rates", 378 | "description", 379 | "discount", 380 | "ended_at", 381 | "id", 382 | "items", 383 | "latest_invoice", 384 | "livemode", 385 | "metadata", 386 | "next_pending_invoice_item_invoice", 387 | "object", 388 | "pause_collection", 389 | "payment_settings", 390 | "pending_invoice_item_interval", 391 | "pending_setup_intent", 392 | "pending_update", 393 | "schedule", 394 | "start_date", 395 | "status", 396 | "test_clock", 397 | "transfer_data", 398 | "trial_end", 399 | "trial_start" 400 | ], 401 | "tax_id": [ 402 | "country", 403 | "created", 404 | "customer", 405 | "id", 406 | "livemode", 407 | "object", 408 | "type", 409 | "value", 410 | "verification" 411 | ], 412 | "customer_cash_balance_transaction": [ 413 | "applied_to_payment", 414 | "created", 415 | "currency", 416 | "customer", 417 | "ending_balance", 418 | "funded", 419 | "id", 420 | "livemode", 421 | "net_amount", 422 | "object", 423 | "refunded_from_payment", 424 | "type", 425 | "unapplied_from_payment" 426 | ], 427 | "file": [ 428 | "created", 429 | "expires_at", 430 | "filename", 431 | "id", 432 | "links", 433 | "object", 434 | "purpose", 435 | "size", 436 | "title", 437 | "type", 438 | "url" 439 | ], 440 | "verification_session": [ 441 | "client_secret", 442 | "created", 443 | "id", 444 | "last_error", 445 | "last_verification_report", 446 | "livemode", 447 | "metadata", 448 | "object", 449 | "options", 450 | "redaction", 451 | "status", 452 | "type", 453 | "url", 454 | "verified_outputs" 455 | ], 456 | "invoice": [ 457 | "account_country", 458 | "account_name", 459 | "account_tax_ids", 460 | "amount_due", 461 | "amount_paid", 462 | "amount_remaining", 463 | "application", 464 | "application_fee_amount", 465 | "attempt_count", 466 | "attempted", 467 | "auto_advance", 468 | "automatic_tax", 469 | "billing_reason", 470 | "charge", 471 | "collection_method", 472 | "created", 473 | "currency", 474 | "custom_fields", 475 | "customer", 476 | "customer_address", 477 | "customer_email", 478 | "customer_name", 479 | "customer_phone", 480 | "customer_shipping", 481 | "customer_tax_exempt", 482 | "customer_tax_ids", 483 | "default_payment_method", 484 | "default_source", 485 | "default_tax_rates", 486 | "description", 487 | "discount", 488 | "discounts", 489 | "due_date", 490 | "ending_balance", 491 | "footer", 492 | "hosted_invoice_url", 493 | "id", 494 | "invoice_pdf", 495 | "last_finalization_error", 496 | "lines", 497 | "livemode", 498 | "metadata", 499 | "next_payment_attempt", 500 | "number", 501 | "object", 502 | "on_behalf_of", 503 | "paid", 504 | "paid_out_of_band", 505 | "payment_intent", 506 | "payment_settings", 507 | "period_end", 508 | "period_start", 509 | "post_payment_credit_notes_amount", 510 | "pre_payment_credit_notes_amount", 511 | "quote", 512 | "receipt_number", 513 | "rendering_options", 514 | "starting_balance", 515 | "statement_descriptor", 516 | "status", 517 | "status_transitions", 518 | "subscription", 519 | "subscription_proration_date", 520 | "subtotal", 521 | "subtotal_excluding_tax", 522 | "tax", 523 | "test_clock", 524 | "threshold_reason", 525 | "total", 526 | "total_discount_amounts", 527 | "total_excluding_tax", 528 | "total_tax_amounts", 529 | "transfer_data", 530 | "webhooks_delivered_at" 531 | ], 532 | "invoiceitem": [ 533 | "amount", 534 | "currency", 535 | "customer", 536 | "date", 537 | "description", 538 | "discountable", 539 | "discounts", 540 | "id", 541 | "invoice", 542 | "livemode", 543 | "metadata", 544 | "object", 545 | "period", 546 | "price", 547 | "proration", 548 | "quantity", 549 | "subscription", 550 | "subscription_item", 551 | "tax_rates", 552 | "test_clock", 553 | "unit_amount", 554 | "unit_amount_decimal" 555 | ], 556 | "issuing_authorization": [ 557 | "amount", 558 | "amount_details", 559 | "approved", 560 | "authorization_method", 561 | "balance_transactions", 562 | "card", 563 | "cardholder", 564 | "created", 565 | "currency", 566 | "id", 567 | "livemode", 568 | "merchant_amount", 569 | "merchant_currency", 570 | "merchant_data", 571 | "metadata", 572 | "object", 573 | "pending_request", 574 | "request_history", 575 | "status", 576 | "transactions", 577 | "treasury", 578 | "verification_data", 579 | "wallet" 580 | ], 581 | "issuing_card": [ 582 | "brand", 583 | "cancellation_reason", 584 | "cardholder", 585 | "created", 586 | "currency", 587 | "cvc", 588 | "exp_month", 589 | "exp_year", 590 | "financial_account", 591 | "id", 592 | "last4", 593 | "livemode", 594 | "metadata", 595 | "number", 596 | "object", 597 | "replaced_by", 598 | "replacement_for", 599 | "replacement_reason", 600 | "shipping", 601 | "spending_controls", 602 | "status", 603 | "type", 604 | "wallets" 605 | ], 606 | "issuing_cardholder": [ 607 | "billing", 608 | "company", 609 | "created", 610 | "email", 611 | "id", 612 | "individual", 613 | "livemode", 614 | "metadata", 615 | "name", 616 | "object", 617 | "phone_number", 618 | "requirements", 619 | "spending_controls", 620 | "status", 621 | "type" 622 | ], 623 | "issuing_dispute": [ 624 | "amount", 625 | "balance_transactions", 626 | "created", 627 | "currency", 628 | "evidence", 629 | "id", 630 | "livemode", 631 | "metadata", 632 | "object", 633 | "status", 634 | "transaction", 635 | "treasury" 636 | ], 637 | "issuing_transaction": [ 638 | "amount", 639 | "amount_details", 640 | "authorization", 641 | "balance_transaction", 642 | "card", 643 | "cardholder", 644 | "created", 645 | "currency", 646 | "dispute", 647 | "id", 648 | "livemode", 649 | "merchant_amount", 650 | "merchant_currency", 651 | "merchant_data", 652 | "metadata", 653 | "object", 654 | "purchase_details", 655 | "treasury", 656 | "type", 657 | "wallet" 658 | ], 659 | "mandate": [ 660 | "customer_acceptance", 661 | "id", 662 | "livemode", 663 | "multi_use", 664 | "object", 665 | "payment_method", 666 | "payment_method_details", 667 | "single_use", 668 | "status", 669 | "type" 670 | ], 671 | "order": [ 672 | "amount_subtotal", 673 | "amount_total", 674 | "application", 675 | "automatic_tax", 676 | "billing_details", 677 | "client_secret", 678 | "created", 679 | "currency", 680 | "customer", 681 | "description", 682 | "discounts", 683 | "id", 684 | "ip_address", 685 | "line_items", 686 | "livemode", 687 | "metadata", 688 | "object", 689 | "payment", 690 | "shipping_cost", 691 | "shipping_details", 692 | "status", 693 | "tax_details", 694 | "total_details" 695 | ], 696 | "payment_intent": [ 697 | "amount", 698 | "amount_capturable", 699 | "amount_details", 700 | "amount_received", 701 | "application", 702 | "application_fee_amount", 703 | "automatic_payment_methods", 704 | "canceled_at", 705 | "cancellation_reason", 706 | "capture_method", 707 | "charges", 708 | "client_secret", 709 | "confirmation_method", 710 | "created", 711 | "currency", 712 | "customer", 713 | "description", 714 | "id", 715 | "invoice", 716 | "last_payment_error", 717 | "livemode", 718 | "metadata", 719 | "next_action", 720 | "object", 721 | "on_behalf_of", 722 | "payment_method", 723 | "payment_method_options", 724 | "payment_method_types", 725 | "processing", 726 | "receipt_email", 727 | "review", 728 | "setup_future_usage", 729 | "shipping", 730 | "statement_descriptor", 731 | "statement_descriptor_suffix", 732 | "status", 733 | "transfer_data", 734 | "transfer_group" 735 | ], 736 | "payment_link": [ 737 | "active", 738 | "after_completion", 739 | "allow_promotion_codes", 740 | "application_fee_amount", 741 | "application_fee_percent", 742 | "automatic_tax", 743 | "billing_address_collection", 744 | "consent_collection", 745 | "currency", 746 | "customer_creation", 747 | "id", 748 | "line_items", 749 | "livemode", 750 | "metadata", 751 | "object", 752 | "on_behalf_of", 753 | "payment_intent_data", 754 | "payment_method_collection", 755 | "payment_method_types", 756 | "phone_number_collection", 757 | "shipping_address_collection", 758 | "shipping_options", 759 | "submit_type", 760 | "subscription_data", 761 | "tax_id_collection", 762 | "transfer_data", 763 | "url" 764 | ], 765 | "payment_method": [ 766 | "acss_debit", 767 | "affirm", 768 | "afterpay_clearpay", 769 | "alipay", 770 | "au_becs_debit", 771 | "bacs_debit", 772 | "bancontact", 773 | "billing_details", 774 | "blik", 775 | "boleto", 776 | "card", 777 | "card_present", 778 | "created", 779 | "customer", 780 | "customer_balance", 781 | "eps", 782 | "fpx", 783 | "giropay", 784 | "grabpay", 785 | "id", 786 | "ideal", 787 | "interac_present", 788 | "klarna", 789 | "konbini", 790 | "link", 791 | "livemode", 792 | "metadata", 793 | "object", 794 | "oxxo", 795 | "p24", 796 | "paynow", 797 | "promptpay", 798 | "radar_options", 799 | "sepa_debit", 800 | "sofort", 801 | "type", 802 | "us_bank_account", 803 | "wechat_pay" 804 | ], 805 | "payout": [ 806 | "amount", 807 | "arrival_date", 808 | "automatic", 809 | "balance_transaction", 810 | "created", 811 | "currency", 812 | "description", 813 | "destination", 814 | "failure_balance_transaction", 815 | "failure_code", 816 | "failure_message", 817 | "id", 818 | "livemode", 819 | "metadata", 820 | "method", 821 | "object", 822 | "original_payout", 823 | "reversed_by", 824 | "source_type", 825 | "statement_descriptor", 826 | "status", 827 | "type" 828 | ], 829 | "person": [ 830 | "account", 831 | "address", 832 | "address_kana", 833 | "address_kanji", 834 | "created", 835 | "dob", 836 | "email", 837 | "first_name", 838 | "first_name_kana", 839 | "first_name_kanji", 840 | "full_name_aliases", 841 | "future_requirements", 842 | "gender", 843 | "id", 844 | "id_number_provided", 845 | "id_number_secondary_provided", 846 | "last_name", 847 | "last_name_kana", 848 | "last_name_kanji", 849 | "maiden_name", 850 | "metadata", 851 | "nationality", 852 | "object", 853 | "phone", 854 | "political_exposure", 855 | "registered_address", 856 | "relationship", 857 | "requirements", 858 | "ssn_last_4_provided", 859 | "verification" 860 | ], 861 | "plan": [ 862 | "active", 863 | "aggregate_usage", 864 | "amount", 865 | "amount_decimal", 866 | "billing_scheme", 867 | "created", 868 | "currency", 869 | "id", 870 | "interval", 871 | "interval_count", 872 | "livemode", 873 | "metadata", 874 | "nickname", 875 | "object", 876 | "product", 877 | "tiers", 878 | "tiers_mode", 879 | "transform_usage", 880 | "trial_period_days", 881 | "usage_type" 882 | ], 883 | "price": [ 884 | "active", 885 | "billing_scheme", 886 | "created", 887 | "currency", 888 | "currency_options", 889 | "custom_unit_amount", 890 | "id", 891 | "livemode", 892 | "lookup_key", 893 | "metadata", 894 | "nickname", 895 | "object", 896 | "product", 897 | "recurring", 898 | "tax_behavior", 899 | "tiers", 900 | "tiers_mode", 901 | "transform_quantity", 902 | "type", 903 | "unit_amount", 904 | "unit_amount_decimal" 905 | ], 906 | "product": [ 907 | "active", 908 | "created", 909 | "default_price", 910 | "description", 911 | "id", 912 | "images", 913 | "livemode", 914 | "metadata", 915 | "name", 916 | "object", 917 | "package_dimensions", 918 | "shippable", 919 | "statement_descriptor", 920 | "tax_code", 921 | "unit_label", 922 | "updated", 923 | "url" 924 | ], 925 | "promotion_code": [ 926 | "active", 927 | "code", 928 | "coupon", 929 | "created", 930 | "customer", 931 | "expires_at", 932 | "id", 933 | "livemode", 934 | "max_redemptions", 935 | "metadata", 936 | "object", 937 | "restrictions", 938 | "times_redeemed" 939 | ], 940 | "quote": [ 941 | "amount_subtotal", 942 | "amount_total", 943 | "application", 944 | "application_fee_amount", 945 | "application_fee_percent", 946 | "automatic_tax", 947 | "collection_method", 948 | "computed", 949 | "created", 950 | "currency", 951 | "customer", 952 | "default_tax_rates", 953 | "description", 954 | "discounts", 955 | "expires_at", 956 | "footer", 957 | "from_quote", 958 | "header", 959 | "id", 960 | "invoice", 961 | "invoice_settings", 962 | "line_items", 963 | "livemode", 964 | "metadata", 965 | "number", 966 | "object", 967 | "on_behalf_of", 968 | "status", 969 | "status_transitions", 970 | "subscription", 971 | "subscription_data", 972 | "subscription_schedule", 973 | "test_clock", 974 | "total_details", 975 | "transfer_data" 976 | ], 977 | "early_fraud_warning": [ 978 | "actionable", 979 | "charge", 980 | "created", 981 | "fraud_type", 982 | "id", 983 | "livemode", 984 | "object", 985 | "payment_intent" 986 | ], 987 | "recipient": [ 988 | "active_account", 989 | "cards", 990 | "created", 991 | "default_card", 992 | "description", 993 | "email", 994 | "id", 995 | "livemode", 996 | "metadata", 997 | "migrated_to", 998 | "name", 999 | "object", 1000 | "rolled_back_from", 1001 | "type" 1002 | ], 1003 | "report_run": [ 1004 | "created", 1005 | "error", 1006 | "id", 1007 | "livemode", 1008 | "object", 1009 | "parameters", 1010 | "report_type", 1011 | "result", 1012 | "status", 1013 | "succeeded_at" 1014 | ], 1015 | "report_type": [ 1016 | "data_available_end", 1017 | "data_available_start", 1018 | "default_columns", 1019 | "id", 1020 | "livemode", 1021 | "name", 1022 | "object", 1023 | "updated", 1024 | "version" 1025 | ], 1026 | "review": [ 1027 | "billing_zip", 1028 | "charge", 1029 | "closed_reason", 1030 | "created", 1031 | "id", 1032 | "ip_address", 1033 | "ip_address_location", 1034 | "livemode", 1035 | "object", 1036 | "open", 1037 | "opened_reason", 1038 | "payment_intent", 1039 | "reason", 1040 | "session" 1041 | ], 1042 | "setup_intent": [ 1043 | "application", 1044 | "attach_to_self", 1045 | "cancellation_reason", 1046 | "client_secret", 1047 | "created", 1048 | "customer", 1049 | "description", 1050 | "flow_directions", 1051 | "id", 1052 | "last_setup_error", 1053 | "latest_attempt", 1054 | "livemode", 1055 | "mandate", 1056 | "metadata", 1057 | "next_action", 1058 | "object", 1059 | "on_behalf_of", 1060 | "payment_method", 1061 | "payment_method_options", 1062 | "payment_method_types", 1063 | "single_use_mandate", 1064 | "status", 1065 | "usage" 1066 | ], 1067 | "scheduled_query_run": [ 1068 | "created", 1069 | "data_load_time", 1070 | "error", 1071 | "file", 1072 | "id", 1073 | "livemode", 1074 | "object", 1075 | "result_available_until", 1076 | "sql", 1077 | "status", 1078 | "title" 1079 | ], 1080 | "sku": [ 1081 | "active", 1082 | "attributes", 1083 | "created", 1084 | "currency", 1085 | "id", 1086 | "image", 1087 | "inventory", 1088 | "livemode", 1089 | "metadata", 1090 | "object", 1091 | "package_dimensions", 1092 | "price", 1093 | "product", 1094 | "updated" 1095 | ], 1096 | "transaction": [ 1097 | "ach_credit_transfer", 1098 | "amount", 1099 | "chf_credit_transfer", 1100 | "created", 1101 | "currency", 1102 | "gbp_credit_transfer", 1103 | "id", 1104 | "livemode", 1105 | "object", 1106 | "paper_check", 1107 | "sepa_credit_transfer", 1108 | "source", 1109 | "status", 1110 | "type" 1111 | ], 1112 | "subscription_schedule": [ 1113 | "application", 1114 | "canceled_at", 1115 | "completed_at", 1116 | "created", 1117 | "current_phase", 1118 | "customer", 1119 | "default_settings", 1120 | "end_behavior", 1121 | "id", 1122 | "livemode", 1123 | "metadata", 1124 | "object", 1125 | "phases", 1126 | "released_at", 1127 | "released_subscription", 1128 | "status", 1129 | "subscription", 1130 | "test_clock" 1131 | ], 1132 | "tax_rate": [ 1133 | "active", 1134 | "country", 1135 | "created", 1136 | "description", 1137 | "display_name", 1138 | "id", 1139 | "inclusive", 1140 | "jurisdiction", 1141 | "livemode", 1142 | "metadata", 1143 | "object", 1144 | "percentage", 1145 | "state", 1146 | "tax_type" 1147 | ], 1148 | "reader": [ 1149 | "action", 1150 | "device_sw_version", 1151 | "device_type", 1152 | "id", 1153 | "ip_address", 1154 | "label", 1155 | "livemode", 1156 | "location", 1157 | "metadata", 1158 | "object", 1159 | "serial_number", 1160 | "status" 1161 | ], 1162 | "test_clock": [ 1163 | "created", 1164 | "deletes_after", 1165 | "frozen_time", 1166 | "id", 1167 | "livemode", 1168 | "name", 1169 | "object", 1170 | "status" 1171 | ], 1172 | "topup": [ 1173 | "amount", 1174 | "balance_transaction", 1175 | "created", 1176 | "currency", 1177 | "description", 1178 | "expected_availability_date", 1179 | "failure_code", 1180 | "failure_message", 1181 | "id", 1182 | "livemode", 1183 | "metadata", 1184 | "object", 1185 | "source", 1186 | "statement_descriptor", 1187 | "status", 1188 | "transfer_group" 1189 | ], 1190 | "transfer": [ 1191 | "amount", 1192 | "amount_reversed", 1193 | "balance_transaction", 1194 | "created", 1195 | "currency", 1196 | "description", 1197 | "destination", 1198 | "destination_payment", 1199 | "id", 1200 | "livemode", 1201 | "metadata", 1202 | "object", 1203 | "reversals", 1204 | "reversed", 1205 | "source_transaction", 1206 | "source_type", 1207 | "transfer_group" 1208 | ], 1209 | "credit_reversal": [ 1210 | "amount", 1211 | "currency", 1212 | "financial_account", 1213 | "hosted_regulatory_receipt_url", 1214 | "id", 1215 | "livemode", 1216 | "metadata", 1217 | "network", 1218 | "object", 1219 | "received_credit", 1220 | "status", 1221 | "status_transitions", 1222 | "transaction" 1223 | ], 1224 | "debit_reversal": [ 1225 | "amount", 1226 | "currency", 1227 | "financial_account", 1228 | "hosted_regulatory_receipt_url", 1229 | "id", 1230 | "linked_flows", 1231 | "livemode", 1232 | "metadata", 1233 | "network", 1234 | "object", 1235 | "received_debit", 1236 | "status", 1237 | "status_transitions", 1238 | "transaction" 1239 | ], 1240 | "financial_account": [ 1241 | "active_features", 1242 | "balance", 1243 | "country", 1244 | "created", 1245 | "features", 1246 | "financial_addresses", 1247 | "id", 1248 | "livemode", 1249 | "metadata", 1250 | "object", 1251 | "pending_features", 1252 | "platform_restrictions", 1253 | "restricted_features", 1254 | "status", 1255 | "status_details", 1256 | "supported_currencies" 1257 | ], 1258 | "inbound_transfer": [ 1259 | "amount", 1260 | "cancelable", 1261 | "created", 1262 | "currency", 1263 | "description", 1264 | "failure_details", 1265 | "financial_account", 1266 | "hosted_regulatory_receipt_url", 1267 | "id", 1268 | "linked_flows", 1269 | "livemode", 1270 | "metadata", 1271 | "object", 1272 | "origin_payment_method", 1273 | "origin_payment_method_details", 1274 | "returned", 1275 | "statement_descriptor", 1276 | "status", 1277 | "status_transitions", 1278 | "transaction" 1279 | ], 1280 | "outbound_payment": [ 1281 | "amount", 1282 | "cancelable", 1283 | "created", 1284 | "currency", 1285 | "customer", 1286 | "description", 1287 | "destination_payment_method", 1288 | "destination_payment_method_details", 1289 | "end_user_details", 1290 | "expected_arrival_date", 1291 | "financial_account", 1292 | "hosted_regulatory_receipt_url", 1293 | "id", 1294 | "livemode", 1295 | "metadata", 1296 | "object", 1297 | "returned_details", 1298 | "statement_descriptor", 1299 | "status", 1300 | "status_transitions", 1301 | "transaction" 1302 | ], 1303 | "outbound_transfer": [ 1304 | "amount", 1305 | "cancelable", 1306 | "created", 1307 | "currency", 1308 | "description", 1309 | "destination_payment_method", 1310 | "destination_payment_method_details", 1311 | "expected_arrival_date", 1312 | "financial_account", 1313 | "hosted_regulatory_receipt_url", 1314 | "id", 1315 | "livemode", 1316 | "metadata", 1317 | "object", 1318 | "returned_details", 1319 | "statement_descriptor", 1320 | "status", 1321 | "status_transitions", 1322 | "transaction" 1323 | ], 1324 | "received_credit": [ 1325 | "amount", 1326 | "created", 1327 | "currency", 1328 | "description", 1329 | "failure_code", 1330 | "financial_account", 1331 | "hosted_regulatory_receipt_url", 1332 | "id", 1333 | "initiating_payment_method_details", 1334 | "linked_flows", 1335 | "livemode", 1336 | "network", 1337 | "object", 1338 | "reversal_details", 1339 | "status", 1340 | "transaction" 1341 | ], 1342 | "received_debit": [ 1343 | "amount", 1344 | "created", 1345 | "currency", 1346 | "description", 1347 | "failure_code", 1348 | "financial_account", 1349 | "hosted_regulatory_receipt_url", 1350 | "id", 1351 | "initiating_payment_method_details", 1352 | "linked_flows", 1353 | "livemode", 1354 | "network", 1355 | "object", 1356 | "reversal_details", 1357 | "status", 1358 | "transaction" 1359 | ] 1360 | } -------------------------------------------------------------------------------- /packages/stripe-sync/generated/tableColumns.json: -------------------------------------------------------------------------------- 1 | { 2 | "application": [ 3 | "id", 4 | "name", 5 | "object" 6 | ], 7 | "account": [ 8 | "business_profile", 9 | "business_type", 10 | "capabilities", 11 | "charges_enabled", 12 | "company", 13 | "controller", 14 | "country", 15 | "created", 16 | "default_currency", 17 | "details_submitted", 18 | "email", 19 | "external_accounts", 20 | "future_requirements", 21 | "id", 22 | "individual", 23 | "metadata", 24 | "object", 25 | "payouts_enabled", 26 | "requirements", 27 | "settings", 28 | "tos_acceptance", 29 | "type" 30 | ], 31 | "application_fee": [ 32 | "account", 33 | "amount", 34 | "amount_refunded", 35 | "application", 36 | "balance_transaction", 37 | "charge", 38 | "created", 39 | "currency", 40 | "id", 41 | "livemode", 42 | "object", 43 | "originating_transaction", 44 | "refunded", 45 | "refunds" 46 | ], 47 | "refund": [ 48 | "amount", 49 | "balance_transaction", 50 | "charge", 51 | "created", 52 | "currency", 53 | "description", 54 | "failure_balance_transaction", 55 | "failure_reason", 56 | "id", 57 | "instructions_email", 58 | "metadata", 59 | "next_action", 60 | "object", 61 | "payment_intent", 62 | "reason", 63 | "receipt_number", 64 | "source_transfer_reversal", 65 | "status", 66 | "transfer_reversal" 67 | ], 68 | "balance": [ 69 | "available", 70 | "connect_reserved", 71 | "instant_available", 72 | "issuing", 73 | "livemode", 74 | "object", 75 | "pending" 76 | ], 77 | "configuration": [ 78 | "active", 79 | "application", 80 | "business_profile", 81 | "created", 82 | "default_return_url", 83 | "features", 84 | "id", 85 | "is_default", 86 | "livemode", 87 | "metadata", 88 | "object", 89 | "updated" 90 | ], 91 | "session": [ 92 | "configuration", 93 | "created", 94 | "customer", 95 | "id", 96 | "livemode", 97 | "locale", 98 | "object", 99 | "on_behalf_of", 100 | "return_url", 101 | "url" 102 | ], 103 | "capability": [ 104 | "account", 105 | "future_requirements", 106 | "id", 107 | "object", 108 | "requested", 109 | "requested_at", 110 | "requirements", 111 | "status" 112 | ], 113 | "cash_balance": [ 114 | "available", 115 | "customer", 116 | "livemode", 117 | "object", 118 | "settings" 119 | ], 120 | "charge": [ 121 | "amount", 122 | "amount_captured", 123 | "amount_refunded", 124 | "application", 125 | "application_fee", 126 | "application_fee_amount", 127 | "balance_transaction", 128 | "billing_details", 129 | "calculated_statement_descriptor", 130 | "captured", 131 | "created", 132 | "currency", 133 | "customer", 134 | "description", 135 | "disputed", 136 | "failure_balance_transaction", 137 | "failure_code", 138 | "failure_message", 139 | "fraud_details", 140 | "id", 141 | "invoice", 142 | "livemode", 143 | "metadata", 144 | "object", 145 | "on_behalf_of", 146 | "outcome", 147 | "paid", 148 | "payment_intent", 149 | "payment_method", 150 | "payment_method_details", 151 | "radar_options", 152 | "receipt_email", 153 | "receipt_number", 154 | "receipt_url", 155 | "refunded", 156 | "refunds", 157 | "review", 158 | "shipping", 159 | "source_transfer", 160 | "statement_descriptor", 161 | "statement_descriptor_suffix", 162 | "status", 163 | "transfer", 164 | "transfer_data", 165 | "transfer_group" 166 | ], 167 | "dispute": [ 168 | "amount", 169 | "balance_transactions", 170 | "charge", 171 | "created", 172 | "currency", 173 | "evidence", 174 | "evidence_details", 175 | "id", 176 | "is_charge_refundable", 177 | "livemode", 178 | "metadata", 179 | "object", 180 | "payment_intent", 181 | "reason", 182 | "status" 183 | ], 184 | "checkout_session": [ 185 | "after_expiration", 186 | "allow_promotion_codes", 187 | "amount_subtotal", 188 | "amount_total", 189 | "automatic_tax", 190 | "billing_address_collection", 191 | "cancel_url", 192 | "client_reference_id", 193 | "consent", 194 | "consent_collection", 195 | "currency", 196 | "customer", 197 | "customer_creation", 198 | "customer_details", 199 | "customer_email", 200 | "expires_at", 201 | "id", 202 | "line_items", 203 | "livemode", 204 | "locale", 205 | "metadata", 206 | "mode", 207 | "object", 208 | "payment_intent", 209 | "payment_link", 210 | "payment_method_collection", 211 | "payment_method_options", 212 | "payment_method_types", 213 | "payment_status", 214 | "phone_number_collection", 215 | "recovered_from", 216 | "setup_intent", 217 | "shipping_address_collection", 218 | "shipping_cost", 219 | "shipping_details", 220 | "shipping_options", 221 | "status", 222 | "submit_type", 223 | "subscription", 224 | "success_url", 225 | "tax_id_collection", 226 | "total_details", 227 | "url" 228 | ], 229 | "coupon": [ 230 | "amount_off", 231 | "applies_to", 232 | "created", 233 | "currency", 234 | "currency_options", 235 | "duration", 236 | "duration_in_months", 237 | "id", 238 | "livemode", 239 | "max_redemptions", 240 | "metadata", 241 | "name", 242 | "object", 243 | "percent_off", 244 | "redeem_by", 245 | "times_redeemed", 246 | "valid" 247 | ], 248 | "credit_note": [ 249 | "amount", 250 | "created", 251 | "currency", 252 | "customer", 253 | "customer_balance_transaction", 254 | "discount_amount", 255 | "discount_amounts", 256 | "id", 257 | "invoice", 258 | "lines", 259 | "livemode", 260 | "memo", 261 | "metadata", 262 | "number", 263 | "object", 264 | "out_of_band_amount", 265 | "pdf", 266 | "reason", 267 | "refund", 268 | "status", 269 | "subtotal", 270 | "subtotal_excluding_tax", 271 | "tax_amounts", 272 | "total", 273 | "total_excluding_tax", 274 | "type", 275 | "voided_at" 276 | ], 277 | "customer": [ 278 | "address", 279 | "balance", 280 | "cash_balance", 281 | "created", 282 | "currency", 283 | "default_source", 284 | "delinquent", 285 | "description", 286 | "discount", 287 | "email", 288 | "id", 289 | "invoice_credit_balance", 290 | "invoice_prefix", 291 | "invoice_settings", 292 | "livemode", 293 | "metadata", 294 | "name", 295 | "next_invoice_sequence", 296 | "object", 297 | "phone", 298 | "preferred_locales", 299 | "shipping", 300 | "sources", 301 | "subscriptions", 302 | "tax", 303 | "tax_exempt", 304 | "tax_ids", 305 | "test_clock" 306 | ], 307 | "discount": [ 308 | "checkout_session", 309 | "coupon", 310 | "customer", 311 | "end", 312 | "id", 313 | "invoice", 314 | "invoice_item", 315 | "object", 316 | "promotion_code", 317 | "start", 318 | "subscription" 319 | ], 320 | "source": [ 321 | "ach_credit_transfer", 322 | "ach_debit", 323 | "acss_debit", 324 | "alipay", 325 | "amount", 326 | "au_becs_debit", 327 | "bancontact", 328 | "card", 329 | "card_present", 330 | "client_secret", 331 | "code_verification", 332 | "created", 333 | "currency", 334 | "customer", 335 | "eps", 336 | "flow", 337 | "giropay", 338 | "id", 339 | "ideal", 340 | "klarna", 341 | "livemode", 342 | "metadata", 343 | "multibanco", 344 | "object", 345 | "owner", 346 | "p24", 347 | "receiver", 348 | "redirect", 349 | "sepa_debit", 350 | "sofort", 351 | "source_order", 352 | "statement_descriptor", 353 | "status", 354 | "three_d_secure", 355 | "type", 356 | "usage", 357 | "wechat" 358 | ], 359 | "subscription": [ 360 | "application", 361 | "application_fee_percent", 362 | "automatic_tax", 363 | "billing_cycle_anchor", 364 | "billing_thresholds", 365 | "cancel_at", 366 | "cancel_at_period_end", 367 | "canceled_at", 368 | "collection_method", 369 | "created", 370 | "currency", 371 | "current_period_end", 372 | "current_period_start", 373 | "customer", 374 | "days_until_due", 375 | "default_payment_method", 376 | "default_source", 377 | "default_tax_rates", 378 | "description", 379 | "discount", 380 | "ended_at", 381 | "id", 382 | "items", 383 | "latest_invoice", 384 | "livemode", 385 | "metadata", 386 | "next_pending_invoice_item_invoice", 387 | "object", 388 | "pause_collection", 389 | "payment_settings", 390 | "pending_invoice_item_interval", 391 | "pending_setup_intent", 392 | "pending_update", 393 | "schedule", 394 | "start_date", 395 | "status", 396 | "test_clock", 397 | "transfer_data", 398 | "trial_end", 399 | "trial_start" 400 | ], 401 | "tax_id": [ 402 | "country", 403 | "created", 404 | "customer", 405 | "id", 406 | "livemode", 407 | "object", 408 | "type", 409 | "value", 410 | "verification" 411 | ], 412 | "customer_cash_balance_transaction": [ 413 | "applied_to_payment", 414 | "created", 415 | "currency", 416 | "customer", 417 | "ending_balance", 418 | "funded", 419 | "id", 420 | "livemode", 421 | "net_amount", 422 | "object", 423 | "refunded_from_payment", 424 | "type", 425 | "unapplied_from_payment" 426 | ], 427 | "file": [ 428 | "created", 429 | "expires_at", 430 | "filename", 431 | "id", 432 | "links", 433 | "object", 434 | "purpose", 435 | "size", 436 | "title", 437 | "type", 438 | "url" 439 | ], 440 | "verification_session": [ 441 | "client_secret", 442 | "created", 443 | "id", 444 | "last_error", 445 | "last_verification_report", 446 | "livemode", 447 | "metadata", 448 | "object", 449 | "options", 450 | "redaction", 451 | "status", 452 | "type", 453 | "url", 454 | "verified_outputs" 455 | ], 456 | "invoice": [ 457 | "account_country", 458 | "account_name", 459 | "account_tax_ids", 460 | "amount_due", 461 | "amount_paid", 462 | "amount_remaining", 463 | "application", 464 | "application_fee_amount", 465 | "attempt_count", 466 | "attempted", 467 | "auto_advance", 468 | "automatic_tax", 469 | "billing_reason", 470 | "charge", 471 | "collection_method", 472 | "created", 473 | "currency", 474 | "custom_fields", 475 | "customer", 476 | "customer_address", 477 | "customer_email", 478 | "customer_name", 479 | "customer_phone", 480 | "customer_shipping", 481 | "customer_tax_exempt", 482 | "customer_tax_ids", 483 | "default_payment_method", 484 | "default_source", 485 | "default_tax_rates", 486 | "description", 487 | "discount", 488 | "discounts", 489 | "due_date", 490 | "ending_balance", 491 | "footer", 492 | "hosted_invoice_url", 493 | "id", 494 | "invoice_pdf", 495 | "last_finalization_error", 496 | "lines", 497 | "livemode", 498 | "metadata", 499 | "next_payment_attempt", 500 | "number", 501 | "object", 502 | "on_behalf_of", 503 | "paid", 504 | "paid_out_of_band", 505 | "payment_intent", 506 | "payment_settings", 507 | "period_end", 508 | "period_start", 509 | "post_payment_credit_notes_amount", 510 | "pre_payment_credit_notes_amount", 511 | "quote", 512 | "receipt_number", 513 | "rendering_options", 514 | "starting_balance", 515 | "statement_descriptor", 516 | "status", 517 | "status_transitions", 518 | "subscription", 519 | "subscription_proration_date", 520 | "subtotal", 521 | "subtotal_excluding_tax", 522 | "tax", 523 | "test_clock", 524 | "threshold_reason", 525 | "total", 526 | "total_discount_amounts", 527 | "total_excluding_tax", 528 | "total_tax_amounts", 529 | "transfer_data", 530 | "webhooks_delivered_at" 531 | ], 532 | "invoiceitem": [ 533 | "amount", 534 | "currency", 535 | "customer", 536 | "date", 537 | "description", 538 | "discountable", 539 | "discounts", 540 | "id", 541 | "invoice", 542 | "livemode", 543 | "metadata", 544 | "object", 545 | "period", 546 | "price", 547 | "proration", 548 | "quantity", 549 | "subscription", 550 | "subscription_item", 551 | "tax_rates", 552 | "test_clock", 553 | "unit_amount", 554 | "unit_amount_decimal" 555 | ], 556 | "issuing_authorization": [ 557 | "amount", 558 | "amount_details", 559 | "approved", 560 | "authorization_method", 561 | "balance_transactions", 562 | "card", 563 | "cardholder", 564 | "created", 565 | "currency", 566 | "id", 567 | "livemode", 568 | "merchant_amount", 569 | "merchant_currency", 570 | "merchant_data", 571 | "metadata", 572 | "object", 573 | "pending_request", 574 | "request_history", 575 | "status", 576 | "transactions", 577 | "treasury", 578 | "verification_data", 579 | "wallet" 580 | ], 581 | "issuing_card": [ 582 | "brand", 583 | "cancellation_reason", 584 | "cardholder", 585 | "created", 586 | "currency", 587 | "cvc", 588 | "exp_month", 589 | "exp_year", 590 | "financial_account", 591 | "id", 592 | "last4", 593 | "livemode", 594 | "metadata", 595 | "number", 596 | "object", 597 | "replaced_by", 598 | "replacement_for", 599 | "replacement_reason", 600 | "shipping", 601 | "spending_controls", 602 | "status", 603 | "type", 604 | "wallets" 605 | ], 606 | "issuing_cardholder": [ 607 | "billing", 608 | "company", 609 | "created", 610 | "email", 611 | "id", 612 | "individual", 613 | "livemode", 614 | "metadata", 615 | "name", 616 | "object", 617 | "phone_number", 618 | "requirements", 619 | "spending_controls", 620 | "status", 621 | "type" 622 | ], 623 | "issuing_dispute": [ 624 | "amount", 625 | "balance_transactions", 626 | "created", 627 | "currency", 628 | "evidence", 629 | "id", 630 | "livemode", 631 | "metadata", 632 | "object", 633 | "status", 634 | "transaction", 635 | "treasury" 636 | ], 637 | "issuing_transaction": [ 638 | "amount", 639 | "amount_details", 640 | "authorization", 641 | "balance_transaction", 642 | "card", 643 | "cardholder", 644 | "created", 645 | "currency", 646 | "dispute", 647 | "id", 648 | "livemode", 649 | "merchant_amount", 650 | "merchant_currency", 651 | "merchant_data", 652 | "metadata", 653 | "object", 654 | "purchase_details", 655 | "treasury", 656 | "type", 657 | "wallet" 658 | ], 659 | "mandate": [ 660 | "customer_acceptance", 661 | "id", 662 | "livemode", 663 | "multi_use", 664 | "object", 665 | "payment_method", 666 | "payment_method_details", 667 | "single_use", 668 | "status", 669 | "type" 670 | ], 671 | "order": [ 672 | "amount_subtotal", 673 | "amount_total", 674 | "application", 675 | "automatic_tax", 676 | "billing_details", 677 | "client_secret", 678 | "created", 679 | "currency", 680 | "customer", 681 | "description", 682 | "discounts", 683 | "id", 684 | "ip_address", 685 | "line_items", 686 | "livemode", 687 | "metadata", 688 | "object", 689 | "payment", 690 | "shipping_cost", 691 | "shipping_details", 692 | "status", 693 | "tax_details", 694 | "total_details" 695 | ], 696 | "payment_intent": [ 697 | "amount", 698 | "amount_capturable", 699 | "amount_details", 700 | "amount_received", 701 | "application", 702 | "application_fee_amount", 703 | "automatic_payment_methods", 704 | "canceled_at", 705 | "cancellation_reason", 706 | "capture_method", 707 | "charges", 708 | "client_secret", 709 | "confirmation_method", 710 | "created", 711 | "currency", 712 | "customer", 713 | "description", 714 | "id", 715 | "invoice", 716 | "last_payment_error", 717 | "livemode", 718 | "metadata", 719 | "next_action", 720 | "object", 721 | "on_behalf_of", 722 | "payment_method", 723 | "payment_method_options", 724 | "payment_method_types", 725 | "processing", 726 | "receipt_email", 727 | "review", 728 | "setup_future_usage", 729 | "shipping", 730 | "statement_descriptor", 731 | "statement_descriptor_suffix", 732 | "status", 733 | "transfer_data", 734 | "transfer_group" 735 | ], 736 | "payment_link": [ 737 | "active", 738 | "after_completion", 739 | "allow_promotion_codes", 740 | "application_fee_amount", 741 | "application_fee_percent", 742 | "automatic_tax", 743 | "billing_address_collection", 744 | "consent_collection", 745 | "currency", 746 | "customer_creation", 747 | "id", 748 | "line_items", 749 | "livemode", 750 | "metadata", 751 | "object", 752 | "on_behalf_of", 753 | "payment_intent_data", 754 | "payment_method_collection", 755 | "payment_method_types", 756 | "phone_number_collection", 757 | "shipping_address_collection", 758 | "shipping_options", 759 | "submit_type", 760 | "subscription_data", 761 | "tax_id_collection", 762 | "transfer_data", 763 | "url" 764 | ], 765 | "payment_method": [ 766 | "acss_debit", 767 | "affirm", 768 | "afterpay_clearpay", 769 | "alipay", 770 | "au_becs_debit", 771 | "bacs_debit", 772 | "bancontact", 773 | "billing_details", 774 | "blik", 775 | "boleto", 776 | "card", 777 | "card_present", 778 | "created", 779 | "customer", 780 | "customer_balance", 781 | "eps", 782 | "fpx", 783 | "giropay", 784 | "grabpay", 785 | "id", 786 | "ideal", 787 | "interac_present", 788 | "klarna", 789 | "konbini", 790 | "link", 791 | "livemode", 792 | "metadata", 793 | "object", 794 | "oxxo", 795 | "p24", 796 | "paynow", 797 | "promptpay", 798 | "radar_options", 799 | "sepa_debit", 800 | "sofort", 801 | "type", 802 | "us_bank_account", 803 | "wechat_pay" 804 | ], 805 | "payout": [ 806 | "amount", 807 | "arrival_date", 808 | "automatic", 809 | "balance_transaction", 810 | "created", 811 | "currency", 812 | "description", 813 | "destination", 814 | "failure_balance_transaction", 815 | "failure_code", 816 | "failure_message", 817 | "id", 818 | "livemode", 819 | "metadata", 820 | "method", 821 | "object", 822 | "original_payout", 823 | "reversed_by", 824 | "source_type", 825 | "statement_descriptor", 826 | "status", 827 | "type" 828 | ], 829 | "person": [ 830 | "account", 831 | "address", 832 | "address_kana", 833 | "address_kanji", 834 | "created", 835 | "dob", 836 | "email", 837 | "first_name", 838 | "first_name_kana", 839 | "first_name_kanji", 840 | "full_name_aliases", 841 | "future_requirements", 842 | "gender", 843 | "id", 844 | "id_number_provided", 845 | "id_number_secondary_provided", 846 | "last_name", 847 | "last_name_kana", 848 | "last_name_kanji", 849 | "maiden_name", 850 | "metadata", 851 | "nationality", 852 | "object", 853 | "phone", 854 | "political_exposure", 855 | "registered_address", 856 | "relationship", 857 | "requirements", 858 | "ssn_last_4_provided", 859 | "verification" 860 | ], 861 | "plan": [ 862 | "active", 863 | "aggregate_usage", 864 | "amount", 865 | "amount_decimal", 866 | "billing_scheme", 867 | "created", 868 | "currency", 869 | "id", 870 | "interval", 871 | "interval_count", 872 | "livemode", 873 | "metadata", 874 | "nickname", 875 | "object", 876 | "product", 877 | "tiers", 878 | "tiers_mode", 879 | "transform_usage", 880 | "trial_period_days", 881 | "usage_type" 882 | ], 883 | "price": [ 884 | "active", 885 | "billing_scheme", 886 | "created", 887 | "currency", 888 | "currency_options", 889 | "custom_unit_amount", 890 | "id", 891 | "livemode", 892 | "lookup_key", 893 | "metadata", 894 | "nickname", 895 | "object", 896 | "product", 897 | "recurring", 898 | "tax_behavior", 899 | "tiers", 900 | "tiers_mode", 901 | "transform_quantity", 902 | "type", 903 | "unit_amount", 904 | "unit_amount_decimal" 905 | ], 906 | "product": [ 907 | "active", 908 | "created", 909 | "default_price", 910 | "description", 911 | "id", 912 | "images", 913 | "livemode", 914 | "metadata", 915 | "name", 916 | "object", 917 | "package_dimensions", 918 | "shippable", 919 | "statement_descriptor", 920 | "tax_code", 921 | "unit_label", 922 | "updated", 923 | "url" 924 | ], 925 | "promotion_code": [ 926 | "active", 927 | "code", 928 | "coupon", 929 | "created", 930 | "customer", 931 | "expires_at", 932 | "id", 933 | "livemode", 934 | "max_redemptions", 935 | "metadata", 936 | "object", 937 | "restrictions", 938 | "times_redeemed" 939 | ], 940 | "quote": [ 941 | "amount_subtotal", 942 | "amount_total", 943 | "application", 944 | "application_fee_amount", 945 | "application_fee_percent", 946 | "automatic_tax", 947 | "collection_method", 948 | "computed", 949 | "created", 950 | "currency", 951 | "customer", 952 | "default_tax_rates", 953 | "description", 954 | "discounts", 955 | "expires_at", 956 | "footer", 957 | "from_quote", 958 | "header", 959 | "id", 960 | "invoice", 961 | "invoice_settings", 962 | "line_items", 963 | "livemode", 964 | "metadata", 965 | "number", 966 | "object", 967 | "on_behalf_of", 968 | "status", 969 | "status_transitions", 970 | "subscription", 971 | "subscription_data", 972 | "subscription_schedule", 973 | "test_clock", 974 | "total_details", 975 | "transfer_data" 976 | ], 977 | "early_fraud_warning": [ 978 | "actionable", 979 | "charge", 980 | "created", 981 | "fraud_type", 982 | "id", 983 | "livemode", 984 | "object", 985 | "payment_intent" 986 | ], 987 | "recipient": [ 988 | "active_account", 989 | "cards", 990 | "created", 991 | "default_card", 992 | "description", 993 | "email", 994 | "id", 995 | "livemode", 996 | "metadata", 997 | "migrated_to", 998 | "name", 999 | "object", 1000 | "rolled_back_from", 1001 | "type" 1002 | ], 1003 | "report_run": [ 1004 | "created", 1005 | "error", 1006 | "id", 1007 | "livemode", 1008 | "object", 1009 | "parameters", 1010 | "report_type", 1011 | "result", 1012 | "status", 1013 | "succeeded_at" 1014 | ], 1015 | "report_type": [ 1016 | "data_available_end", 1017 | "data_available_start", 1018 | "default_columns", 1019 | "id", 1020 | "livemode", 1021 | "name", 1022 | "object", 1023 | "updated", 1024 | "version" 1025 | ], 1026 | "review": [ 1027 | "billing_zip", 1028 | "charge", 1029 | "closed_reason", 1030 | "created", 1031 | "id", 1032 | "ip_address", 1033 | "ip_address_location", 1034 | "livemode", 1035 | "object", 1036 | "open", 1037 | "opened_reason", 1038 | "payment_intent", 1039 | "reason", 1040 | "session" 1041 | ], 1042 | "setup_intent": [ 1043 | "application", 1044 | "attach_to_self", 1045 | "cancellation_reason", 1046 | "client_secret", 1047 | "created", 1048 | "customer", 1049 | "description", 1050 | "flow_directions", 1051 | "id", 1052 | "last_setup_error", 1053 | "latest_attempt", 1054 | "livemode", 1055 | "mandate", 1056 | "metadata", 1057 | "next_action", 1058 | "object", 1059 | "on_behalf_of", 1060 | "payment_method", 1061 | "payment_method_options", 1062 | "payment_method_types", 1063 | "single_use_mandate", 1064 | "status", 1065 | "usage" 1066 | ], 1067 | "scheduled_query_run": [ 1068 | "created", 1069 | "data_load_time", 1070 | "error", 1071 | "file", 1072 | "id", 1073 | "livemode", 1074 | "object", 1075 | "result_available_until", 1076 | "sql", 1077 | "status", 1078 | "title" 1079 | ], 1080 | "sku": [ 1081 | "active", 1082 | "attributes", 1083 | "created", 1084 | "currency", 1085 | "id", 1086 | "image", 1087 | "inventory", 1088 | "livemode", 1089 | "metadata", 1090 | "object", 1091 | "package_dimensions", 1092 | "price", 1093 | "product", 1094 | "updated" 1095 | ], 1096 | "transaction": [ 1097 | "ach_credit_transfer", 1098 | "amount", 1099 | "chf_credit_transfer", 1100 | "created", 1101 | "currency", 1102 | "gbp_credit_transfer", 1103 | "id", 1104 | "livemode", 1105 | "object", 1106 | "paper_check", 1107 | "sepa_credit_transfer", 1108 | "source", 1109 | "status", 1110 | "type" 1111 | ], 1112 | "subscription_schedule": [ 1113 | "application", 1114 | "canceled_at", 1115 | "completed_at", 1116 | "created", 1117 | "current_phase", 1118 | "customer", 1119 | "default_settings", 1120 | "end_behavior", 1121 | "id", 1122 | "livemode", 1123 | "metadata", 1124 | "object", 1125 | "phases", 1126 | "released_at", 1127 | "released_subscription", 1128 | "status", 1129 | "subscription", 1130 | "test_clock" 1131 | ], 1132 | "tax_rate": [ 1133 | "active", 1134 | "country", 1135 | "created", 1136 | "description", 1137 | "display_name", 1138 | "id", 1139 | "inclusive", 1140 | "jurisdiction", 1141 | "livemode", 1142 | "metadata", 1143 | "object", 1144 | "percentage", 1145 | "state", 1146 | "tax_type" 1147 | ], 1148 | "reader": [ 1149 | "action", 1150 | "device_sw_version", 1151 | "device_type", 1152 | "id", 1153 | "ip_address", 1154 | "label", 1155 | "livemode", 1156 | "location", 1157 | "metadata", 1158 | "object", 1159 | "serial_number", 1160 | "status" 1161 | ], 1162 | "test_clock": [ 1163 | "created", 1164 | "deletes_after", 1165 | "frozen_time", 1166 | "id", 1167 | "livemode", 1168 | "name", 1169 | "object", 1170 | "status" 1171 | ], 1172 | "topup": [ 1173 | "amount", 1174 | "balance_transaction", 1175 | "created", 1176 | "currency", 1177 | "description", 1178 | "expected_availability_date", 1179 | "failure_code", 1180 | "failure_message", 1181 | "id", 1182 | "livemode", 1183 | "metadata", 1184 | "object", 1185 | "source", 1186 | "statement_descriptor", 1187 | "status", 1188 | "transfer_group" 1189 | ], 1190 | "transfer": [ 1191 | "amount", 1192 | "amount_reversed", 1193 | "balance_transaction", 1194 | "created", 1195 | "currency", 1196 | "description", 1197 | "destination", 1198 | "destination_payment", 1199 | "id", 1200 | "livemode", 1201 | "metadata", 1202 | "object", 1203 | "reversals", 1204 | "reversed", 1205 | "source_transaction", 1206 | "source_type", 1207 | "transfer_group" 1208 | ], 1209 | "credit_reversal": [ 1210 | "amount", 1211 | "currency", 1212 | "financial_account", 1213 | "hosted_regulatory_receipt_url", 1214 | "id", 1215 | "livemode", 1216 | "metadata", 1217 | "network", 1218 | "object", 1219 | "received_credit", 1220 | "status", 1221 | "status_transitions", 1222 | "transaction" 1223 | ], 1224 | "debit_reversal": [ 1225 | "amount", 1226 | "currency", 1227 | "financial_account", 1228 | "hosted_regulatory_receipt_url", 1229 | "id", 1230 | "linked_flows", 1231 | "livemode", 1232 | "metadata", 1233 | "network", 1234 | "object", 1235 | "received_debit", 1236 | "status", 1237 | "status_transitions", 1238 | "transaction" 1239 | ], 1240 | "financial_account": [ 1241 | "active_features", 1242 | "balance", 1243 | "country", 1244 | "created", 1245 | "features", 1246 | "financial_addresses", 1247 | "id", 1248 | "livemode", 1249 | "metadata", 1250 | "object", 1251 | "pending_features", 1252 | "platform_restrictions", 1253 | "restricted_features", 1254 | "status", 1255 | "status_details", 1256 | "supported_currencies" 1257 | ], 1258 | "inbound_transfer": [ 1259 | "amount", 1260 | "cancelable", 1261 | "created", 1262 | "currency", 1263 | "description", 1264 | "failure_details", 1265 | "financial_account", 1266 | "hosted_regulatory_receipt_url", 1267 | "id", 1268 | "linked_flows", 1269 | "livemode", 1270 | "metadata", 1271 | "object", 1272 | "origin_payment_method", 1273 | "origin_payment_method_details", 1274 | "returned", 1275 | "statement_descriptor", 1276 | "status", 1277 | "status_transitions", 1278 | "transaction" 1279 | ], 1280 | "outbound_payment": [ 1281 | "amount", 1282 | "cancelable", 1283 | "created", 1284 | "currency", 1285 | "customer", 1286 | "description", 1287 | "destination_payment_method", 1288 | "destination_payment_method_details", 1289 | "end_user_details", 1290 | "expected_arrival_date", 1291 | "financial_account", 1292 | "hosted_regulatory_receipt_url", 1293 | "id", 1294 | "livemode", 1295 | "metadata", 1296 | "object", 1297 | "returned_details", 1298 | "statement_descriptor", 1299 | "status", 1300 | "status_transitions", 1301 | "transaction" 1302 | ], 1303 | "outbound_transfer": [ 1304 | "amount", 1305 | "cancelable", 1306 | "created", 1307 | "currency", 1308 | "description", 1309 | "destination_payment_method", 1310 | "destination_payment_method_details", 1311 | "expected_arrival_date", 1312 | "financial_account", 1313 | "hosted_regulatory_receipt_url", 1314 | "id", 1315 | "livemode", 1316 | "metadata", 1317 | "object", 1318 | "returned_details", 1319 | "statement_descriptor", 1320 | "status", 1321 | "status_transitions", 1322 | "transaction" 1323 | ], 1324 | "received_credit": [ 1325 | "amount", 1326 | "created", 1327 | "currency", 1328 | "description", 1329 | "failure_code", 1330 | "financial_account", 1331 | "hosted_regulatory_receipt_url", 1332 | "id", 1333 | "initiating_payment_method_details", 1334 | "linked_flows", 1335 | "livemode", 1336 | "network", 1337 | "object", 1338 | "reversal_details", 1339 | "status", 1340 | "transaction" 1341 | ], 1342 | "received_debit": [ 1343 | "amount", 1344 | "created", 1345 | "currency", 1346 | "description", 1347 | "failure_code", 1348 | "financial_account", 1349 | "hosted_regulatory_receipt_url", 1350 | "id", 1351 | "initiating_payment_method_details", 1352 | "linked_flows", 1353 | "livemode", 1354 | "network", 1355 | "object", 1356 | "reversal_details", 1357 | "status", 1358 | "transaction" 1359 | ] 1360 | } -------------------------------------------------------------------------------- /packages/stripe-sync/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stripe-sync", 3 | "version": "0.1.4", 4 | "description": "sync stripe data to your SQL database", 5 | "main": "dist/index.js", 6 | "module": "dist/index.mjs", 7 | "types": "dist/index.d.ts", 8 | "exports": { 9 | ".": { 10 | "import": "./dist/index.mjs", 11 | "require": "./dist/index.js", 12 | "default": "./dist/index.js" 13 | }, 14 | "./adapters/deno": { 15 | "import": "./dist/adapters/deno.mjs", 16 | "require": "./dist/adapters/deno.js", 17 | "default": "./dist/adapters/deno.js" 18 | }, 19 | "./adapters/express": { 20 | "import": "./dist/adapters/express.mjs", 21 | "require": "./dist/adapters/express.js", 22 | "default": "./dist/adapters/express.js" 23 | }, 24 | "./adapters/fetch": { 25 | "import": "./dist/adapters/fetch.mjs", 26 | "require": "./dist/adapters/fetch.js", 27 | "default": "./dist/adapters/fetch.js" 28 | }, 29 | "./adapters/next": { 30 | "import": "./dist/adapters/next.mjs", 31 | "require": "./dist/adapters/next.js", 32 | "default": "./dist/adapters/next.js" 33 | }, 34 | "./databaseAdapters/supabase": { 35 | "import": "./dist/databaseAdapters/supabase.mjs", 36 | "require": "./dist/databaseAdapters/supabase.js", 37 | "default": "./dist/databaseAdapters/supabase.js" 38 | }, 39 | "./databaseAdapters/createDatabaseAdapter": { 40 | "import": "./dist/databaseAdapters/createDatabaseAdapter.mjs", 41 | "require": "./dist/databaseAdapters/createDatabaseAdapter.js", 42 | "default": "./dist/databaseAdapters/createDatabaseAdapter.js" 43 | } 44 | }, 45 | "typesVersions": { 46 | "*": { 47 | "*": [ 48 | "dist/index.d.ts" 49 | ], 50 | "adapters/deno": [ 51 | "dist/adapters/deno.d.ts" 52 | ], 53 | "adapters/express": [ 54 | "dist/adapters/express.d.ts" 55 | ], 56 | "adapters/fetch": [ 57 | "dist/adapters/fetch.d.ts" 58 | ], 59 | "adapters/next": [ 60 | "dist/adapters/next.d.ts" 61 | ], 62 | "databaseAdapter/supabase": [ 63 | "dist/databaseAdapter/supabase.d.ts" 64 | ], 65 | "databaseAdapter/createDatabaseAdapter": [ 66 | "dist/databaseAdapter/createDatabaseAdapter.d.ts" 67 | ] 68 | } 69 | }, 70 | "files": [ 71 | "dist", 72 | "src" 73 | ], 74 | "repository": { 75 | "type": "git", 76 | "url": "git+https://github.com/lawrencecchen/stripe-sync.git", 77 | "directory": "packages/stripe-sync" 78 | }, 79 | "homepage": "https://stipe-sync.vercel.app", 80 | "scripts": { 81 | "dev": "tsx watch src/entry-node", 82 | "dev:parse": "tsx watch src/generate", 83 | "dev:xod": "tsx watch src/xod", 84 | "build": "tsup src/index.ts src/adapters/*.ts src/databaseAdapters/*.ts --format esm,cjs --dts", 85 | "generate": "tsx src/generate", 86 | "test:events": "tsx tests/all-events.ts" 87 | }, 88 | "keywords": [ 89 | "stripe", 90 | "postgres", 91 | "mysql", 92 | "supabase", 93 | "deno", 94 | "bun" 95 | ], 96 | "author": "Lawrence Chen", 97 | "license": "MIT", 98 | "devDependencies": { 99 | "@apidevtools/swagger-parser": "^10.1.0", 100 | "@types/fs-extra": "^9.0.13", 101 | "@types/node": "^18.11.9", 102 | "@types/prettier": "^2.7.1", 103 | "dotenv": "^16.0.3", 104 | "fs-extra": "^10.1.0", 105 | "prettier": "^2.7.1", 106 | "tsup": "^6.5.0", 107 | "tsx": "^3.12.1", 108 | "typescript": "^4.9.3" 109 | }, 110 | "dependencies": { 111 | "@hattip/adapter-deno": "^0.0.22", 112 | "@hattip/adapter-node": "^0.0.22", 113 | "@hattip/core": "^0.0.22", 114 | "@hattip/response": "^0.0.22", 115 | "@supabase/supabase-js": "^2.1.0", 116 | "stripe": "^10.17.0", 117 | "tiny-invariant": "^1.3.1", 118 | "zod": "^3.19.1" 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /packages/stripe-sync/spec/enabledEvents.txt: -------------------------------------------------------------------------------- 1 | * 2 | account.application.authorized 3 | account.application.deauthorized 4 | account.external_account.created 5 | account.external_account.deleted 6 | account.external_account.updated 7 | account.updated 8 | application_fee.created 9 | application_fee.refund.updated 10 | application_fee.refunded 11 | balance.available 12 | billing_portal.configuration.created 13 | billing_portal.configuration.updated 14 | billing_portal.session.created 15 | capability.updated 16 | cash_balance.funds_available 17 | charge.captured 18 | charge.dispute.closed 19 | charge.dispute.created 20 | charge.dispute.funds_reinstated 21 | charge.dispute.funds_withdrawn 22 | charge.dispute.updated 23 | charge.expired 24 | charge.failed 25 | charge.pending 26 | charge.refund.updated 27 | charge.refunded 28 | charge.succeeded 29 | charge.updated 30 | checkout.session.async_payment_failed 31 | checkout.session.async_payment_succeeded 32 | checkout.session.completed 33 | checkout.session.expired 34 | coupon.created 35 | coupon.deleted 36 | coupon.updated 37 | credit_note.created 38 | credit_note.updated 39 | credit_note.voided 40 | customer.created 41 | customer.deleted 42 | customer.discount.created 43 | customer.discount.deleted 44 | customer.discount.updated 45 | customer.source.created 46 | customer.source.deleted 47 | customer.source.expiring 48 | customer.source.updated 49 | customer.subscription.created 50 | customer.subscription.deleted 51 | customer.subscription.pending_update_applied 52 | customer.subscription.pending_update_expired 53 | customer.subscription.trial_will_end 54 | customer.subscription.updated 55 | customer.tax_id.created 56 | customer.tax_id.deleted 57 | customer.tax_id.updated 58 | customer.updated 59 | file.created 60 | financial_connections.account.created 61 | financial_connections.account.deactivated 62 | financial_connections.account.disconnected 63 | financial_connections.account.reactivated 64 | financial_connections.account.refreshed_balance 65 | identity.verification_session.canceled 66 | identity.verification_session.created 67 | identity.verification_session.processing 68 | identity.verification_session.redacted 69 | identity.verification_session.requires_input 70 | identity.verification_session.verified 71 | invoice.created 72 | invoice.deleted 73 | invoice.finalization_failed 74 | invoice.finalized 75 | invoice.marked_uncollectible 76 | invoice.paid 77 | invoice.payment_action_required 78 | invoice.payment_failed 79 | invoice.payment_succeeded 80 | invoice.sent 81 | invoice.upcoming 82 | invoice.updated 83 | invoice.voided 84 | invoiceitem.created 85 | invoiceitem.deleted 86 | invoiceitem.updated 87 | issuing_authorization.created 88 | issuing_authorization.request 89 | issuing_authorization.updated 90 | issuing_card.created 91 | issuing_card.updated 92 | issuing_cardholder.created 93 | issuing_cardholder.updated 94 | issuing_dispute.closed 95 | issuing_dispute.created 96 | issuing_dispute.funds_reinstated 97 | issuing_dispute.submitted 98 | issuing_dispute.updated 99 | issuing_transaction.created 100 | issuing_transaction.updated 101 | mandate.updated 102 | order.created 103 | payment_intent.amount_capturable_updated 104 | payment_intent.canceled 105 | payment_intent.created 106 | payment_intent.partially_funded 107 | payment_intent.payment_failed 108 | payment_intent.processing 109 | payment_intent.requires_action 110 | payment_intent.succeeded 111 | payment_link.created 112 | payment_link.updated 113 | payment_method.attached 114 | payment_method.automatically_updated 115 | payment_method.detached 116 | payment_method.updated 117 | payout.canceled 118 | payout.created 119 | payout.failed 120 | payout.paid 121 | payout.updated 122 | person.created 123 | person.deleted 124 | person.updated 125 | plan.created 126 | plan.deleted 127 | plan.updated 128 | price.created 129 | price.deleted 130 | price.updated 131 | product.created 132 | product.deleted 133 | product.updated 134 | promotion_code.created 135 | promotion_code.updated 136 | quote.accepted 137 | quote.canceled 138 | quote.created 139 | quote.finalized 140 | radar.early_fraud_warning.created 141 | radar.early_fraud_warning.updated 142 | recipient.created 143 | recipient.deleted 144 | recipient.updated 145 | reporting.report_run.failed 146 | reporting.report_run.succeeded 147 | reporting.report_type.updated 148 | review.closed 149 | review.opened 150 | setup_intent.canceled 151 | setup_intent.created 152 | setup_intent.requires_action 153 | setup_intent.setup_failed 154 | setup_intent.succeeded 155 | sigma.scheduled_query_run.created 156 | sku.created 157 | sku.deleted 158 | sku.updated 159 | source.canceled 160 | source.chargeable 161 | source.failed 162 | source.mandate_notification 163 | source.refund_attributes_required 164 | source.transaction.created 165 | source.transaction.updated 166 | subscription_schedule.aborted 167 | subscription_schedule.canceled 168 | subscription_schedule.completed 169 | subscription_schedule.created 170 | subscription_schedule.expiring 171 | subscription_schedule.released 172 | subscription_schedule.updated 173 | tax_rate.created 174 | tax_rate.updated 175 | terminal.reader.action_failed 176 | terminal.reader.action_succeeded 177 | test_helpers.test_clock.advancing 178 | test_helpers.test_clock.created 179 | test_helpers.test_clock.deleted 180 | test_helpers.test_clock.internal_failure 181 | test_helpers.test_clock.ready 182 | topup.canceled 183 | topup.created 184 | topup.failed 185 | topup.reversed 186 | topup.succeeded 187 | transfer.created 188 | transfer.reversed 189 | transfer.updated 190 | treasury.credit_reversal.created 191 | treasury.credit_reversal.posted 192 | treasury.debit_reversal.completed 193 | treasury.debit_reversal.created 194 | treasury.debit_reversal.initial_credit_granted 195 | treasury.financial_account.closed 196 | treasury.financial_account.created 197 | treasury.financial_account.features_status_updated 198 | treasury.inbound_transfer.canceled 199 | treasury.inbound_transfer.created 200 | treasury.inbound_transfer.failed 201 | treasury.inbound_transfer.succeeded 202 | treasury.outbound_payment.canceled 203 | treasury.outbound_payment.created 204 | treasury.outbound_payment.expected_arrival_date_updated 205 | treasury.outbound_payment.failed 206 | treasury.outbound_payment.posted 207 | treasury.outbound_payment.returned 208 | treasury.outbound_transfer.canceled 209 | treasury.outbound_transfer.created 210 | treasury.outbound_transfer.expected_arrival_date_updated 211 | treasury.outbound_transfer.failed 212 | treasury.outbound_transfer.posted 213 | treasury.outbound_transfer.returned 214 | treasury.received_credit.created 215 | treasury.received_credit.failed 216 | treasury.received_credit.succeeded 217 | treasury.received_debit.created -------------------------------------------------------------------------------- /packages/stripe-sync/spec/eventTableMap.ts: -------------------------------------------------------------------------------- 1 | export const STRIPE_EVENT_TABLE_MAP = { 2 | "account.updated": "account", 3 | "account.application.authorized": "application", 4 | "account.application.deauthorized": "application", 5 | "account.external_account.created": "external_account", 6 | "account.external_account.deleted": "external_account", 7 | "account.external_account.updated": "external_account", 8 | "application_fee.created": "application_fee", 9 | "application_fee.refunded": "application_fee", 10 | "application_fee.refund.updated": "refund", 11 | "balance.available": "balance", 12 | "billing_portal.configuration.created": "billing_portal_configuration", 13 | "billing_portal.configuration.updated": "billing_portal_configuration", 14 | "billing_portal.session.created": "billing_portal_configuration", 15 | "capability.updated": "capability", 16 | "cash_balance.funds_available": "cash_balance", 17 | "charge.captured": "charge", 18 | "charge.expired": "charge", 19 | "charge.failed": "charge", 20 | "charge.pending": "charge", 21 | "charge.refunded": "charge", 22 | "charge.succeeded": "charge", 23 | "charge.updated": "charge", 24 | "charge.dispute.closed": "dispute", 25 | "charge.dispute.created": "dispute", 26 | "charge.dispute.funds_reinstated": "dispute", 27 | "charge.dispute.funds_withdrawn": "dispute", 28 | "charge.dispute.updated": "dispute", 29 | "charge.refund.updated": "refund", 30 | "checkout.session.async_payment_failed": "session", 31 | "checkout.session.async_payment_succeeded": "session", 32 | "checkout.session.completed": "session", 33 | "checkout.session.expired": "session", 34 | "coupon.created": "coupon", 35 | "coupon.deleted": "coupon", 36 | "coupon.updated": "coupon", 37 | "credit_note.created": "credit_note", 38 | "credit_note.updated": "credit_note", 39 | "credit_note.voided": "credit_note", 40 | "customer.created": "customer", 41 | "customer.deleted": "customer", 42 | "customer.updated": "customer", 43 | "customer.discount.created": "discount", 44 | "customer.discount.deleted": "discount", 45 | "customer.discount.updated": "discount", 46 | "customer.source.created": "source", 47 | "customer.source.deleted": "source", 48 | "customer.source.expiring": "source", 49 | "customer.source.updated": "source", 50 | "customer.subscription.created": "subscription", 51 | "customer.subscription.deleted": "subscription", 52 | "customer.subscription.pending_update_applied": "subscription", 53 | "customer.subscription.pending_update_expired": "subscription", 54 | "customer.subscription.trial_will_end": "subscription", 55 | "customer.subscription.updated": "subscription", 56 | "customer.tax_id.created": "tax_id", 57 | "customer.tax_id.deleted": "tax_id", 58 | "customer.tax_id.updated": "tax_id", 59 | "file.created": "file", 60 | "identity.verification_session.canceled": "identity_verification_session", 61 | "identity.verification_session.created": "identity_verification_session", 62 | "identity.verification_session.processing": "identity_verification_session", 63 | "identity.verification_session.redacted": "identity_verification_session", 64 | "identity.verification_session.requires_input": 65 | "identity_verification_session", 66 | "identity.verification_session.verified": "identity_verification_session", 67 | "invoice.created": "invoice", 68 | "invoice.deleted": "invoice", 69 | "invoice.finalization_failed": "invoice", 70 | "invoice.finalized": "invoice", 71 | "invoice.marked_uncollectible": "invoice", 72 | "invoice.paid": "invoice", 73 | "invoice.payment_action_required": "invoice", 74 | "invoice.payment_failed": "invoice", 75 | "invoice.payment_succeeded": "invoice", 76 | "invoice.sent": "invoice", 77 | "invoice.upcoming": "invoice", 78 | "invoice.updated": "invoice", 79 | "invoice.voided": "invoice", 80 | "invoiceitem.created": "invoiceitem", 81 | "invoiceitem.deleted": "invoiceitem", 82 | "invoiceitem.updated": "invoiceitem", 83 | "issuing_authorization.created": "issuing_authorization", 84 | "issuing_authorization.request": "issuing_authorization", 85 | "issuing_authorization.updated": "issuing_authorization", 86 | "issuing_card.created": "issuing_card", 87 | "issuing_card.updated": "issuing_card", 88 | "issuing_cardholder.created": "issuing_cardholder", 89 | "issuing_cardholder.updated": "issuing_cardholder", 90 | "issuing_dispute.closed": "issuing_dispute", 91 | "issuing_dispute.created": "issuing_dispute", 92 | "issuing_dispute.funds_reinstated": "issuing_dispute", 93 | "issuing_dispute.submitted": "issuing_dispute", 94 | "issuing_dispute.updated": "issuing_dispute", 95 | "issuing_transaction.created": "issuing_transaction", 96 | "issuing_transaction.updated": "issuing_transaction", 97 | "mandate.updated": "mandate", 98 | "order.created": "order", 99 | "order.payment_failed": "order", 100 | "order.payment_succeeded": "order", 101 | "order.updated": "order", 102 | "order_return.created": "UNHANDLED", // FIXME when stripe figures out what their order_return is https://stripe.com/docs/api/invoices#order_return_object 103 | "payment_intent.amount_capturable_updated": "payment_intent", 104 | "payment_intent.canceled": "payment_intent", 105 | "payment_intent.created": "payment_intent", 106 | "payment_intent.partially_funded": "payment_intent", 107 | "payment_intent.payment_failed": "payment_intent", 108 | "payment_intent.processing": "payment_intent", 109 | "payment_intent.requires_action": "payment_intent", 110 | "payment_intent.succeeded": "payment_intent", 111 | "payment_link.created": "payment_link", 112 | "payment_link.updated": "payment_link", 113 | "payment_method.attached": "payment_method", 114 | "payment_method.automatically_updated": "payment_method", 115 | "payment_method.detached": "payment_method", 116 | "payment_method.updated": "payment_method", 117 | "payout.canceled": "payout", 118 | "payout.created": "payout", 119 | "payout.failed": "payout", 120 | "payout.paid": "payout", 121 | "payout.updated": "payout", 122 | "person.created": "person", 123 | "person.deleted": "person", 124 | "person.updated": "person", 125 | "plan.created": "plan", 126 | "plan.deleted": "plan", 127 | "plan.updated": "plan", 128 | "price.created": "price", 129 | "price.deleted": "price", 130 | "price.updated": "price", 131 | "product.created": "product", 132 | "product.deleted": "product", 133 | "product.updated": "product", 134 | "promotion_code.created": "promotion_code", 135 | "promotion_code.updated": "promotion_code", 136 | "quote.accepted": "quote", 137 | "quote.canceled": "quote", 138 | "quote.created": "quote", 139 | "quote.finalized": "quote", 140 | "radar.early_fraud_warning.created": "radar_early_fraud_warning", 141 | "radar.early_fraud_warning.updated": "radar_early_fraud_warning", 142 | "recipient.created": "recipient", 143 | "recipient.deleted": "recipient", 144 | "recipient.updated": "recipient", 145 | "reporting.report_run.failed": "reporting_report_run", 146 | "reporting.report_run.succeeded": "reporting_report_run", 147 | "reporting.report_type.updated": "reporting_report_type", 148 | "review.closed": "review", 149 | "review.opened": "review", 150 | "setup_intent.canceled": "setup_intent", 151 | "setup_intent.created": "setup_intent", 152 | "setup_intent.requires_action": "setup_intent", 153 | "setup_intent.setup_failed": "setup_intent", 154 | "setup_intent.succeeded": "setup_intent", 155 | "sigma.scheduled_query_run.created": "scheduled_query_run", 156 | "sku.created": "sku", 157 | "sku.deleted": "sku", 158 | "sku.updated": "sku", 159 | "source.canceled": "source", 160 | "source.chargeable": "source", 161 | "source.failed": "source", 162 | "source.mandate_notification": "source", 163 | "source.refund_attributes_required": "source", 164 | "source.transaction.created": "source_transaction", 165 | "source.transaction.updated": "source_transaction", 166 | "subscription_schedule.aborted": "subscription_schedule", 167 | "subscription_schedule.canceled": "subscription_schedule", 168 | "subscription_schedule.completed": "subscription_schedule", 169 | "subscription_schedule.created": "subscription_schedule", 170 | "subscription_schedule.expiring": "subscription_schedule", 171 | "subscription_schedule.released": "subscription_schedule", 172 | "subscription_schedule.updated": "subscription_schedule", 173 | "tax_rate.created": "tax_rate", 174 | "tax_rate.updated": "tax_rate", 175 | "terminal.reader.action_failed": "terminal_reader", 176 | "terminal.reader.action_succeeded": "terminal_reader", 177 | "test_helpers.test_clock.advancing": "UNHANDLED", 178 | "test_helpers.test_clock.created": "UNHANDLED", 179 | "test_helpers.test_clock.deleted": "UNHANDLED", 180 | "test_helpers.test_clock.internal_failure": "UNHANDLED", 181 | "test_helpers.test_clock.ready": "UNHANDLED", 182 | "topup.canceled": "topup", 183 | "topup.created": "topup", 184 | "topup.failed": "topup", 185 | "topup.reversed": "topup", 186 | "topup.succeeded": "topup", 187 | "transfer.created": "transfer", 188 | "transfer.failed": "transfer", 189 | "transfer.paid": "transfer", 190 | "transfer.reversed": "transfer", 191 | "transfer.updated": "transfer", 192 | }; 193 | -------------------------------------------------------------------------------- /packages/stripe-sync/spec/resources.txt: -------------------------------------------------------------------------------- 1 | application 2 | application 3 | external_account 4 | external_account 5 | external_account 6 | account 7 | application_fee 8 | refund 9 | application_fee 10 | balance 11 | configuration 12 | configuration 13 | session 14 | capability 15 | cash_balance 16 | charge 17 | dispute 18 | dispute 19 | dispute 20 | dispute 21 | dispute 22 | charge 23 | charge 24 | charge 25 | refund 26 | charge 27 | charge 28 | charge 29 | session 30 | session 31 | session 32 | session 33 | coupon 34 | coupon 35 | coupon 36 | credit_note 37 | credit_note 38 | credit_note 39 | customer 40 | customer 41 | discount 42 | discount 43 | discount 44 | source 45 | source 46 | source 47 | source 48 | subscription 49 | subscription 50 | subscription 51 | subscription 52 | subscription 53 | subscription 54 | tax_id 55 | tax_id 56 | tax_id 57 | customer 58 | file 59 | account 60 | account 61 | account 62 | account 63 | account 64 | verification_session 65 | verification_session 66 | verification_session 67 | verification_session 68 | verification_session 69 | verification_session 70 | invoice 71 | invoice 72 | invoice 73 | invoice 74 | invoice 75 | invoice 76 | invoice 77 | invoice 78 | invoice 79 | invoice 80 | invoice 81 | invoice 82 | invoice 83 | invoiceitem 84 | invoiceitem 85 | invoiceitem 86 | issuing_authorization 87 | issuing_authorization 88 | issuing_authorization 89 | issuing_card 90 | issuing_card 91 | issuing_cardholder 92 | issuing_cardholder 93 | issuing_dispute 94 | issuing_dispute 95 | issuing_dispute 96 | issuing_dispute 97 | issuing_dispute 98 | issuing_transaction 99 | issuing_transaction 100 | mandate 101 | order 102 | payment_intent 103 | payment_intent 104 | payment_intent 105 | payment_intent 106 | payment_intent 107 | payment_intent 108 | payment_intent 109 | payment_intent 110 | payment_link 111 | payment_link 112 | payment_method 113 | payment_method 114 | payment_method 115 | payment_method 116 | payout 117 | payout 118 | payout 119 | payout 120 | payout 121 | person 122 | person 123 | person 124 | plan 125 | plan 126 | plan 127 | price 128 | price 129 | price 130 | product 131 | product 132 | product 133 | promotion_code 134 | promotion_code 135 | quote 136 | quote 137 | quote 138 | quote 139 | early_fraud_warning 140 | early_fraud_warning 141 | recipient 142 | recipient 143 | recipient 144 | report_run 145 | report_run 146 | report_type 147 | review 148 | review 149 | setup_intent 150 | setup_intent 151 | setup_intent 152 | setup_intent 153 | setup_intent 154 | scheduled_query_run 155 | sku 156 | sku 157 | sku 158 | source 159 | source 160 | source 161 | source 162 | source 163 | transaction 164 | transaction 165 | subscription_schedule 166 | subscription_schedule 167 | subscription_schedule 168 | subscription_schedule 169 | subscription_schedule 170 | subscription_schedule 171 | subscription_schedule 172 | tax_rate 173 | tax_rate 174 | reader 175 | reader 176 | test_clock 177 | test_clock 178 | test_clock 179 | test_clock 180 | test_clock 181 | topup 182 | topup 183 | topup 184 | topup 185 | topup 186 | transfer 187 | transfer 188 | transfer 189 | credit_reversal 190 | credit_reversal 191 | debit_reversal 192 | debit_reversal 193 | debit_reversal 194 | financial_account 195 | financial_account 196 | financial_account 197 | inbound_transfer 198 | inbound_transfer 199 | inbound_transfer 200 | inbound_transfer 201 | outbound_payment 202 | outbound_payment 203 | outbound_payment 204 | outbound_payment 205 | outbound_payment 206 | outbound_payment 207 | outbound_transfer 208 | outbound_transfer 209 | outbound_transfer 210 | outbound_transfer 211 | outbound_transfer 212 | outbound_transfer 213 | received_credit 214 | received_credit 215 | received_credit 216 | received_debit -------------------------------------------------------------------------------- /packages/stripe-sync/spec/uniqueResources.txt: -------------------------------------------------------------------------------- 1 | application 2 | external_account 3 | account 4 | application_fee 5 | refund 6 | balance 7 | configuration 8 | session 9 | capability 10 | cash_balance 11 | charge 12 | dispute 13 | coupon 14 | credit_note 15 | customer 16 | discount 17 | source 18 | subscription 19 | tax_id 20 | file 21 | verification_session 22 | invoice 23 | invoiceitem 24 | issuing_authorization 25 | issuing_card 26 | issuing_cardholder 27 | issuing_dispute 28 | issuing_transaction 29 | mandate 30 | order 31 | payment_intent 32 | payment_link 33 | payment_method 34 | payout 35 | person 36 | plan 37 | price 38 | product 39 | promotion_code 40 | quote 41 | early_fraud_warning 42 | recipient 43 | report_run 44 | report_type 45 | review 46 | setup_intent 47 | scheduled_query_run 48 | sku 49 | transaction 50 | subscription_schedule 51 | tax_rate 52 | reader 53 | test_clock 54 | topup 55 | transfer 56 | credit_reversal 57 | debit_reversal 58 | financial_account 59 | inbound_transfer 60 | outbound_payment 61 | outbound_transfer 62 | received_credit 63 | received_debit -------------------------------------------------------------------------------- /packages/stripe-sync/src/adapters/deno.ts: -------------------------------------------------------------------------------- 1 | import { createRequestHandler as createDenoRequestHandler } from "@hattip/adapter-deno"; 2 | import { createHandler, HandlerOptions } from "../handler"; 3 | 4 | export type Handler = ( 5 | request: Request, 6 | connInfo: any 7 | ) => Response | Promise; 8 | 9 | export const createDenoHandler = (opts: HandlerOptions) => 10 | createDenoRequestHandler(createHandler(opts)) as Handler; 11 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/adapters/express.ts: -------------------------------------------------------------------------------- 1 | import { createMiddleware } from "@hattip/adapter-node"; 2 | import { createHandler, HandlerOptions } from "../handler"; 3 | 4 | export const createExpressHandler = (opts: HandlerOptions) => 5 | createMiddleware(createHandler(opts)); 6 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/adapters/fetch.ts: -------------------------------------------------------------------------------- 1 | import { createHandler, HandlerOptions } from "../handler"; 2 | 3 | export type Handler = ( 4 | request: Request, 5 | connInfo: any 6 | ) => Response | Promise; 7 | 8 | export const createStripeSyncHandler = 9 | (opts: HandlerOptions) => (request: Request) => 10 | createHandler(opts)({ 11 | request, 12 | ip: "", 13 | passThrough: () => ({}), 14 | platform: "deno", 15 | waitUntil: () => ({}), 16 | }); 17 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/adapters/next.ts: -------------------------------------------------------------------------------- 1 | import { createExpressHandler } from "./express"; 2 | 3 | export const createNextHandler = createExpressHandler; 4 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/databaseAdapters/createDatabaseAdapter.ts: -------------------------------------------------------------------------------- 1 | export interface DatabaseAdapter { 2 | schema: string; 3 | getFromClause: (opts: { schema: string; table: string }) => string; 4 | upsertRow(opts: { 5 | fullTableName: string; 6 | data: any; 7 | columnNames: string[]; 8 | onConflictColumns?: string[]; 9 | }): Promise; 10 | } 11 | 12 | export function createDatabaseAdapter(opts: DatabaseAdapter) { 13 | return opts; 14 | } 15 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/databaseAdapters/supabase.ts: -------------------------------------------------------------------------------- 1 | import type { SupabaseClient } from "@supabase/supabase-js"; 2 | import { createDatabaseAdapter } from "./createDatabaseAdapter"; 3 | 4 | export function createSupabaseAdapter(opts: { 5 | supabase: SupabaseClient; 6 | schema?: string; 7 | }) { 8 | const { supabase, schema } = opts; 9 | return createDatabaseAdapter({ 10 | schema: schema ?? "stripe", 11 | upsertRow: async (opts) => { 12 | const { error } = await supabase 13 | .from(opts.fullTableName) 14 | .upsert(opts.data, { onConflict: opts.onConflictColumns?.join(",") }); 15 | if (error) { 16 | throw error; 17 | } 18 | }, 19 | getFromClause: ({ schema, table }) => `${table}`, 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/entry-node.ts: -------------------------------------------------------------------------------- 1 | import { createServer } from "@hattip/adapter-node"; 2 | import { createClient } from "@supabase/supabase-js"; 3 | import dotenv from "dotenv"; 4 | import Stripe from "stripe"; 5 | import z from "zod"; 6 | import { createSupabaseAdapter } from "./databaseAdapters/supabase"; 7 | import { createHandler } from "./handler"; 8 | dotenv.config(); 9 | 10 | const port = 5678; 11 | 12 | const envParser = z.object({ 13 | STRIPE_SK: z.string(), 14 | STRIPE_ENDPOINT_SECRET: z.string(), 15 | SUPABASE_URL: z.string().url(), 16 | SUPABASE_SERVICE_ROLE_KEY: z.string(), 17 | }); 18 | const env = envParser.parse(process.env); 19 | 20 | const stripe = new Stripe(env.STRIPE_SK, { 21 | apiVersion: "2022-08-01", 22 | }); 23 | 24 | const supabase = createClient(env.SUPABASE_URL, env.SUPABASE_SERVICE_ROLE_KEY, { 25 | db: { 26 | schema: "stripe", 27 | }, 28 | }); 29 | 30 | const supabaseAdapter = createSupabaseAdapter({ 31 | supabase, 32 | schema: "stripe", 33 | }); 34 | 35 | const handler = createHandler({ 36 | stripe: stripe, 37 | stripeSecretKey: env.STRIPE_SK, 38 | stripeEndpointSecret: env.STRIPE_ENDPOINT_SECRET, 39 | databaseAdapter: supabaseAdapter, 40 | }); 41 | 42 | createServer(handler).listen(port, "localhost", () => { 43 | console.log(`Server listening on http://localhost:${port}`); 44 | }); 45 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/generate.ts: -------------------------------------------------------------------------------- 1 | import SwaggerParser from "@apidevtools/swagger-parser"; 2 | import fs from "fs-extra"; 3 | import invariant from "tiny-invariant"; 4 | import z from "zod"; 5 | import { eventToResource, Resource } from "./utils/eventToResource"; 6 | 7 | const SPEC_PATH = "./stripe-openapi/openapi/spec3.json"; 8 | 9 | function isStringArray(value: any): value is string[] { 10 | return Array.isArray(value) && value.every((v) => typeof v === "string"); 11 | } 12 | 13 | function resolveRef(schema: any, ref: string) { 14 | const [_, ...path] = ref.split("/"); 15 | let result = schema; 16 | for (const part of path) { 17 | result = result[part]; 18 | } 19 | return result; 20 | } 21 | 22 | function isObject(obj: any) { 23 | return typeof obj === "object" && !Array.isArray(obj) && obj !== null; 24 | } 25 | 26 | function recursivelyDereference(obj: object, schema: any) { 27 | if (!obj || !isObject(obj)) { 28 | return obj; 29 | } 30 | if (obj["$ref"]) { 31 | const ref = obj["$ref"]; 32 | return resolveRef(schema, ref); 33 | } 34 | if (obj["allOf"]) { 35 | return { 36 | allOf: obj["allOf"].map((o) => recursivelyDereference(o, schema)), 37 | }; 38 | } 39 | if (obj["oneOf"]) { 40 | return { 41 | oneOf: obj["oneOf"].map((o) => recursivelyDereference(o, schema)), 42 | }; 43 | } 44 | if (obj["anyOf"]) { 45 | return { 46 | anyOf: obj["anyOf"].map((o) => recursivelyDereference(o, schema)), 47 | }; 48 | } 49 | const out = {}; 50 | for (const key of Object.keys(obj)) { 51 | out[key] = recursivelyDereference(obj[key], schema); 52 | } 53 | return out; 54 | } 55 | 56 | function getUniqueResources(resources: Resource[]): Resource[] { 57 | const usedResources = new Set(); 58 | const uniqueResources = new Array(); 59 | for (const resource of resources) { 60 | if (!usedResources.has(resource.resource)) { 61 | usedResources.add(resource.resource); 62 | uniqueResources.push(resource); 63 | } 64 | } 65 | return uniqueResources; 66 | } 67 | 68 | function getResourceSchemaHeuristic(schemas: any, resource: Resource) { 69 | const fullResource = resource.subresource 70 | ? `${resource.subresource}.${resource.resource}` 71 | : resource.resource; 72 | if (schemas[fullResource]) { 73 | return { schema: schemas[fullResource], key: fullResource }; 74 | } 75 | if (schemas[resource.resource]) { 76 | return { schema: schemas[resource.resource], key: resource.resource }; 77 | } 78 | // issuing_authorization => issuing.authorization, issuing_card=>issuing.card... 79 | const dotSyntax = resource.resource.replace(/_/g, "."); 80 | if (schemas[dotSyntax]) { 81 | return { schema: schemas[dotSyntax], key: dotSyntax }; 82 | } 83 | // source.transaction -> source_transaction 84 | const underscoreSyntax = `${resource.subresource}_${resource.resource}`; 85 | if (schemas[underscoreSyntax]) { 86 | return { schema: schemas[underscoreSyntax], key: underscoreSyntax }; 87 | } 88 | console.error( 89 | `Could not find schema for resource: ${JSON.stringify(resource)}` 90 | ); 91 | throw new Error(`Could not find schema for ${resource.resource}`); 92 | } 93 | 94 | async function main() { 95 | try { 96 | const t1 = performance.now(); 97 | const spec = (await SwaggerParser.parse(SPEC_PATH)) as any; 98 | const webhookEndpoints = spec["paths"]["/v1/webhook_endpoints"]; 99 | const webhookEndpointsSchema = 100 | webhookEndpoints["post"]["requestBody"]["content"][ 101 | "application/x-www-form-urlencoded" 102 | ]["schema"]; 103 | // const apiVersions = schema["properties"]["api_version"]["enum"]; 104 | const enabledEvents = 105 | webhookEndpointsSchema["properties"]["enabled_events"]["items"]["enum"]; 106 | invariant( 107 | isStringArray(enabledEvents), 108 | "enabledEvents is not string array" 109 | ); 110 | const schemas = spec["components"]["schemas"]; 111 | 112 | const eventTableMap = {}; 113 | const webhookResources = {}; 114 | const dereferencedResources = {}; 115 | const visitedResources = new Set(); 116 | for (const event of enabledEvents) { 117 | if (event === "*") { 118 | continue; 119 | } 120 | const resource = eventToResource(event); 121 | if (resource.resource === "external_account") { 122 | continue; 123 | } 124 | const resourceSchema = getResourceSchemaHeuristic(schemas, resource); 125 | if (!resourceSchema) { 126 | continue; 127 | } 128 | const { schema: webhookResourceSchema, key: tableName } = resourceSchema; 129 | eventTableMap[event] = resource.resource; 130 | if (!visitedResources.has(resource.resource)) { 131 | webhookResources[resource.resource] = webhookResourceSchema; 132 | const dereferenced = recursivelyDereference( 133 | webhookResourceSchema, 134 | spec 135 | ); 136 | dereferencedResources[resource.resource] = dereferenced; 137 | } 138 | visitedResources.add(resource.resource); 139 | } 140 | 141 | const schemaObjectValidator = z.object({ 142 | properties: z.record(z.string(), z.any()), 143 | required: z.array(z.string()).optional(), 144 | }); 145 | const propertyValidator = z.object({ 146 | description: z.string().optional(), 147 | type: z 148 | .enum(["string", "object", "boolean", "integer", "array", "number"]) 149 | .optional(), 150 | nullable: z.boolean().optional(), 151 | }); 152 | type Property = z.infer; 153 | 154 | function resolveType(column: string, property: Property) { 155 | if ( 156 | !property.type || 157 | property.type === "array" || 158 | property.type === "object" 159 | ) { 160 | column; 161 | return `jsonb`; 162 | } else if (property.type === "boolean") { 163 | return `boolean`; 164 | } else if (property.type === "integer" || property.type === "number") { 165 | return `integer`; 166 | } else if (property.type === "string") { 167 | return `text`; 168 | } 169 | } 170 | 171 | function interpolateColumnAndProperty( 172 | column: string, 173 | property: Property, 174 | required: boolean 175 | ) { 176 | if (column === "id") { 177 | return `"${column}" ${resolveType( 178 | column, 179 | property 180 | )} PRIMARY KEY NOT NULL`; 181 | } 182 | if (property["x-stripeBypassValidation"]) { 183 | return `"${column}" ${resolveType(column, property)}`; 184 | } 185 | if (required) { 186 | return `"${column}" ${resolveType(column, property)} NOT NULL`; 187 | } else { 188 | return `"${column}" ${resolveType(column, property)}`; 189 | } 190 | } 191 | 192 | const tableColumns = {}; 193 | 194 | for (const [resource, _schema] of Object.entries(dereferencedResources)) { 195 | const schema = schemaObjectValidator.parse(_schema); 196 | tableColumns[resource] = Object.keys(schema.properties); 197 | } 198 | 199 | let ddl = ""; 200 | for (const [resource, _schema] of Object.entries(dereferencedResources)) { 201 | ddl += `CREATE TABLE stripe.${resource} (\n`; 202 | const schema = schemaObjectValidator.parse(_schema); 203 | const required = new Set(schema.required); 204 | 205 | // client secrets are not sent in webhook payloads 206 | if (required.has("client_secret")) { 207 | required.delete("client_secret"); 208 | } 209 | // todo: sometimes created is missing from stripe cli trigger 210 | if (required.has("created")) { 211 | required.delete("created"); 212 | } 213 | // customer.source 214 | if (required.has("flow")) { 215 | required.delete("flow"); 216 | } 217 | if (required.has("livemode")) { 218 | required.delete("livemode"); 219 | } 220 | if (required.has("status")) { 221 | required.delete("status"); 222 | } 223 | // end customer.source 224 | // todo: i have no clue 225 | if (required.has("configuration")) { 226 | required.delete("configuration"); 227 | } 228 | const columnDefinitions = Object.entries(schema.properties).map( 229 | ([column, property]) => 230 | interpolateColumnAndProperty(column, property, required.has(column)) 231 | ); 232 | ddl += ` ${columnDefinitions.join(",\n ")}\n`; 233 | ddl += ");\n"; 234 | } 235 | 236 | const postgres_ddl = `CREATE SCHEMA stripe;\n` + ddl; 237 | const postgres_schemaless_no_prefix = ddl.replace(/stripe\./g, "public."); 238 | const postgres_schemaless_ddl = ddl.replace(/stripe\./g, "stripe_"); 239 | const mysql_ddl = postgres_schemaless_ddl 240 | .replace(/jsonb/g, "json") 241 | .replace(/\"/g, "`"); 242 | 243 | fs.ensureDirSync("./generated"); 244 | fs.writeFileSync("./generated/postgres.sql", postgres_ddl); 245 | fs.writeFileSync( 246 | "./generated/postgres-schemaless-no-prefix.sql", 247 | postgres_schemaless_no_prefix 248 | ); 249 | fs.writeFileSync( 250 | "./generated/postgres-schemaless.sql", 251 | postgres_schemaless_ddl 252 | ); 253 | fs.writeFileSync("./generated/mysql.sql", mysql_ddl); 254 | fs.writeFileSync( 255 | "./generated/tableColumns.json", 256 | JSON.stringify(tableColumns, null, 2) 257 | ); 258 | fs.writeFileSync( 259 | "./generated/dereferencedResources.json", 260 | JSON.stringify(dereferencedResources, null, 2) 261 | ); 262 | fs.writeFileSync( 263 | "./generated/eventTableMap.ts", 264 | `export const STRIPE_EVENT_TABLE_MAP = ${JSON.stringify( 265 | eventTableMap, 266 | null, 267 | 2 268 | )}` 269 | ); 270 | fs.writeFileSync( 271 | "./generated/stripeTables.ts", 272 | `export const STRIPE_TABLES = ${JSON.stringify(tableColumns, null, 2)}` 273 | ); 274 | const t2 = performance.now(); 275 | console.log(`Finished generating in ${(t2 - t1).toFixed(2)} ms`); 276 | } catch (err) { 277 | console.error(err); 278 | } 279 | } 280 | 281 | main(); 282 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/handler.ts: -------------------------------------------------------------------------------- 1 | import { type HattipHandler } from "@hattip/core"; 2 | import type Stripe from "stripe"; 3 | import invariant from "tiny-invariant"; 4 | import { STRIPE_EVENT_TABLE_MAP } from "../generated/eventTableMap"; 5 | import { STRIPE_TABLES } from "../generated/stripeTables"; 6 | import { type DatabaseAdapter } from "./databaseAdapters/createDatabaseAdapter"; 7 | import { logger } from "./utils/logger"; 8 | 9 | export type StripeEventTypes = keyof typeof STRIPE_EVENT_TABLE_MAP; 10 | export type StripeWebhookCallbacks = { 11 | [type in StripeEventTypes]?: (event: Stripe.Event) => Promise | void; 12 | }; 13 | 14 | export interface HandlerOptions { 15 | stripe: Stripe; 16 | stripeEndpointSecret: string; 17 | stripeSecretKey: string; 18 | databaseAdapter?: DatabaseAdapter; 19 | insertIntoDatabaseFirst?: boolean; 20 | callbacks?: StripeWebhookCallbacks; 21 | cryptoProvider?: Stripe.CryptoProvider; 22 | enableLogs?: boolean; 23 | } 24 | 25 | function getTableName(event: Stripe.Event) { 26 | if (!(event.type in STRIPE_EVENT_TABLE_MAP)) { 27 | throw new Error(`Unknown event type: ${event.type}`); 28 | } 29 | return STRIPE_EVENT_TABLE_MAP[event.type]; 30 | } 31 | 32 | async function saveToDatabase(opts: { 33 | event: Stripe.Event; 34 | databaseAdapter: DatabaseAdapter; 35 | handlerOpts: HandlerOptions; 36 | }) { 37 | const { event, databaseAdapter } = opts; 38 | const object = event.data.object; 39 | const tableName = getTableName(event); 40 | invariant(tableName, "missing tableName"); 41 | const columnNames = STRIPE_TABLES[tableName]; 42 | invariant(columnNames, "missing columnNames"); 43 | const fullTableName = opts.databaseAdapter.getFromClause({ 44 | schema: databaseAdapter.schema, 45 | table: tableName, 46 | }); 47 | const nonNullData = Object.fromEntries( 48 | Object.entries(object).filter( 49 | ([key, value]) => value !== null && columnNames.includes(key) 50 | ) 51 | ); 52 | await databaseAdapter.upsertRow({ 53 | data: nonNullData, 54 | fullTableName, 55 | columnNames, 56 | }); 57 | opts.handlerOpts.enableLogs && 58 | logger.log(`Saved ${event.type} to ${fullTableName}. eventId: ${event.id}`); 59 | } 60 | 61 | async function dispatchCallback(opts: { 62 | event: Stripe.Event; 63 | handlerOpts: HandlerOptions; 64 | }) { 65 | const { event, handlerOpts } = opts; 66 | const { callbacks } = handlerOpts; 67 | 68 | if (callbacks?.[event.type]) { 69 | await callbacks[event.type](event); 70 | } 71 | } 72 | 73 | export function createHandler(opts: HandlerOptions) { 74 | const handler: HattipHandler = async (context) => { 75 | const { request } = context; 76 | try { 77 | if (request.method !== "POST") { 78 | throw new Error("Only POST requests are allowed"); 79 | } 80 | 81 | const signature = request.headers.get("stripe-signature"); 82 | if (!signature) { 83 | throw new Error("missing signature header"); 84 | } 85 | let event: Stripe.Event; 86 | try { 87 | const body = await request.text(); 88 | event = await opts.stripe.webhooks.constructEventAsync( 89 | body, 90 | signature, 91 | opts.stripeEndpointSecret, 92 | undefined, 93 | opts.cryptoProvider 94 | ); 95 | event = JSON.parse(body); 96 | } catch (err: any) { 97 | logger.log(`⚠️ Webhook signature verification failed `, err.message); 98 | throw new Response("Invalid signature", { 99 | status: 401, 100 | }); 101 | } 102 | opts.enableLogs && 103 | logger.log(`Received triggered ${event.type}. (${event.id})`); 104 | try { 105 | const jobs = [] as Array>; 106 | if (opts.databaseAdapter) { 107 | jobs.push( 108 | saveToDatabase({ 109 | event, 110 | databaseAdapter: opts.databaseAdapter, 111 | handlerOpts: opts, 112 | }) 113 | ); 114 | } 115 | if (opts.callbacks) { 116 | jobs.push(dispatchCallback({ event, handlerOpts: opts })); 117 | } 118 | if (opts.insertIntoDatabaseFirst) { 119 | for (const job of jobs) { 120 | await job; 121 | } 122 | } else { 123 | await Promise.all(jobs); 124 | } 125 | } catch (e) { 126 | logger.error( 127 | `Error handling ${event.type}`, 128 | JSON.stringify(e, null, 2) 129 | ); 130 | return new Response("Error handling event", { 131 | status: 500, 132 | }); 133 | } 134 | return new Response("ok"); 135 | } catch (e) { 136 | logger.error(JSON.stringify((e as any)?.message, null, 2)); 137 | throw new Response("server error", { status: 500 }); 138 | } 139 | }; 140 | return handler; 141 | } 142 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | HandlerOptions, 3 | StripeEventTypes, 4 | StripeWebhookCallbacks, 5 | } from "./handler"; 6 | 7 | export { HandlerOptions, StripeEventTypes, StripeWebhookCallbacks }; 8 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/utils/eventToResource.ts: -------------------------------------------------------------------------------- 1 | import invariant from "tiny-invariant"; 2 | 3 | export type Resource = { 4 | resource: string; 5 | subresource?: string; 6 | }; 7 | export function eventToResource(event: string): Resource { 8 | if (event.includes("checkout.session")) { 9 | return { 10 | resource: "checkout_session", 11 | subresource: undefined, 12 | }; 13 | } 14 | const split = event.split("."); 15 | const resource = split.at(-2); 16 | invariant(resource, `Could not find resource for event: ${event}`); 17 | if (split.length === 2) { 18 | return { 19 | resource, 20 | subresource: undefined, 21 | }; 22 | } 23 | if (split.length === 3) { 24 | return { 25 | resource, 26 | subresource: split.at(0), 27 | }; 28 | } 29 | throw new Error(`Could not parse event: ${event}`); 30 | } 31 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | export const logger = { 2 | log: (...args: any[]) => { 3 | console.log(`[stripe-sync][log][${new Date().toISOString()}] --> ${args}`); 4 | }, 5 | error: (...args: any[]) => { 6 | console.error( 7 | `[stripe-sync][error][${new Date().toISOString()}] --> ${args}` 8 | ); 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/xod/README.md: -------------------------------------------------------------------------------- 1 | https://twitter.com/mattpocockuk/status/1554766319165358081 2 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/xod/foo.ts: -------------------------------------------------------------------------------- 1 | type Role = "admin" | "user"; 2 | interface User { 3 | name: string; 4 | role: Role; 5 | } 6 | type UserButAType = { name: string; role: Role; id: number; age: number }; 7 | -------------------------------------------------------------------------------- /packages/stripe-sync/src/xod/index.ts: -------------------------------------------------------------------------------- 1 | // class XodInterface { 2 | // private _type: string; 3 | // private _name: string; 4 | // private _value: string; 5 | 6 | // constructor(name: string, value: any) { 7 | // this._type = "interface"; 8 | // this._name = name; 9 | // this._value = value; 10 | // } 11 | 12 | // add(name: string, value: string) { 13 | // return new XodInterface(name, value); 14 | // } 15 | // } 16 | import prettier from "prettier"; 17 | 18 | function init() { 19 | function _literal(input: string) { 20 | return { 21 | type: "literal", 22 | value: input, 23 | }; 24 | } 25 | 26 | function _string() { 27 | return { 28 | type: "string", 29 | }; 30 | } 31 | 32 | function _number() { 33 | return { 34 | type: "number", 35 | }; 36 | } 37 | 38 | function _union(input: any[]) { 39 | return { 40 | type: "union", 41 | value: input, 42 | }; 43 | } 44 | 45 | function _array(input: any[]) { 46 | return { 47 | type: "array", 48 | value: input, 49 | }; 50 | } 51 | 52 | function _object(input: any) { 53 | return { 54 | type: "object", 55 | value: input, 56 | }; 57 | } 58 | 59 | function _type(name: string, value: any) { 60 | return { 61 | type: "type", 62 | name, 63 | value, 64 | }; 65 | } 66 | 67 | function _interface(name: string, value: any) { 68 | return { 69 | type: "interface", 70 | name, 71 | value, 72 | }; 73 | } 74 | 75 | function generateValue(input: any) { 76 | const { type, value, name } = input; 77 | switch (type) { 78 | case "literal": { 79 | return `"${value}"`; 80 | } 81 | case "string": { 82 | return `string`; 83 | } 84 | case "number": { 85 | return `number`; 86 | } 87 | case "union": { 88 | return `(${value.map((x) => generateValue(x)).join(" | ")})`; 89 | } 90 | case "array": { 91 | return `[${value.map((x) => generateValue(x)).join(", ")}]`; 92 | } 93 | case "object": { 94 | return `{${Object.keys(value) 95 | .map((key) => `${key}: ${generateValue(value[key])};`) 96 | .join(" ")}}`; 97 | } 98 | case "type": { 99 | return `${name}`; 100 | } 101 | case "interface": { 102 | return `${name}`; 103 | } 104 | default: { 105 | throw new Error(`Unknown type: ${type}`); 106 | } 107 | } 108 | } 109 | 110 | function generate(input: any) { 111 | let out = ""; 112 | const { type, value, name } = input; 113 | switch (type) { 114 | case "type": { 115 | out += `type ${name} = ${generateValue(value)};`; 116 | break; 117 | } 118 | case "interface": { 119 | out += `interface ${name} ${generateValue(value)};`; 120 | break; 121 | } 122 | default: { 123 | throw new Error(`Invalid type: ${type}`); 124 | } 125 | } 126 | return out; 127 | } 128 | 129 | function generateMany(input: any[]) { 130 | return input.map((x) => generate(x)).join("\n"); 131 | } 132 | 133 | function writeFile(fileName: string, input: any[]) { 134 | const code = generate(input); 135 | console.log(code); 136 | } 137 | 138 | return { 139 | literal: _literal, 140 | string: _string, 141 | number: _number, 142 | union: _union, 143 | array: _array, 144 | object: _object, 145 | type: _type, 146 | interface: _interface, 147 | generate, 148 | generateMany, 149 | writeFile, 150 | }; 151 | } 152 | 153 | export const x = init(); 154 | 155 | const role = x.type("Role", x.union([x.literal("admin"), x.literal("user")])); 156 | const user = x.interface("User", x.object({ name: x.string(), role })); 157 | const user2 = x.type( 158 | "UserButAType", 159 | x.object({ 160 | name: x.string(), 161 | role, 162 | id: x.number(), 163 | age: x.number(), 164 | nick: x.string(), 165 | }) 166 | ); 167 | 168 | const out = prettier.format(x.generateMany([role, user, user2]), { 169 | parser: "typescript", 170 | }); 171 | console.log(out); 172 | -------------------------------------------------------------------------------- /packages/stripe-sync/tests/all-events.ts: -------------------------------------------------------------------------------- 1 | import fs from "node:fs"; 2 | import util from "node:util"; 3 | import child from "node:child_process"; 4 | 5 | const exec = util.promisify(child.exec); 6 | 7 | const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms)); 8 | 9 | const unsupportedEvents = new Array(); 10 | 11 | async function main() { 12 | const _events = fs.readFileSync("./spec/enabledEvents.txt", "utf-8"); 13 | const events = _events.split("\n").filter((e) => e !== "*"); 14 | for (const event of events) { 15 | const command = `stripe trigger ${event}`; 16 | try { 17 | const { stdout, stderr } = await exec(command); 18 | console.log(stdout, stderr); 19 | await sleep(500); 20 | } catch (e) { 21 | unsupportedEvents.push(event); 22 | console.log(`${event} is not supported by the stripe cli.`); 23 | // console.error(e); 24 | } 25 | } 26 | } 27 | 28 | main(); 29 | -------------------------------------------------------------------------------- /packages/stripe-sync/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "resolveJsonModule": true, /* Enable importing .json files. */ 39 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 40 | 41 | /* JavaScript Support */ 42 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 43 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 44 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 45 | 46 | /* Emit */ 47 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 52 | // "outDir": "./", /* Specify an output folder for all emitted files. */ 53 | // "removeComments": true, /* Disable emitting comments. */ 54 | // "noEmit": true, /* Disable emitting files from a compilation. */ 55 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 56 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 57 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 58 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 59 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 60 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | 71 | /* Interop Constraints */ 72 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 77 | 78 | /* Type Checking */ 79 | "strict": true, /* Enable all strict type-checking options. */ 80 | // TODO: turn this on 81 | "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 82 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 83 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 84 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 85 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 86 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 87 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 88 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 89 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 90 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 91 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 92 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 93 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 94 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 95 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 96 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 97 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 98 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 99 | 100 | /* Completeness */ 101 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 102 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "apps/*" 3 | - "packages/*" 4 | - "examples/*" 5 | --------------------------------------------------------------------------------
{description}