@volter/twin-stripe 2.0.37 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/README.md +82 -207
  2. package/dist/generated/pack-facts.json +94 -0
  3. package/dist/spec/SOURCE.md +14 -0
  4. package/dist/spec/fixtures3.json.gz +0 -0
  5. package/dist/spec/openapi.json.gz +0 -0
  6. package/dist/spec/patches.json +34 -0
  7. package/dist/spec/sources.json +378 -0
  8. package/dist/src/cli.js +12 -30
  9. package/dist/src/engine/after-payment.d.ts +9 -0
  10. package/dist/src/engine/after-payment.js +28 -0
  11. package/dist/src/engine/apps-secrets.d.ts +1 -0
  12. package/dist/src/engine/apps-secrets.js +3 -0
  13. package/dist/src/engine/balance.d.ts +5 -0
  14. package/dist/src/engine/balance.js +15 -0
  15. package/dist/src/engine/billing.d.ts +5 -0
  16. package/dist/src/engine/billing.js +6 -0
  17. package/dist/src/engine/charges.d.ts +6 -0
  18. package/dist/src/engine/charges.js +13 -0
  19. package/dist/src/engine/checkout.d.ts +24 -0
  20. package/dist/src/engine/checkout.js +30 -0
  21. package/dist/src/engine/common.d.ts +19 -0
  22. package/dist/src/engine/common.js +32 -0
  23. package/dist/src/{screens → engine}/connect-settings.d.ts +1 -7
  24. package/dist/src/engine/connect-settings.js +26 -0
  25. package/dist/src/engine/connect.d.ts +66 -0
  26. package/dist/src/engine/connect.js +189 -0
  27. package/dist/src/engine/coupons.d.ts +0 -0
  28. package/dist/src/engine/coupons.js +5 -0
  29. package/dist/src/engine/credit-notes.d.ts +1 -0
  30. package/dist/src/engine/credit-notes.js +5 -0
  31. package/dist/src/engine/customers.d.ts +12 -0
  32. package/dist/src/engine/customers.js +30 -0
  33. package/dist/src/engine/display.d.ts +14 -0
  34. package/dist/src/engine/display.js +16 -0
  35. package/dist/src/engine/disputes.d.ts +0 -0
  36. package/dist/src/engine/disputes.js +9 -0
  37. package/dist/src/engine/entitlements.d.ts +1 -0
  38. package/dist/src/engine/entitlements.js +4 -0
  39. package/dist/src/engine/ephemeral-keys.d.ts +0 -0
  40. package/dist/src/engine/ephemeral-keys.js +4 -0
  41. package/dist/src/engine/files.d.ts +18 -0
  42. package/dist/src/engine/files.js +33 -0
  43. package/dist/src/engine/front.d.ts +5 -0
  44. package/dist/src/engine/front.js +25 -0
  45. package/dist/src/engine/invoices.d.ts +24 -0
  46. package/dist/src/engine/invoices.js +57 -0
  47. package/dist/src/engine/issuing.d.ts +35 -0
  48. package/dist/src/engine/issuing.js +45 -0
  49. package/dist/src/engine/ledger.d.ts +9 -0
  50. package/dist/src/engine/ledger.js +9 -0
  51. package/dist/src/engine/oauth.d.ts +4 -0
  52. package/dist/src/engine/oauth.js +25 -0
  53. package/dist/src/engine/onboarding.d.ts +13 -0
  54. package/dist/src/engine/onboarding.js +42 -0
  55. package/dist/src/{stripe-params.d.ts → engine/params.d.ts} +20 -3
  56. package/dist/src/{stripe-params.js → engine/params.js} +7 -60
  57. package/dist/src/engine/payment-intents.d.ts +10 -0
  58. package/dist/src/engine/payment-intents.js +27 -0
  59. package/dist/src/engine/payment-links.d.ts +1 -0
  60. package/dist/src/engine/payment-links.js +5 -0
  61. package/dist/src/engine/payment-methods.d.ts +16 -0
  62. package/dist/src/engine/payment-methods.js +22 -0
  63. package/dist/src/engine/plans.d.ts +6 -0
  64. package/dist/src/engine/plans.js +26 -0
  65. package/dist/src/engine/platform.d.ts +39 -0
  66. package/dist/src/engine/platform.js +34 -0
  67. package/dist/src/engine/products.d.ts +0 -0
  68. package/dist/src/engine/products.js +4 -0
  69. package/dist/src/engine/radar.d.ts +2 -0
  70. package/dist/src/engine/radar.js +5 -0
  71. package/dist/src/engine/refunds.d.ts +1 -0
  72. package/dist/src/engine/refunds.js +28 -0
  73. package/dist/src/engine/renewals.d.ts +36 -0
  74. package/dist/src/engine/renewals.js +65 -0
  75. package/dist/src/engine/setup-intents.d.ts +1 -0
  76. package/dist/src/engine/setup-intents.js +4 -0
  77. package/dist/src/{stripe-twin.d.ts → engine/stripe.d.ts} +11 -39
  78. package/dist/src/{stripe-twin.js → engine/stripe.js} +25 -310
  79. package/dist/src/engine/subscription-schedules.d.ts +3 -0
  80. package/dist/src/engine/subscription-schedules.js +1 -0
  81. package/dist/src/engine/subscriptions.d.ts +12 -0
  82. package/dist/src/engine/subscriptions.js +31 -0
  83. package/dist/src/engine/tax.d.ts +7 -0
  84. package/dist/src/engine/tax.js +28 -0
  85. package/dist/src/engine/terminal.d.ts +4 -0
  86. package/dist/src/engine/terminal.js +20 -0
  87. package/dist/src/engine/test-clocks.d.ts +5 -0
  88. package/dist/src/engine/test-clocks.js +9 -0
  89. package/dist/src/engine/tokens.d.ts +7 -0
  90. package/dist/src/engine/tokens.js +20 -0
  91. package/dist/src/engine/transfers.d.ts +2 -0
  92. package/dist/src/engine/transfers.js +1 -0
  93. package/dist/src/engine/treasury.d.ts +23 -0
  94. package/dist/src/engine/treasury.js +45 -0
  95. package/dist/src/{stripe-version.js → engine/version.js} +4 -3
  96. package/dist/src/engine/webhook-endpoints.d.ts +1 -0
  97. package/dist/src/engine/webhook-endpoints.js +12 -0
  98. package/dist/src/engine/webhooks.d.ts +31 -0
  99. package/dist/src/engine/webhooks.js +68 -0
  100. package/dist/src/fetch.d.ts +2 -0
  101. package/dist/src/fetch.js +26 -0
  102. package/dist/src/generated/surface.gen.json +1 -1
  103. package/dist/src/generated/ui.gen.json +1 -1
  104. package/dist/src/index.d.ts +5 -14
  105. package/dist/src/index.js +8 -75
  106. package/dist/src/manifest.js +232 -758
  107. package/dist/src/screens/billing-portal.d.ts +3 -0
  108. package/dist/src/screens/{portal.js → billing-portal.js} +28 -54
  109. package/dist/src/screens/checkout.d.ts +2 -31
  110. package/dist/src/screens/checkout.js +32 -121
  111. package/dist/src/screens/connect-oauth.d.ts +3 -27
  112. package/dist/src/screens/connect-oauth.js +51 -132
  113. package/dist/src/screens/connect-onboarding.d.ts +3 -0
  114. package/dist/src/screens/{onboarding.js → connect-onboarding.js} +36 -102
  115. package/dist/src/screens/dashboard.d.ts +3 -0
  116. package/dist/src/screens/dashboard.js +117 -0
  117. package/dist/src/screens/shared.d.ts +27 -0
  118. package/dist/src/screens/shared.js +87 -0
  119. package/dist/src/screens/stripe-js.d.ts +3 -0
  120. package/dist/src/screens/stripe-js.js +135 -0
  121. package/dist/src/semantics/account_links.d.ts +2 -0
  122. package/dist/src/semantics/account_links.js +22 -0
  123. package/dist/src/semantics/accounts.d.ts +4 -0
  124. package/dist/src/semantics/accounts.js +38 -0
  125. package/dist/src/semantics/apps.d.ts +4 -0
  126. package/dist/src/semantics/{apps-secrets.js → apps.js} +14 -26
  127. package/dist/src/semantics/around.d.ts +2 -0
  128. package/dist/src/semantics/around.js +16 -0
  129. package/dist/src/semantics/balance.d.ts +2 -11
  130. package/dist/src/semantics/balance.js +3 -194
  131. package/dist/src/semantics/balance_transactions.d.ts +2 -0
  132. package/dist/src/semantics/balance_transactions.js +15 -0
  133. package/dist/src/semantics/billing_portal.d.ts +5 -0
  134. package/dist/src/semantics/billing_portal.js +42 -0
  135. package/dist/src/semantics/charges.d.ts +3 -28
  136. package/dist/src/semantics/charges.js +5 -202
  137. package/dist/src/semantics/checkout.d.ts +3 -20
  138. package/dist/src/semantics/checkout.js +8 -261
  139. package/dist/src/semantics/clock.d.ts +2 -0
  140. package/dist/src/semantics/clock.js +21 -0
  141. package/dist/src/semantics/coupons.d.ts +2 -6
  142. package/dist/src/semantics/coupons.js +2 -60
  143. package/dist/src/semantics/customers.d.ts +6 -6
  144. package/dist/src/semantics/customers.js +27 -387
  145. package/dist/src/semantics/disputes.d.ts +2 -2
  146. package/dist/src/semantics/disputes.js +3 -49
  147. package/dist/src/semantics/doors.d.ts +23 -0
  148. package/dist/src/semantics/doors.js +73 -0
  149. package/dist/src/semantics/entitlements.d.ts +2 -2
  150. package/dist/src/semantics/entitlements.js +5 -50
  151. package/dist/src/semantics/events.d.ts +12 -0
  152. package/dist/src/semantics/events.js +36 -0
  153. package/dist/src/semantics/index.d.ts +2 -0
  154. package/dist/src/semantics/index.js +107 -0
  155. package/dist/src/semantics/invoice_payments.d.ts +2 -0
  156. package/dist/src/semantics/invoice_payments.js +12 -0
  157. package/dist/src/semantics/invoiceitems.d.ts +3 -0
  158. package/dist/src/semantics/invoiceitems.js +59 -0
  159. package/dist/src/semantics/invoices.d.ts +16 -18
  160. package/dist/src/semantics/invoices.js +118 -444
  161. package/dist/src/semantics/payment_intents.d.ts +4 -0
  162. package/dist/src/semantics/payment_intents.js +79 -0
  163. package/dist/src/semantics/payment_methods.d.ts +5 -0
  164. package/dist/src/semantics/payment_methods.js +39 -0
  165. package/dist/src/semantics/payouts.d.ts +2 -0
  166. package/dist/src/semantics/payouts.js +21 -0
  167. package/dist/src/semantics/prices.d.ts +4 -0
  168. package/dist/src/semantics/prices.js +37 -0
  169. package/dist/src/semantics/products.d.ts +6 -2
  170. package/dist/src/semantics/products.js +15 -130
  171. package/dist/src/semantics/promotion_codes.d.ts +3 -0
  172. package/dist/src/semantics/promotion_codes.js +35 -0
  173. package/dist/src/semantics/radar.d.ts +2 -2
  174. package/dist/src/semantics/radar.js +5 -74
  175. package/dist/src/semantics/refunds.d.ts +3 -9
  176. package/dist/src/semantics/refunds.js +6 -192
  177. package/dist/src/semantics/setup_intents.d.ts +3 -0
  178. package/dist/src/semantics/{setup-intents.js → setup_intents.js} +10 -53
  179. package/dist/src/semantics/shared.d.ts +822 -47
  180. package/dist/src/semantics/shared.js +3044 -78
  181. package/dist/src/semantics/states.d.ts +531 -0
  182. package/dist/src/semantics/states.js +852 -0
  183. package/dist/src/semantics/subscription_items.d.ts +5 -0
  184. package/dist/src/semantics/subscription_items.js +55 -0
  185. package/dist/src/semantics/subscription_schedules.d.ts +4 -0
  186. package/dist/src/semantics/subscription_schedules.js +60 -0
  187. package/dist/src/semantics/subscriptions.d.ts +7 -11
  188. package/dist/src/semantics/subscriptions.js +44 -415
  189. package/dist/src/semantics/test_helpers.d.ts +6 -0
  190. package/dist/src/semantics/{test-clocks.js → test_helpers.js} +14 -40
  191. package/dist/src/semantics/transfers.d.ts +2 -2
  192. package/dist/src/semantics/transfers.js +6 -101
  193. package/dist/src/server.d.ts +7 -0
  194. package/dist/src/server.js +7 -0
  195. package/generated/pack-facts.json +94 -0
  196. package/package.json +10 -20
  197. package/spec/SOURCE.md +14 -0
  198. package/spec/fixtures3.json.gz +0 -0
  199. package/spec/openapi.json.gz +0 -0
  200. package/spec/patches.json +34 -0
  201. package/spec/sources.json +378 -0
  202. package/src/cli.ts +12 -26
  203. package/src/engine/after-payment.ts +31 -0
  204. package/src/engine/apps-secrets.ts +4 -0
  205. package/src/engine/balance.ts +33 -0
  206. package/src/engine/billing.ts +16 -0
  207. package/src/engine/charges.ts +19 -0
  208. package/src/engine/checkout.ts +40 -0
  209. package/src/engine/common.ts +47 -0
  210. package/src/engine/connect-settings.ts +23 -0
  211. package/src/engine/connect.ts +184 -0
  212. package/src/engine/coupons.ts +5 -0
  213. package/src/engine/credit-notes.ts +6 -0
  214. package/src/engine/customers.ts +35 -0
  215. package/src/engine/display.ts +19 -0
  216. package/src/engine/disputes.ts +9 -0
  217. package/src/engine/entitlements.ts +5 -0
  218. package/src/engine/ephemeral-keys.ts +3 -0
  219. package/src/engine/files.ts +41 -0
  220. package/src/engine/front.ts +31 -0
  221. package/src/engine/invoices.ts +71 -0
  222. package/src/engine/issuing.ts +61 -0
  223. package/src/engine/ledger.ts +50 -0
  224. package/src/engine/oauth.ts +19 -0
  225. package/src/engine/onboarding.ts +54 -0
  226. package/src/{stripe-params.ts → engine/params.ts} +8 -56
  227. package/src/engine/payment-intents.ts +33 -0
  228. package/src/engine/payment-links.ts +6 -0
  229. package/src/engine/payment-methods.ts +25 -0
  230. package/src/engine/plans.ts +42 -0
  231. package/src/engine/platform.ts +47 -0
  232. package/src/engine/products.ts +3 -0
  233. package/src/engine/radar.ts +6 -0
  234. package/src/engine/refunds.ts +29 -0
  235. package/src/engine/renewals.ts +73 -0
  236. package/src/engine/setup-intents.ts +5 -0
  237. package/src/{stripe-twin.ts → engine/stripe.ts} +28 -323
  238. package/src/engine/subscription-schedules.ts +10 -0
  239. package/src/engine/subscriptions.ts +40 -0
  240. package/src/engine/tax.ts +39 -0
  241. package/src/engine/terminal.ts +23 -0
  242. package/src/engine/test-clocks.ts +11 -0
  243. package/src/engine/tokens.ts +22 -0
  244. package/src/engine/transfers.ts +23 -0
  245. package/src/engine/treasury.ts +47 -0
  246. package/src/{stripe-version.ts → engine/version.ts} +4 -3
  247. package/src/engine/webhook-endpoints.ts +14 -0
  248. package/src/engine/webhooks.ts +72 -0
  249. package/src/fetch.ts +27 -0
  250. package/src/generated/surface.gen.json +1 -1
  251. package/src/generated/ui.gen.json +1 -1
  252. package/src/index.ts +8 -116
  253. package/src/manifest.ts +234 -786
  254. package/src/screens/{portal.tsx → billing-portal.tsx} +32 -37
  255. package/src/screens/checkout.tsx +33 -95
  256. package/src/screens/connect-oauth.tsx +64 -88
  257. package/src/screens/{onboarding.tsx → connect-onboarding.tsx} +38 -82
  258. package/src/screens/dashboard.tsx +198 -0
  259. package/src/screens/shared.tsx +84 -0
  260. package/src/screens/stripe-js.ts +170 -0
  261. package/src/semantics/account_links.ts +21 -0
  262. package/src/semantics/accounts.ts +43 -0
  263. package/src/semantics/{apps-secrets.ts → apps.ts} +17 -32
  264. package/src/semantics/around.ts +20 -0
  265. package/src/semantics/balance.ts +6 -207
  266. package/src/semantics/balance_transactions.ts +20 -0
  267. package/src/semantics/billing_portal.ts +51 -0
  268. package/src/semantics/charges.ts +12 -211
  269. package/src/semantics/checkout.ts +13 -268
  270. package/src/semantics/clock.ts +26 -0
  271. package/src/semantics/coupons.ts +5 -67
  272. package/src/semantics/customers.ts +29 -392
  273. package/src/semantics/disputes.ts +9 -59
  274. package/src/semantics/doors.ts +80 -0
  275. package/src/semantics/entitlements.ts +9 -56
  276. package/src/semantics/events.ts +44 -0
  277. package/src/semantics/index.ts +111 -0
  278. package/src/semantics/invoice_payments.ts +18 -0
  279. package/src/semantics/invoiceitems.ts +59 -0
  280. package/src/semantics/invoices.ts +109 -443
  281. package/src/semantics/payment_intents.ts +83 -0
  282. package/src/semantics/payment_methods.ts +43 -0
  283. package/src/semantics/payouts.ts +23 -0
  284. package/src/semantics/prices.ts +42 -0
  285. package/src/semantics/products.ts +18 -142
  286. package/src/semantics/promotion_codes.ts +39 -0
  287. package/src/semantics/radar.ts +8 -77
  288. package/src/semantics/refunds.ts +9 -212
  289. package/src/semantics/setup_intents.ts +45 -0
  290. package/src/semantics/shared.ts +3092 -106
  291. package/src/semantics/states.ts +883 -0
  292. package/src/semantics/subscription_items.ts +54 -0
  293. package/src/semantics/subscription_schedules.ts +66 -0
  294. package/src/semantics/subscriptions.ts +49 -432
  295. package/src/semantics/{test-clocks.ts → test_helpers.ts} +23 -47
  296. package/src/semantics/transfers.ts +11 -131
  297. package/src/server.ts +8 -0
  298. package/client/dashboard-api.ts +0 -286
  299. package/client/stripe-mirror.css +0 -277
  300. package/client/stripe-mirror.tsx +0 -1559
  301. package/dist/client/dashboard-api.d.ts +0 -107
  302. package/dist/client/dashboard-api.js +0 -238
  303. package/dist/client/dashboard-api.ts +0 -286
  304. package/dist/client/stripe-mirror.bundle.js +0 -236
  305. package/dist/client/stripe-mirror.css +0 -277
  306. package/dist/client/stripe-mirror.d.ts +0 -134
  307. package/dist/client/stripe-mirror.js +0 -859
  308. package/dist/client/stripe-mirror.tsx +0 -1559
  309. package/dist/src/screens/connect-settings.js +0 -103
  310. package/dist/src/screens/consent-skin.d.ts +0 -4
  311. package/dist/src/screens/consent-skin.js +0 -18
  312. package/dist/src/screens/financial-connections.d.ts +0 -5
  313. package/dist/src/screens/financial-connections.js +0 -90
  314. package/dist/src/screens/identity.d.ts +0 -5
  315. package/dist/src/screens/identity.js +0 -86
  316. package/dist/src/screens/onboarding.d.ts +0 -13
  317. package/dist/src/screens/portal.d.ts +0 -5
  318. package/dist/src/screens/public-details.d.ts +0 -5
  319. package/dist/src/screens/public-details.js +0 -90
  320. package/dist/src/semantics/after-payment.d.ts +0 -22
  321. package/dist/src/semantics/after-payment.js +0 -99
  322. package/dist/src/semantics/apps-secrets.d.ts +0 -2
  323. package/dist/src/semantics/billing.d.ts +0 -2
  324. package/dist/src/semantics/billing.js +0 -220
  325. package/dist/src/semantics/connect.d.ts +0 -5
  326. package/dist/src/semantics/connect.js +0 -493
  327. package/dist/src/semantics/credit-notes.d.ts +0 -2
  328. package/dist/src/semantics/credit-notes.js +0 -172
  329. package/dist/src/semantics/ephemeral-keys.d.ts +0 -2
  330. package/dist/src/semantics/ephemeral-keys.js +0 -34
  331. package/dist/src/semantics/files.d.ts +0 -2
  332. package/dist/src/semantics/files.js +0 -125
  333. package/dist/src/semantics/issuing.d.ts +0 -13
  334. package/dist/src/semantics/issuing.js +0 -575
  335. package/dist/src/semantics/ledger.d.ts +0 -59
  336. package/dist/src/semantics/ledger.js +0 -200
  337. package/dist/src/semantics/payment-intents.d.ts +0 -18
  338. package/dist/src/semantics/payment-intents.js +0 -452
  339. package/dist/src/semantics/payment-links.d.ts +0 -2
  340. package/dist/src/semantics/payment-links.js +0 -133
  341. package/dist/src/semantics/payment-methods.d.ts +0 -20
  342. package/dist/src/semantics/payment-methods.js +0 -140
  343. package/dist/src/semantics/plans.d.ts +0 -5
  344. package/dist/src/semantics/plans.js +0 -121
  345. package/dist/src/semantics/platform.d.ts +0 -9
  346. package/dist/src/semantics/platform.js +0 -206
  347. package/dist/src/semantics/renewals.d.ts +0 -47
  348. package/dist/src/semantics/renewals.js +0 -281
  349. package/dist/src/semantics/setup-intents.d.ts +0 -2
  350. package/dist/src/semantics/subscription-schedules.d.ts +0 -2
  351. package/dist/src/semantics/subscription-schedules.js +0 -119
  352. package/dist/src/semantics/tax.d.ts +0 -2
  353. package/dist/src/semantics/tax.js +0 -197
  354. package/dist/src/semantics/terminal.d.ts +0 -5
  355. package/dist/src/semantics/terminal.js +0 -182
  356. package/dist/src/semantics/test-clocks.d.ts +0 -6
  357. package/dist/src/semantics/tokens.d.ts +0 -4
  358. package/dist/src/semantics/tokens.js +0 -44
  359. package/dist/src/semantics/treasury.d.ts +0 -2
  360. package/dist/src/semantics/treasury.js +0 -377
  361. package/dist/src/semantics/webhook-endpoints.d.ts +0 -3
  362. package/dist/src/semantics/webhook-endpoints.js +0 -85
  363. package/dist/src/stripe-budget.d.ts +0 -55
  364. package/dist/src/stripe-budget.js +0 -155
  365. package/dist/src/stripe-capabilities.d.ts +0 -3
  366. package/dist/src/stripe-capabilities.js +0 -5836
  367. package/dist/src/stripe-conformance.d.ts +0 -43
  368. package/dist/src/stripe-conformance.js +0 -105
  369. package/dist/src/stripe-connector.d.ts +0 -161
  370. package/dist/src/stripe-connector.js +0 -414
  371. package/dist/src/stripe-emit.d.ts +0 -2
  372. package/dist/src/stripe-emit.js +0 -145
  373. package/dist/src/stripe-events.d.ts +0 -93
  374. package/dist/src/stripe-events.js +0 -392
  375. package/dist/src/stripe-js.d.ts +0 -4
  376. package/dist/src/stripe-js.js +0 -70
  377. package/dist/src/stripe-mirror-ui.d.ts +0 -15
  378. package/dist/src/stripe-mirror-ui.js +0 -87
  379. package/dist/src/stripe-perform-harness.d.ts +0 -9
  380. package/dist/src/stripe-perform-harness.js +0 -26
  381. package/dist/src/stripe-server.d.ts +0 -33
  382. package/dist/src/stripe-server.js +0 -429
  383. package/dist/src/stripe-shared.d.ts +0 -109
  384. package/dist/src/stripe-shared.js +0 -276
  385. package/dist/src/stripe-ui-conformance.d.ts +0 -5
  386. package/dist/src/stripe-ui-conformance.js +0 -79
  387. package/dist/src/stripe-ui-structure.d.ts +0 -3
  388. package/dist/src/stripe-ui-structure.js +0 -168
  389. package/dist/test-fixtures/stripe-known-deviations.json +0 -110
  390. package/dist/test-fixtures/stripe-openapi-operations.SOURCE.md +0 -14
  391. package/dist/test-fixtures/stripe-openapi-operations.json +0 -4717
  392. package/dist/test-fixtures/stripe-schemas.SOURCE.md +0 -35
  393. package/dist/test-fixtures/stripe-schemas.json +0 -3813
  394. package/src/screens/connect-settings.tsx +0 -121
  395. package/src/screens/consent-skin.ts +0 -20
  396. package/src/screens/financial-connections.tsx +0 -101
  397. package/src/screens/identity.tsx +0 -96
  398. package/src/screens/public-details.tsx +0 -105
  399. package/src/semantics/after-payment.ts +0 -118
  400. package/src/semantics/billing.ts +0 -216
  401. package/src/semantics/connect.ts +0 -487
  402. package/src/semantics/credit-notes.ts +0 -168
  403. package/src/semantics/ephemeral-keys.ts +0 -34
  404. package/src/semantics/files.ts +0 -143
  405. package/src/semantics/issuing.ts +0 -590
  406. package/src/semantics/ledger.ts +0 -253
  407. package/src/semantics/payment-intents.ts +0 -463
  408. package/src/semantics/payment-links.ts +0 -148
  409. package/src/semantics/payment-methods.ts +0 -145
  410. package/src/semantics/plans.ts +0 -131
  411. package/src/semantics/platform.ts +0 -220
  412. package/src/semantics/renewals.ts +0 -279
  413. package/src/semantics/setup-intents.ts +0 -87
  414. package/src/semantics/subscription-schedules.ts +0 -129
  415. package/src/semantics/tax.ts +0 -220
  416. package/src/semantics/terminal.ts +0 -195
  417. package/src/semantics/tokens.ts +0 -52
  418. package/src/semantics/treasury.ts +0 -383
  419. package/src/semantics/webhook-endpoints.ts +0 -87
  420. package/src/stripe-budget.ts +0 -181
  421. package/src/stripe-capabilities.ts +0 -5651
  422. package/src/stripe-conformance.ts +0 -124
  423. package/src/stripe-connector.ts +0 -462
  424. package/src/stripe-emit.ts +0 -157
  425. package/src/stripe-events.ts +0 -434
  426. package/src/stripe-js.ts +0 -70
  427. package/src/stripe-mirror-ui.ts +0 -90
  428. package/src/stripe-perform-harness.ts +0 -29
  429. package/src/stripe-server.ts +0 -393
  430. package/src/stripe-shared.ts +0 -297
  431. package/src/stripe-ui-conformance.ts +0 -88
  432. package/src/stripe-ui-structure.ts +0 -182
  433. package/test-fixtures/stripe-known-deviations.json +0 -110
  434. package/test-fixtures/stripe-openapi-operations.json +0 -4717
  435. package/test-fixtures/stripe-schemas.json +0 -3813
  436. /package/dist/src/{screens → engine}/industries.d.ts +0 -0
  437. /package/dist/src/{screens → engine}/industries.js +0 -0
  438. /package/dist/src/{semantics → engine}/test-cards.d.ts +0 -0
  439. /package/dist/src/{semantics → engine}/test-cards.js +0 -0
  440. /package/dist/src/{stripe-version.d.ts → engine/version.d.ts} +0 -0
  441. /package/src/{screens → engine}/industries.ts +0 -0
  442. /package/src/{semantics → engine}/test-cards.ts +0 -0
package/README.md CHANGED
@@ -1,213 +1,88 @@
1
1
  # @volter/twin-stripe
2
2
 
3
- The **Stripe twin** — a local, spec-correct replica of the Stripe REST API on the
4
- shared [`@volter/world-core`](../../world-core) kernel. The real `stripe` SDK works against it
5
- unmodified; it's the QA stack's authoritative local Stripe (it replaced the old
6
- hand-made in-process mock).
7
-
8
- ## Surface
9
-
10
- - **REST API** (`stripe-twin.ts` → `handleStripeTwinRequest`; HTTP wrapper
11
- `stripe-server.ts` → `createStripeTwinServer`): charges, customers,
12
- payment_intents, setup_intents, payment_methods, products, prices, invoices,
13
- invoiceitems, subscriptions, refunds, coupons, promotion_codes, identity
14
- verification sessions, ephemeral_keys, checkout sessions, billing/customer-portal
15
- sessions + configurations, and the legacy **Plans** API (`semantics/plans.ts`: a plan is the recurring
16
- price it is; plan writes send `plan.created`/`plan.updated`/`plan.deleted`; a deleted plan's price stays
17
- readable, inactive, for its existing subscribers).
18
- - **Hosted pages** (`src/screens/`): Stripe's own pages an application sends a person to, served at their
19
- vendor urls — Checkout's payment page (`checkout.stripe.com/c/pay/{id}`: the customer pays, the session
20
- completes and `checkout.session.completed` fires), the Customer Portal (`billing.stripe.com/p/session/{id}`),
21
- Connect hosted onboarding (`connect.stripe.com/setup/…`), Identity (`verify.stripe.com/start/{id}`) and the
22
- Financial Connections bank-linking flow Stripe.js opens.
23
- - **Stripe.js** (`stripe-js.ts`): `js.stripe.com` serves the client library at `/v3`, `/v3/`, `/v3/stripe.js` and
24
- `/<release train>/stripe.js` — the paths the `@stripe/stripe-js` loader loads or accepts — with
25
- `redirectToCheckout({ sessionId })` sending the page to the hosted Checkout page; any other member throws,
26
- naming itself (`stripe.js.loader`).
27
- - **Writes** are local transactions (action log); reads are the projection (R3/R5/R18).
28
- - **Card declines** (`stripe-twin.ts`): Stripe's documented test cards get vendor-faithful
29
- outcomes on charge create / PaymentIntent confirm — `4242…4242` (and `pm_card_visa`/`tok_visa`)
30
- succeed; `4000…0002`, `4000…9995`, `4000…0069`, `4000…0127`, `4000…0119` (and the matching
31
- `pm_card_*`/`tok_*` tokens) return the real `card_error` envelope (HTTP 402) and leave a
32
- confirmed PaymentIntent at `requires_payment_method`. Unknown cards succeed. See
33
- `_card.declines-test-set-only` in `stripe-known-deviations.json`.
34
- - **Manual capture** (`semantics/payment-intents.ts`, `semantics/charges.ts`): confirming a `capture_method=manual`
35
- intent authorizes an uncaptured charge (`captured: false`, nothing on the balance); capture takes that charge
36
- (`charge.captured`; a partial capture releases the rest with no Refund, Stripe's basil change), and an incremental
37
- authorization grows its amount. An uncaptured charge is never refunded out of the balance: cancelling a
38
- `requires_capture` intent releases the authorization (no Refund; `amount_captured` 0, `refunded` false) and its
39
- charge's capture is then refused with `payment_intent_unexpected_state`, a refund of a PaymentIntent's uncaptured
40
- charge is refused (cancel the intent, as Stripe's refunds guide says), and a `capture=false` charge's refund releases
41
- it, after which its capture is refused with `charge_already_refunded`. An uncaptured charge is refused as a transfer's
42
- `source_transaction` (the twin's rule; the docs are silent).
43
- - **Idempotency keys**: the `Idempotency-Key` header is honored on POST — a replay with the
44
- same key returns the stored response without re-applying the write (`_idempotency.stored-per-root`).
45
- - **Events** (`stripe-events.ts`): fires Stripe `event` objects on write
46
- (`payment_intent.succeeded`, `customer.subscription.created`, `invoice.paid`, …). A charge fires the event
47
- Stripe sends for it — `charge.succeeded` (made, or authorized under manual capture), `charge.failed` (a declined
48
- attempt), `charge.captured` (an authorization captured) — never an invented `charge.created`.
49
- - **Connect webhooks**: an event of a connected account (a write made with its `Stripe-Account` header, its own
50
- `account.updated`, or a row kept on its books such as the automatic payout time makes for it) carries the
51
- top-level `account` and reaches only endpoints created with `connect=true`; the platform's reach only the others
52
- (`stripe.connect.webhook_scope`, `stripe.connect.event_scope`). `GET /v1/events` and `/v1/events/{id}` answer the
53
- acting account's events: with the header that account's, without it the platform's. An event's id is minted once
54
- per World (`evt_twin_<n>`) and is the delivered webhook's id and the stored event's alike (`stripe.events.ids`).
55
- `world-stripe emit` re-fires a connected account's object with its `account`; it does not yet route it to Connect
56
- endpoints only (the kernel's emit seam has no endpoint scope).
57
- - **Connect OAuth (Standard accounts)** (`src/screens/connect-oauth.tsx`, `src/screens/connect-settings.tsx`;
58
- docs.stripe.com/connect/oauth-reference). The platform's **client_id is `ca_twin_self`** in every World (a test
59
- client_id; the platform account is `acct_twin_self`), shown on the Dashboard's Connect OAuth settings page,
60
- `dashboard.stripe.com/settings/connect/onboarding-options/oauth` (also `/settings/connect` and the `/test/…` link),
61
- in `<code data-testid="connect-client-id">`. OAuth starts **off**: a runner POSTs that page as a browser does,
62
- `oauth_enabled=on&redirect_uris=<one per line>` (303 to `?saved=1`), and the saved URIs are listed in
63
- `data-testid="connect-redirect-uri"` items. `GET connect.stripe.com/oauth/authorize` checks client_id (unknown:
64
- `invalid_client`), OAuth on, `redirect_uri` (must exactly match a registered one; absent: the first; http and
65
- localhost allowed, as Stripe's test client_id allows), `response_type=code` and `scope` (`read_write` | `read_only`,
66
- default `read_only`), each refusal a 400 JSON `{error, error_description, state}` as the reference says (no
67
- redirect). The page offers the test-mode **Skip this form**, which creates a new Standard account (controller type
68
- `account`, prefilled from valid `stripe_user[...]` values, charges and payouts enabled) and redirects with
69
- `scope`, `code` and `state`, and **Deny access**, which redirects with
70
- `error=access_denied&error_description=The%20user%20denied%20your%20request&state=…`. `POST
71
- connect.stripe.com/oauth/token` (the secret key as Bearer, Basic or `client_secret`) exchanges a code once, within 5
72
- minutes, into `{access_token, livemode, refresh_token, scope, stripe_publishable_key, stripe_user_id, token_type}`;
73
- a reused code is `invalid_grant` and revokes the connection; `refresh_token` grants an equal or lesser scope.
74
- `POST connect.stripe.com/oauth/deauthorize` answers `{stripe_user_id}`, after which the Stripe-Account header (and
75
- `/v1/accounts/{id}`) for that account is refused 403 `account_invalid`. `account.application.authorized` /
76
- `.deauthorized` reach Connect endpoints with the account; once revoked, `GET /v1/accounts` no longer lists it and its own events (payouts, balance) stop reaching the platform. The token answer's
77
- deprecated `access_token` and `stripe_publishable_key` act as the connected account (as the Stripe-Account header
78
- does, as Bearer or Basic; `GET /v1/account` then answers it), a token replaced by a refresh or revoked is a 401 invalid API key, and it is never the platform's key at `/oauth/token` or `/oauth/deauthorize`. The
79
- application's own setting of its client_id (Cal.com's `client_id` app key, `STRIPE_CLIENT_ID`) is the runner's to
80
- set to `ca_twin_self`; the World does not provision it. Where the docs stop, the twin decides (the file header lists
81
- each): connecting an existing Stripe account, the full account application form, and holding a `read_only`
82
- connection to reads are not modelled (todos in `stripe-capabilities.ts`).
83
- - **Signing secrets in a World**: Stripe mints an endpoint's `secret`; in a World the app's env is the World's, so an
84
- endpoint is given the World's value, which the app already verifies with: `STRIPE_WEBHOOK_SECRET` (or
85
- `STRIPE_WEBHOOK_SIGNING_SECRET`, `STRIPE_ENDPOINT_SECRET`, `STRIPE_WEBHOOK_SECRET_KEY`,
86
- `NEXT_PRIVATE_STRIPE_WEBHOOK_SECRET`), and for a `connect=true` endpoint `STRIPE_CONNECT_WEBHOOK_SECRET` (or
87
- `STRIPE_WEBHOOK_SECRET_CONNECT`, `STRIPE_CONNECT_WEBHOOK_SIGNING_SECRET`) first. With none set the twin mints
88
- `whsec_twin_<id>`. Where Stripe stops and the twin decides: Stripe lets no one choose a secret.
89
- - **Conformance** (`stripe-conformance.ts`): field name + type checked vs Stripe's
90
- real OpenAPI (standing gate).
91
- - **UI mirror** (`stripe-mirror-ui.ts`): a Stripe-dashboard-style React app over the
92
- twin's own REST API.
93
-
94
- ## CLI
3
+ A local Stripe: the REST API the unmodified `stripe` SDK calls (`https://api.stripe.com/v1`), the hosted pages an
4
+ application sends a person through, and Stripe.js, over one state.
5
+
6
+ A Protocol 3 pack ([architecture](../../../docs/contributing/architecture.md), "Protocol 3"). Its surface is generated
7
+ from Stripe's published OpenAPI document (`spec/`). The derived core serves plain reads, writes and deletes. Handlers
8
+ are in `src/semantics/<family>.ts`, the state machines in `src/semantics/states.ts`, and Stripe's own computation
9
+ (money and declines, billing, the ledger, the API versions) in `src/engine/`.
95
10
 
96
11
  ```bash
97
- world-stripe serve [--read-only] [--port N] [--root DIR]
98
- world-stripe mirror [--port N] [--root DIR]
99
- world-stripe conformance [--fields FILE] [--root DIR]
12
+ world-stripe serve [--port N] [--root DIR] [--read-only]
100
13
  ```
101
14
 
102
- `serve` defaults to `simulator` (the stack uses the twin as a writable Stripe).
103
- Point the real `stripe` SDK at it with `{ host, port, protocol: 'http' }`.
104
-
105
- ## Interaction surfaces
106
-
107
- 1. **SDK/API** — *zero edits (preferred):* `STRIPE_TWIN_URL=http://127.0.0.1:PORT node --require @volter/world-core/inject your-app` redirects the real `stripe` SDK from `api.stripe.com` to the twin (`cookbook/zero-edit-inject`). For browser routing, follow [run a full stack](../../../docs/guides/run-a-full-stack.md). *Or* override directly: `new Stripe(key, { host: '127.0.0.1', port: PORT, protocol: 'http' })`.
108
- 2. **API + CLI** — run the twin in a World and inspect it with `volter world log` and `diff`. Use the [deployment guide](../../../docs/guides/deploy-from-a-shared-world.md) for changeset review and deployment.
109
- 3. **Read-only** — `world-stripe serve --read-only`: unlimited local reads, no rate limits; writes refuse like Stripe (4xx).
110
- 4. **UI mirror** — `world-stripe mirror` renders a Stripe-dashboard-style view of the twin's state.
111
- 5. **Time's events** — `POST /_twin/drain` sends what World time produced since the last drain: `balance.available`
112
- to each account whose settled funds added to its balance (never for negative transactions alone), `payout.paid` for
113
- each payout that arrived, a connected account's with its `account` to its Connect endpoints
114
- (`stripe.events.time_drain`). A read sees time's moves without it; a runner's drainer calls it so the events
115
- arrive, as the qstash and vercel twins' drain doors do.
116
- Test mode keeps live timing except where Stripe documents otherwise: a card charge's funds are pending two days,
117
- except the cards that bypass the pending balance (4000000000000077, 4000003720000278, `pm_card_bypassPending*`,
118
- `tok_bypassPending*`, and a PaymentMethod saved from one) and US bank account debits ("Test transactions settle
119
- instantly"), whose funds, and a `source_transaction` transfer's from them, are available at once; every credit
120
- available at once is sent as `balance.available` at the next drain; a test payout is paid at its `arrival_date`
121
- (`stripe.balance.test_mode_bypass_pending`; sources in `src/semantics/ledger.ts`).
122
-
123
- (See Getting Started → "Twin interaction surfaces".)
124
-
125
- Stable on the twin rubric: fidelity, read/write/fork, sync, observability, event emission, and conformance are tracked with explicit coverage gaps.
126
-
127
- ## Coverage
128
-
129
- Goal: **honest, explicitly tracked coverage of Stripe's core feature surface.** Every capability
130
- is either done or a tracked todo; anything not done is a gap to close.
131
-
132
- **Done** — core resources: **customers**, **charges**, **payment_intents** (+ confirm),
133
- **setup_intents** (+ confirm), **payment_methods** (+ detach), **subscriptions** (create/
134
- update/cancel), **prices**, **products**, **invoices** (+ finalize/pay/void), **invoiceitems**,
135
- **refunds**, **disputes** (+ update/close), **payouts** (+ cancel), **balance_transactions**,
136
- **balance** (synthesized from the ledger), **events** (Events API list/retrieve),
137
- **Checkout Sessions** (create/retrieve/list/`line_items`/expire + modeled completion that
138
- creates+links a payment_intent/subscription/setup_intent; `amount_total` computed from
139
- line_items), **Customer Portal** (`billing_portal` sessions + configurations create/retrieve/
140
- list/update), **Connect** (connected **accounts** create/retrieve/list/update/delete +
141
- `login_links`, and **transfers** platform→connected-account create/retrieve/list filtered by
142
- destination; a new account starts un-onboarded with charges/payouts disabled + a `requirements`
143
- hash; a transfer's `source_transaction` waives the balance check only while its charge is unsettled,
144
- takes the charge's `transfer_group` or writes `group_<payment intent>` onto both, and counts reversals
145
- back as room; connected-account balances, payouts (manual and automatic) and payout reversal, top-ups,
146
- account sessions, persons, external accounts, application fees, hosted onboarding and Connect OAuth for Standard accounts), plus **ephemeral_keys**, **identity verification_sessions**, **file_links**
147
- (synthesized) and **coupons**/**promotion_codes** (retrieve/list, seed-only). Cursor pagination
148
- (`limit`/`starting_after`/`ending_before` + `has_more`); per-resource list filters; `expand[]`
149
- on the modeled paths; vendor-faithful **test-card declines** (`4242…` succeeds; documented
150
- decline PANs + `pm_card_*`/`tok_*` tokens return the real `card_error` 402); **idempotency keys**
151
- (`Idempotency-Key` replay, no re-write); **events/webhooks** (`stripe-events.ts`); spec
152
- **conformance** gate; **UI mirror** (rung-5 ✅, `client/stripe-mirror.tsx` + structure check);
153
- **connector** pull (customers + subscriptions) + push (create/update/cancel/confirm/detach/
154
- finalize/pay/void/close to the real REST surface).
155
-
156
- This cycle added: **ACH/SEPA micro-deposit verification** (`payment_intents`/`setup_intents`
157
- `/verify_microdeposits` — confirm with `pm_us_bank_account` → `requires_action` with a
158
- `verify_with_microdeposits` next_action, then the 32/45 amounts or `SM11AA` descriptor →
159
- `succeeded`), **Customer.list_payment_methods** (`/v1/customers/:id/payment_methods`),
160
- **subscription items** CRUD (create/retrieve/list/update/delete, kept in sync with the parent
161
- sub's `items` list), **subscriptions/invoices search**, **invoice line items**
162
- (`/lines` + `add_lines`/`update_lines`/`remove_lines` with recomputed totals), **invoice
163
- edge-action gating** (finalize/pay/mark_uncollectible/void state machine), **Tax transactions**
164
- (`create_from_calculation` + `create_reversal` with negated lines), **quote** cancel-from-draft/
165
- open lifecycle gates, **customer + subscription discount delete**, **promotion-code update**
166
- (active toggle), **charge fraud-marking** (`fraud_details[user_report]`), and the **Radar**
167
- family — **Reviews** (`/approve`), **Value Lists** (+ items), **Rules** — plus a **Radar
168
- dashboard screen** in the UI mirror.
169
-
170
- **Issuing** (modeled) — cardholders/cards/authorizations/transactions/disputes + test helpers
171
- (present authorization, capture, force capture, fund_balance), including the **real-time
172
- authorization leg**: an endpoint enrolled for `issuing_authorization.request` receives the
173
- signed request event **synchronously** at present time and its JSON response
174
- (`{approved, amount?}`) decides the authorization within Stripe's 2-second window (timeout →
175
- declined `webhook_timeout`, invalid response → `webhook_error`); **spending_controls**
176
- (category/country allow+block lists, per_authorization/all_time/calendar-window spending
177
- limits) are enforced ahead of the webhook with the vendor's `spending_controls` decline
178
- reason; and **captures debit the issuing balance** (`balance_transaction` type
179
- `issuing_transaction`, `balance_type: 'issuing'`, served in `GET /v1/balance`'s `issuing`
180
- section). Remaining issuing gaps (authorization holds, expire/increment/reverse test
181
- helpers) are tracked todos in `stripe-capabilities.ts`. **Terminal**
182
- (locations/readers/connection tokens + process_payment_intent) is likewise modeled — the old
183
- "Planned" listing for both families was stale.
184
-
185
- Also modelled: **Treasury** financial accounts and money movement, **Climate** orders,
186
- **Financial Connections** sessions/accounts/transactions, **Entitlements**, **Billing** meters,
187
- credit grants and usage alerts, **Reporting** report runs, and the legacy **Sources** API.
188
-
189
- **Planned** (known-missing, will do) — **Sigma scheduled query runs** (`GET /v1/sigma/scheduled_query_runs`
190
- list + retrieve, with the run object's status/result-file lifecycle), Treasury financial addresses and
191
- reversals, Financial Connections refresh, the Issuing gaps above, connector pulls of payment methods and
192
- setup intents, and additional list endpoints/filters as needed. (See `stripe-capabilities.ts` for the full
193
- honest todo list — every entry is a tracked gap.)
194
-
195
- ## Rate budget — the fail-closed backstop on live calls
196
-
197
- `liveStripeExecute` is the **one place** this pack issues a live request, so every call it makes is charged
198
- against a persistent, fail-closed spend ledger **before** the request goes out. Past the ceiling, or
199
- while a `Retry-After`/429 cooldown is armed, it **throws instead of calling**. The ledger is keyed by
200
- vendor and a hash of the credential (limits are per credential, so it is deliberately *not*
201
- cwd-scoped) and persists across processes, so a fresh process does not get a fresh allowance; a
202
- corrupt ledger counts as a **full** window rather than zero spend. There is no option to disable it,
203
- and no value you can pass for `budget` that yields an unguarded client — an injected budget is
204
- validated by *method identity*, so a subclass or a `Proxy` that replaces `checkBudget` is refused.
205
-
206
- The declared numbers: **120 weighted units / 60s** = 2 requests/second — 2% of Stripe's documented 100/s live mode and 8% of the 25/s a sandbox key or any single endpoint gets. `POST`/`DELETE` cost 2 (not a published ratio — a judgement call about blast radius: a write creates a charge, refund or receipt e-mail and cannot be taken back) and `POST /v1/payouts` costs 5 (documented at 15 creates/second). Stripe's own window is a **second** while this one is a minute, so an intra-second burst reaches Stripe's limiter first; the 429 cooldown is the backstop for that shape.
207
-
208
- The mechanism is **shared and vendor-agnostic** — it lives in the kernel (`@volter/world-core` →
209
- `packages/world-core/src/rateBudget.ts`); what lives here in [`src/stripe-budget.ts`](src/stripe-budget.ts) is this vendor's
210
- **declaration** (window, ceiling, per-endpoint weights, and a `reason` citing the limits above) plus
211
- the vendor-bound `StripeBudget`. The rule is ratified as
212
- [../../../docs/contributing/architecture.md](../../../docs/contributing/architecture.md) **D8**, and the kernel module's header documents what the
213
- guard does *not* guarantee — read that before trusting it.
15
+ ## What it models
16
+
17
+ The calls the applications make (`journeys/demand.json`: Dub, Twenty, Inbox Zero, Rallly, cal.com and Ponder, and the
18
+ frontends' Stripe.js):
19
+
20
+ - **Customers**: created, updated, searched, deleted; their balance, payment methods and entitlements.
21
+ - **Catalog**: products (with search) and prices, coupons and promotion codes.
22
+ - **Checkout Sessions** and the customer portal (sessions and configurations).
23
+ - **Subscriptions**: their items and schedules, previews, updates, searches and cancellations.
24
+ - **Invoices**: invoice items, finalize, send, pay, void, delete and lines.
25
+ - **Intents**: payment and setup intents (confirmed by Stripe.js with the publishable key and the client secret),
26
+ payment methods (attach, detach), refunds, charges, disputes.
27
+ - **Test clocks**, billing meters, the Apps secret store.
28
+ - **Connect**: Express accounts, account links and login links, external accounts, transfers, payouts, the balance and
29
+ its transactions.
30
+
31
+ **Keys.** The platform's secret and publishable keys, and its webhook secret, are issued by the credential door and
32
+ held by their SHA-256. A request with no key, or with one Stripe never issued, is refused 401. A connected account's
33
+ OAuth key acts as that account.
34
+
35
+ **The gap.** Every other operation answers Stripe's unknown-URL 404: Issuing, Terminal, Treasury, Tax, Quotes, credit
36
+ notes, reporting, identity, sources, plans, payment links, and the webhook endpoints and keys APIs.
37
+
38
+ ## Events
39
+
40
+ Every write Stripe reports sends its event (`payment_intent.succeeded`, `customer.subscription.created`,
41
+ `invoice.paid`, …; a charge sends `charge.succeeded`, `charge.failed` or `charge.captured`, never an invented
42
+ `charge.created`), declared as data the kernel renders, stores, signs (`Stripe-Signature: t=…,v1=…`, which the
43
+ SDK's `constructEvent` verifies) and delivers to the account's enabled webhook endpoints whose `enabled_events` take it
44
+ (`*`, `<family>.*` or the type). Each event is rendered in the writing request's API version.
45
+
46
+ - **Connect**: an event of a connected account (a write made with its `Stripe-Account` header, its own
47
+ `account.updated`, or a row kept on its books, such as the payout time makes for it) carries the top-level `account`
48
+ and reaches only endpoints created with `connect=true`; the platform's reach only the others.
49
+ - **Signing secrets in a World**: the credential door issues the application its keys and two signing secrets, its
50
+ account's (`STRIPE_WEBHOOK_SECRET` and the other names an application reads it by) and its Connect endpoint's
51
+ (`STRIPE_CONNECT_WEBHOOK_SECRET`), the same on every boot; an endpoint made on the Webhooks page (a door) is signed
52
+ with the one of its kind. The twin reads no env.
53
+
54
+ ## Screens
55
+
56
+ Stripe's own pages, at their vendor urls (`src/screens/`):
57
+
58
+ - **Checkout** (`checkout.stripe.com/c/pay/{session}`): the customer pays; the session completes and
59
+ `checkout.session.completed` fires.
60
+ - **Customer portal** (`billing.stripe.com/p/session/{session}`): cancel or renew a plan, update the card, pay an
61
+ open invoice.
62
+ - **Connect onboarding** (`connect.stripe.com/setup/…`): an Account Link's hosted onboarding.
63
+ - **Connect OAuth** (`connect.stripe.com/oauth/authorize`, `/oauth/token`, `/oauth/deauthorize`; Standard accounts,
64
+ docs.stripe.com/connect/oauth-reference). The platform's client_id is `ca_twin_self` in every World (a test
65
+ client_id; the platform account is `acct_twin_self`), shown on the Dashboard's Connect OAuth settings page in
66
+ `<code data-testid="connect-client-id">`. OAuth starts off: a runner POSTs that page as a browser does,
67
+ `oauth_enabled=on&redirect_uris=<one per line>`. The authorize page offers the test-mode **Skip this form** (a new
68
+ Standard account, connected) and **Deny access**; the token endpoint exchanges a code once, within 5 minutes (a
69
+ reused code revokes the connection), and refreshes to an equal or lesser scope; after a deauthorization the
70
+ account's `Stripe-Account` header is refused 403 `account_invalid`. The deprecated `access_token` and
71
+ `stripe_publishable_key` act as the connected account. Not modelled: connecting an existing Stripe account, the full
72
+ account application, holding a `read_only` connection to reads.
73
+ - **Stripe.js** (`js.stripe.com/v3/`, `/v3/stripe.js`, `/<release train>/stripe.js`): `redirectToCheckout({ sessionId })`
74
+ goes to the hosted Checkout page; any other member
75
+ throws, naming itself.
76
+ - **Dashboard** (`dashboard.stripe.com/settings/public`, `/settings/connect/onboarding-options/oauth`): Public details
77
+ (the business name Checkout and the portal show) and the Connect OAuth settings.
78
+
79
+ ## Doors
80
+
81
+ The World's hands where Stripe's API has no act (`src/semantics/doors.ts`), refused on a read-only twin:
82
+
83
+ - `POST /_twin/app-credentials`: the platform's keys and webhook secret, as the runtime issues them to a World's
84
+ applications.
85
+ - `POST /_twin/webhook-endpoints {url, events, connect?}`: an endpoint added on the Dashboard's Webhooks page.
86
+ - `POST /_twin/account {settings?, business_profile?, …}`: the platform's own account settings, as the Dashboard
87
+ changes them.
88
+ - `POST /_twin/drain`: time's events, sent when a runner drives them (`payout.paid`, `balance.available`).
@@ -0,0 +1,94 @@
1
+ {
2
+ "//": "GENERATED by scripts/pack-facts.ts — current pack descriptors and explicit world-runtime server backings; no prior-artifact entries are retained.",
3
+ "packs": {
4
+ "stripe": {
5
+ "adoption": {
6
+ "pypi": [
7
+ "stripe"
8
+ ],
9
+ "sdks": [
10
+ "stripe"
11
+ ],
12
+ "envStems": [
13
+ "STRIPE",
14
+ "NEXTPRIVATESTRIPE"
15
+ ]
16
+ },
17
+ "hosts": [
18
+ {
19
+ "host": "api.stripe.com"
20
+ },
21
+ {
22
+ "host": "checkout.stripe.com",
23
+ "pathPattern": "^/c/pay/"
24
+ },
25
+ {
26
+ "host": "billing.stripe.com",
27
+ "pathPattern": "^/p/session/"
28
+ },
29
+ {
30
+ "host": "connect.stripe.com",
31
+ "pathPattern": "^/setup/|^/oauth/(authorize|token|deauthorize)/?$"
32
+ },
33
+ {
34
+ "host": "dashboard.stripe.com",
35
+ "pathPattern": "^/settings/public/?$|^/(test/)?settings/connect(/onboarding-options/oauth)?/?$"
36
+ },
37
+ {
38
+ "host": "verify.stripe.com",
39
+ "pathPattern": "^/start/"
40
+ },
41
+ {
42
+ "host": "js.stripe.com",
43
+ "pathPattern": "^/v3/financial-connections/|^/v3/?$|^/(v3|[a-z]+)/stripe\\.js$"
44
+ }
45
+ ],
46
+ "archetype": "crud",
47
+ "protocol": {
48
+ "declared": "3",
49
+ "major": 3,
50
+ "standing": "current"
51
+ },
52
+ "transport": "rest",
53
+ "resources": [
54
+ "charge",
55
+ "customer",
56
+ "payment_intent",
57
+ "setup_intent",
58
+ "payment_method",
59
+ "subscription",
60
+ "price",
61
+ "product",
62
+ "invoice",
63
+ "invoiceitem",
64
+ "refund",
65
+ "event"
66
+ ],
67
+ "credentialDoor": {
68
+ "path": "/_twin/app-credentials",
69
+ "body": {},
70
+ "fill": {
71
+ "STRIPE_SECRET_KEY": "secret_key",
72
+ "STRIPE_API_KEY": "secret_key",
73
+ "STRIPE_PRIVATE_KEY": "secret_key",
74
+ "BILLING_STRIPE_API_KEY": "secret_key",
75
+ "STRIPE_PUBLISHABLE_KEY": "publishable_key",
76
+ "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY": "publishable_key",
77
+ "NEXT_PUBLIC_STRIPE_PUBLIC_KEY": "publishable_key",
78
+ "NEXT_PUBLIC_STRIPE_KEY": "publishable_key",
79
+ "STRIPE_WEBHOOK_SECRET": "webhook_secret",
80
+ "STRIPE_WEBHOOK_SIGNING_SECRET": "webhook_secret",
81
+ "STRIPE_ENDPOINT_SECRET": "webhook_secret",
82
+ "STRIPE_WEBHOOK_SECRET_KEY": "webhook_secret",
83
+ "NEXT_PRIVATE_STRIPE_WEBHOOK_SECRET": "webhook_secret",
84
+ "BILLING_STRIPE_WEBHOOK_SECRET": "webhook_secret",
85
+ "STRIPE_CONNECT_WEBHOOK_SECRET": "connect_webhook_secret",
86
+ "STRIPE_WEBHOOK_SECRET_CONNECT": "connect_webhook_secret",
87
+ "STRIPE_CONNECT_WEBHOOK_SIGNING_SECRET": "connect_webhook_secret"
88
+ }
89
+ },
90
+ "serveExport": "createStripeTwinServer"
91
+ }
92
+ },
93
+ "undeclared": []
94
+ }
@@ -0,0 +1,14 @@
1
+ # stripe spec — provenance
2
+
3
+ - **File:** `openapi.json.gz`, gzip of Stripe's published OpenAPI document.
4
+ - **Upstream:** https://github.com/stripe/openapi, `openapi/spec3.json` on `master`.
5
+ - **Spec version:** `2026-09-30.endive` (`info.version`).
6
+ - **SHA-256 of the uncompressed document:** `6b4680299e7b7743811c41537e828b0eae363a11cea44441511013b55e52f7ad`.
7
+ - **Read by:** `bun scripts/derive-pack.ts stripe`, which writes `../src/generated/surface.gen.json`.
8
+
9
+ The pack serves this document's version (`SERVED_VERSION` in `src/stripe-version.ts`).
10
+
11
+ - **Published examples:** `fixtures3.json.gz`, gzip of Stripe's `openapi/fixtures3.json` (one sample object per resource,
12
+ the objects Stripe's API reference shows), from commit `0d98342fc985dc7710a44be25e8528dd8e099bc2` (2026-09-23).
13
+ SHA-256 of the uncompressed file: `e6822f7ee6fd71bdde6228537368aafcfb7191109340fe119d9aca27c6e9396d`.
14
+ **Read by:** `bun scripts/vendor-examples.ts stripe`.
Binary file
Binary file
@@ -0,0 +1,34 @@
1
+ {
2
+ "patches": [
3
+ {
4
+ "op": "add",
5
+ "path": "/components/schemas/invoiceitem/properties/net_amount/nullable",
6
+ "value": true,
7
+ "why": "The spec types an invoice item's net_amount as a bare integer, yet its own description says the field answers null for every discountable item, so the field is nullable.",
8
+ "source": {
9
+ "spec": "/components/schemas/invoiceitem/properties/net_amount/description",
10
+ "quote": "This field is `null` for `discountable=true` items."
11
+ }
12
+ },
13
+ {
14
+ "op": "add",
15
+ "path": "/components/schemas/file/properties/purpose/enum/-",
16
+ "value": "issuing_logo",
17
+ "why": "The spec's personalization-design card_logo says \"Must have a `purpose` value of `issuing_logo`\", yet neither the File object's purpose nor the file upload's purpose lists it; Stripe's own guide uploads the logo with that purpose (https://docs.stripe.com/issuing/cards/physical/create-design.md?testing-method=with-code), so issuing_logo is a purpose a file has.",
18
+ "source": {
19
+ "url": "https://docs.stripe.com/issuing/cards/physical/create-design.md?testing-method=with-code",
20
+ "quote": "Use the [Files API](https://docs.stripe.com/api/files/create.md) to upload a .PNG file of your card logo, and specify the purpose as `issuing_logo`."
21
+ }
22
+ },
23
+ {
24
+ "op": "add",
25
+ "path": "/paths/~1v1~1files/post/requestBody/content/multipart~1form-data/schema/properties/purpose/enum/-",
26
+ "value": "issuing_logo",
27
+ "why": "The spec's personalization-design card_logo says \"Must have a `purpose` value of `issuing_logo`\", yet neither the File object's purpose nor the file upload's purpose lists it; Stripe's own guide uploads the logo with that purpose (https://docs.stripe.com/issuing/cards/physical/create-design.md?testing-method=with-code), so issuing_logo is a purpose a file has.",
28
+ "source": {
29
+ "url": "https://docs.stripe.com/issuing/cards/physical/create-design.md?testing-method=with-code",
30
+ "quote": "Use the [Files API](https://docs.stripe.com/api/files/create.md) to upload a .PNG file of your card logo, and specify the purpose as `issuing_logo`."
31
+ }
32
+ }
33
+ ]
34
+ }