@volter/twin-stripe 2.0.38 → 3.0.1
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.
- package/README.md +112 -207
- package/dist/generated/pack-facts.json +94 -0
- package/dist/journeys/coverage.json +596 -0
- package/dist/journeys/customer-life.json +6108 -0
- package/dist/journeys/customer-life.outline.md +371 -0
- package/dist/journeys/decisions.json +677 -0
- package/dist/journeys/demand.json +706 -0
- package/dist/journeys/score.json +853 -0
- package/dist/journeys/unreachable.json +102 -0
- package/dist/journeys/vendor-examples.json +8010 -0
- package/dist/spec/SOURCE.md +18 -0
- package/dist/spec/doc-examples.json +445 -0
- package/dist/spec/fixtures3.json.gz +0 -0
- package/dist/spec/openapi.json.gz +0 -0
- package/dist/spec/patches.json +34 -0
- package/dist/spec/sources.json +306 -0
- package/dist/src/cli.d.ts +0 -1
- package/dist/src/cli.js +11 -31
- package/dist/src/engine/after-payment.d.ts +8 -0
- package/dist/src/engine/after-payment.js +27 -0
- package/dist/src/engine/apps-secrets.d.ts +1 -0
- package/dist/src/engine/apps-secrets.js +3 -0
- package/dist/src/engine/balance.d.ts +5 -0
- package/dist/src/engine/balance.js +15 -0
- package/dist/src/engine/checkout.d.ts +24 -0
- package/dist/src/engine/checkout.js +30 -0
- package/dist/src/engine/common.d.ts +19 -0
- package/dist/src/engine/common.js +34 -0
- package/dist/src/engine/connect.d.ts +45 -0
- package/dist/src/engine/connect.js +108 -0
- package/dist/src/engine/customers.d.ts +4 -0
- package/dist/src/engine/customers.js +8 -0
- package/dist/src/engine/display.d.ts +11 -0
- package/dist/src/engine/display.js +13 -0
- package/dist/src/engine/files.d.ts +11 -0
- package/dist/src/engine/files.js +23 -0
- package/dist/src/engine/invoices.d.ts +21 -0
- package/dist/src/engine/invoices.js +84 -0
- package/dist/src/engine/issuing.d.ts +33 -0
- package/dist/src/engine/issuing.js +54 -0
- package/dist/src/engine/ledger.d.ts +8 -0
- package/dist/src/engine/ledger.js +8 -0
- package/dist/src/engine/oauth.d.ts +4 -0
- package/dist/src/engine/oauth.js +24 -0
- package/dist/src/engine/onboarding.d.ts +13 -0
- package/dist/src/engine/onboarding.js +42 -0
- package/dist/src/{stripe-params.d.ts → engine/params.d.ts} +20 -3
- package/dist/src/{stripe-params.js → engine/params.js} +7 -60
- package/dist/src/engine/payment-intents.d.ts +10 -0
- package/dist/src/engine/payment-intents.js +27 -0
- package/dist/src/engine/payment-methods.d.ts +16 -0
- package/dist/src/engine/payment-methods.js +22 -0
- package/dist/src/engine/radar.d.ts +2 -0
- package/dist/src/engine/radar.js +5 -0
- package/dist/src/engine/refunds.d.ts +1 -0
- package/dist/src/engine/refunds.js +3 -0
- package/dist/src/engine/renewals.d.ts +36 -0
- package/dist/src/engine/renewals.js +65 -0
- package/dist/src/{stripe-twin.d.ts → engine/stripe.d.ts} +12 -45
- package/dist/src/{stripe-twin.js → engine/stripe.js} +53 -387
- package/dist/src/engine/subscriptions.d.ts +11 -0
- package/dist/src/engine/subscriptions.js +30 -0
- package/dist/src/engine/transfers.d.ts +2 -0
- package/dist/src/engine/transfers.js +1 -0
- package/dist/src/{stripe-version.d.ts → engine/version.d.ts} +0 -2
- package/dist/src/{stripe-version.js → engine/version.js} +21 -9
- package/dist/src/engine/webhook-endpoints.d.ts +1 -0
- package/dist/src/engine/webhook-endpoints.js +12 -0
- package/dist/src/engine/webhooks.d.ts +31 -0
- package/dist/src/engine/webhooks.js +68 -0
- package/dist/src/fetch.d.ts +2 -0
- package/dist/src/fetch.js +26 -0
- package/dist/src/generated/surface.gen.json +1 -1
- package/dist/src/generated/ui.gen.json +1 -1
- package/dist/src/index.d.ts +5 -14
- package/dist/src/index.js +10 -75
- package/dist/src/manifest.js +478 -876
- package/dist/src/screens/billing-portal.d.ts +3 -0
- package/dist/src/screens/{portal.js → billing-portal.js} +32 -58
- package/dist/src/screens/checkout-js.d.ts +2 -0
- package/dist/src/screens/checkout-js.js +84 -0
- package/dist/src/screens/checkout.d.ts +2 -31
- package/dist/src/screens/checkout.js +32 -121
- package/dist/src/screens/connect-onboarding.d.ts +3 -0
- package/dist/src/screens/{onboarding.js → connect-onboarding.js} +38 -104
- package/dist/src/screens/dashboard.d.ts +3 -0
- package/dist/src/screens/dashboard.js +116 -0
- package/dist/src/screens/shared.d.ts +27 -0
- package/dist/src/screens/shared.js +87 -0
- package/dist/src/screens/stripe-js.d.ts +3 -0
- package/dist/src/screens/stripe-js.js +95 -0
- package/dist/src/semantics/account.d.ts +2 -0
- package/dist/src/semantics/account.js +8 -0
- package/dist/src/semantics/account_links.d.ts +2 -0
- package/dist/src/semantics/account_links.js +22 -0
- package/dist/src/semantics/accounts.d.ts +4 -0
- package/dist/src/semantics/accounts.js +40 -0
- package/dist/src/semantics/apps.d.ts +4 -0
- package/dist/src/semantics/{apps-secrets.js → apps.js} +14 -26
- package/dist/src/semantics/around.d.ts +2 -0
- package/dist/src/semantics/around.js +13 -0
- package/dist/src/semantics/balance.d.ts +2 -11
- package/dist/src/semantics/balance.js +3 -194
- package/dist/src/semantics/balance_transactions.d.ts +2 -0
- package/dist/src/semantics/balance_transactions.js +15 -0
- package/dist/src/semantics/billing_portal.d.ts +4 -0
- package/dist/src/semantics/billing_portal.js +36 -0
- package/dist/src/semantics/charges.d.ts +3 -28
- package/dist/src/semantics/charges.js +5 -202
- package/dist/src/semantics/checkout.d.ts +3 -20
- package/dist/src/semantics/checkout.js +21 -271
- package/dist/src/semantics/clock.d.ts +2 -0
- package/dist/src/semantics/clock.js +15 -0
- package/dist/src/semantics/coupons.d.ts +2 -6
- package/dist/src/semantics/coupons.js +2 -60
- package/dist/src/semantics/customers.d.ts +5 -6
- package/dist/src/semantics/customers.js +47 -413
- package/dist/src/semantics/doors.d.ts +23 -0
- package/dist/src/semantics/doors.js +73 -0
- package/dist/src/semantics/entitlements.d.ts +0 -2
- package/dist/src/semantics/entitlements.js +4 -95
- package/dist/src/semantics/events.d.ts +11 -0
- package/dist/src/semantics/events.js +31 -0
- package/dist/src/semantics/index.d.ts +2 -0
- package/dist/src/semantics/index.js +85 -0
- package/dist/src/semantics/invoice_payments.d.ts +2 -0
- package/dist/src/semantics/invoice_payments.js +12 -0
- package/dist/src/semantics/invoices.d.ts +11 -18
- package/dist/src/semantics/invoices.js +121 -440
- package/dist/src/semantics/issuing.d.ts +6 -13
- package/dist/src/semantics/issuing.js +58 -556
- package/dist/src/semantics/payment_intents.d.ts +3 -0
- package/dist/src/semantics/payment_intents.js +71 -0
- package/dist/src/semantics/payment_methods.d.ts +3 -0
- package/dist/src/semantics/payment_methods.js +15 -0
- package/dist/src/semantics/payouts.d.ts +3 -0
- package/dist/src/semantics/payouts.js +28 -0
- package/dist/src/semantics/prices.d.ts +4 -0
- package/dist/src/semantics/prices.js +37 -0
- package/dist/src/semantics/products.d.ts +4 -2
- package/dist/src/semantics/products.js +12 -138
- package/dist/src/semantics/promotion_codes.d.ts +3 -0
- package/dist/src/semantics/promotion_codes.js +35 -0
- package/dist/src/semantics/radar.d.ts +2 -2
- package/dist/src/semantics/radar.js +5 -74
- package/dist/src/semantics/refunds.d.ts +2 -9
- package/dist/src/semantics/refunds.js +3 -193
- package/dist/src/semantics/shared.d.ts +558 -55
- package/dist/src/semantics/shared.js +2070 -114
- package/dist/src/semantics/states.d.ts +462 -0
- package/dist/src/semantics/states.js +634 -0
- package/dist/src/semantics/subscriptions.d.ts +6 -11
- package/dist/src/semantics/subscriptions.js +37 -530
- package/dist/src/semantics/test_helpers.d.ts +3 -0
- package/dist/src/semantics/test_helpers.js +125 -0
- package/dist/src/semantics/transfers.d.ts +2 -2
- package/dist/src/semantics/transfers.js +6 -101
- package/dist/src/semantics/webhook_endpoints.d.ts +2 -0
- package/dist/src/semantics/webhook_endpoints.js +26 -0
- package/dist/src/server.d.ts +7 -0
- package/dist/src/server.js +7 -0
- package/generated/pack-facts.json +94 -0
- package/journeys/coverage.json +596 -0
- package/journeys/customer-life.json +6108 -0
- package/journeys/customer-life.outline.md +371 -0
- package/journeys/decisions.json +677 -0
- package/journeys/demand.json +706 -0
- package/journeys/score.json +853 -0
- package/journeys/unreachable.json +102 -0
- package/journeys/vendor-examples.json +8010 -0
- package/package.json +11 -20
- package/spec/SOURCE.md +18 -0
- package/spec/doc-examples.json +445 -0
- package/spec/fixtures3.json.gz +0 -0
- package/spec/openapi.json.gz +0 -0
- package/spec/patches.json +34 -0
- package/spec/sources.json +306 -0
- package/src/cli.ts +11 -28
- package/src/engine/after-payment.ts +29 -0
- package/src/engine/apps-secrets.ts +4 -0
- package/src/engine/balance.ts +32 -0
- package/src/engine/checkout.ts +39 -0
- package/src/engine/common.ts +49 -0
- package/src/engine/connect.ts +106 -0
- package/src/engine/customers.ts +10 -0
- package/src/engine/display.ts +18 -0
- package/src/engine/files.ts +28 -0
- package/src/engine/invoices.ts +102 -0
- package/src/engine/issuing.ts +66 -0
- package/src/engine/ledger.ts +48 -0
- package/src/engine/oauth.ts +18 -0
- package/src/engine/onboarding.ts +53 -0
- package/src/{stripe-params.ts → engine/params.ts} +7 -56
- package/src/engine/payment-intents.ts +32 -0
- package/src/engine/payment-methods.ts +24 -0
- package/src/engine/radar.ts +6 -0
- package/src/engine/refunds.ts +3 -0
- package/src/engine/renewals.ts +72 -0
- package/src/{stripe-twin.ts → engine/stripe.ts} +57 -400
- package/src/engine/subscriptions.ts +37 -0
- package/src/engine/transfers.ts +22 -0
- package/src/{stripe-version.ts → engine/version.ts} +19 -10
- package/src/engine/webhook-endpoints.ts +14 -0
- package/src/engine/webhooks.ts +70 -0
- package/src/fetch.ts +27 -0
- package/src/generated/surface.gen.json +1 -1
- package/src/generated/ui.gen.json +1 -1
- package/src/index.ts +10 -116
- package/src/manifest.ts +480 -904
- package/src/screens/{portal.tsx → billing-portal.tsx} +35 -42
- package/src/screens/checkout-js.ts +80 -0
- package/src/screens/checkout.tsx +32 -96
- package/src/screens/{onboarding.tsx → connect-onboarding.tsx} +39 -85
- package/src/screens/dashboard.tsx +178 -0
- package/src/screens/shared.tsx +84 -0
- package/src/screens/stripe-js.ts +102 -0
- package/src/semantics/account.ts +10 -0
- package/src/semantics/account_links.ts +20 -0
- package/src/semantics/accounts.ts +44 -0
- package/src/semantics/{apps-secrets.ts → apps.ts} +17 -33
- package/src/semantics/around.ts +17 -0
- package/src/semantics/balance.ts +6 -208
- package/src/semantics/balance_transactions.ts +18 -0
- package/src/semantics/billing_portal.ts +45 -0
- package/src/semantics/charges.ts +8 -212
- package/src/semantics/checkout.ts +25 -276
- package/src/semantics/clock.ts +19 -0
- package/src/semantics/coupons.ts +5 -68
- package/src/semantics/customers.ts +48 -414
- package/src/semantics/doors.ts +79 -0
- package/src/semantics/entitlements.ts +3 -94
- package/src/semantics/events.ts +37 -0
- package/src/semantics/index.ts +89 -0
- package/src/semantics/invoice_payments.ts +16 -0
- package/src/semantics/invoices.ts +112 -441
- package/src/semantics/issuing.ts +57 -573
- package/src/semantics/payment_intents.ts +76 -0
- package/src/semantics/payment_methods.ts +20 -0
- package/src/semantics/payouts.ts +29 -0
- package/src/semantics/prices.ts +41 -0
- package/src/semantics/products.ts +12 -146
- package/src/semantics/promotion_codes.ts +38 -0
- package/src/semantics/radar.ts +8 -79
- package/src/semantics/refunds.ts +4 -216
- package/src/semantics/shared.ts +2089 -135
- package/src/semantics/states.ts +662 -0
- package/src/semantics/subscriptions.ts +39 -542
- package/src/semantics/test_helpers.ts +119 -0
- package/src/semantics/transfers.ts +10 -132
- package/src/semantics/webhook_endpoints.ts +27 -0
- package/src/server.ts +7 -0
- package/client/dashboard-api.ts +0 -286
- package/client/stripe-mirror.css +0 -277
- package/client/stripe-mirror.tsx +0 -1559
- package/dist/client/dashboard-api.d.ts +0 -107
- package/dist/client/dashboard-api.js +0 -238
- package/dist/client/dashboard-api.ts +0 -286
- package/dist/client/stripe-mirror.bundle.js +0 -236
- package/dist/client/stripe-mirror.css +0 -277
- package/dist/client/stripe-mirror.d.ts +0 -134
- package/dist/client/stripe-mirror.js +0 -859
- package/dist/client/stripe-mirror.tsx +0 -1559
- package/dist/src/screens/connect-oauth.d.ts +0 -27
- package/dist/src/screens/connect-oauth.js +0 -414
- package/dist/src/screens/connect-settings.d.ts +0 -22
- package/dist/src/screens/connect-settings.js +0 -103
- package/dist/src/screens/consent-skin.d.ts +0 -4
- package/dist/src/screens/consent-skin.js +0 -18
- package/dist/src/screens/financial-connections.d.ts +0 -5
- package/dist/src/screens/financial-connections.js +0 -90
- package/dist/src/screens/identity.d.ts +0 -5
- package/dist/src/screens/identity.js +0 -86
- package/dist/src/screens/onboarding.d.ts +0 -13
- package/dist/src/screens/portal.d.ts +0 -5
- package/dist/src/screens/public-details.d.ts +0 -5
- package/dist/src/screens/public-details.js +0 -90
- package/dist/src/semantics/after-payment.d.ts +0 -22
- package/dist/src/semantics/after-payment.js +0 -99
- package/dist/src/semantics/apps-secrets.d.ts +0 -2
- package/dist/src/semantics/billing.d.ts +0 -2
- package/dist/src/semantics/billing.js +0 -220
- package/dist/src/semantics/connect.d.ts +0 -5
- package/dist/src/semantics/connect.js +0 -493
- package/dist/src/semantics/credit-notes.d.ts +0 -2
- package/dist/src/semantics/credit-notes.js +0 -172
- package/dist/src/semantics/disputes.d.ts +0 -2
- package/dist/src/semantics/disputes.js +0 -51
- package/dist/src/semantics/ephemeral-keys.d.ts +0 -2
- package/dist/src/semantics/ephemeral-keys.js +0 -34
- package/dist/src/semantics/files.d.ts +0 -2
- package/dist/src/semantics/files.js +0 -125
- package/dist/src/semantics/ledger.d.ts +0 -59
- package/dist/src/semantics/ledger.js +0 -200
- package/dist/src/semantics/payment-intents.d.ts +0 -18
- package/dist/src/semantics/payment-intents.js +0 -452
- package/dist/src/semantics/payment-links.d.ts +0 -2
- package/dist/src/semantics/payment-links.js +0 -133
- package/dist/src/semantics/payment-methods.d.ts +0 -20
- package/dist/src/semantics/payment-methods.js +0 -140
- package/dist/src/semantics/plans.d.ts +0 -5
- package/dist/src/semantics/plans.js +0 -121
- package/dist/src/semantics/platform.d.ts +0 -9
- package/dist/src/semantics/platform.js +0 -206
- package/dist/src/semantics/renewals.d.ts +0 -47
- package/dist/src/semantics/renewals.js +0 -281
- package/dist/src/semantics/setup-intents.d.ts +0 -2
- package/dist/src/semantics/setup-intents.js +0 -84
- package/dist/src/semantics/subscription-schedules.d.ts +0 -2
- package/dist/src/semantics/subscription-schedules.js +0 -119
- package/dist/src/semantics/tax.d.ts +0 -2
- package/dist/src/semantics/tax.js +0 -197
- package/dist/src/semantics/terminal.d.ts +0 -5
- package/dist/src/semantics/terminal.js +0 -182
- package/dist/src/semantics/test-clocks.d.ts +0 -6
- package/dist/src/semantics/test-clocks.js +0 -73
- package/dist/src/semantics/tokens.d.ts +0 -4
- package/dist/src/semantics/tokens.js +0 -44
- package/dist/src/semantics/treasury.d.ts +0 -2
- package/dist/src/semantics/treasury.js +0 -377
- package/dist/src/semantics/webhook-endpoints.d.ts +0 -3
- package/dist/src/semantics/webhook-endpoints.js +0 -85
- package/dist/src/stripe-budget.d.ts +0 -55
- package/dist/src/stripe-budget.js +0 -155
- package/dist/src/stripe-capabilities.d.ts +0 -3
- package/dist/src/stripe-capabilities.js +0 -5836
- package/dist/src/stripe-conformance.d.ts +0 -43
- package/dist/src/stripe-conformance.js +0 -105
- package/dist/src/stripe-connector.d.ts +0 -161
- package/dist/src/stripe-connector.js +0 -414
- package/dist/src/stripe-emit.d.ts +0 -2
- package/dist/src/stripe-emit.js +0 -145
- package/dist/src/stripe-events.d.ts +0 -93
- package/dist/src/stripe-events.js +0 -392
- package/dist/src/stripe-js.d.ts +0 -4
- package/dist/src/stripe-js.js +0 -70
- package/dist/src/stripe-mirror-ui.d.ts +0 -15
- package/dist/src/stripe-mirror-ui.js +0 -87
- package/dist/src/stripe-perform-harness.d.ts +0 -9
- package/dist/src/stripe-perform-harness.js +0 -26
- package/dist/src/stripe-server.d.ts +0 -33
- package/dist/src/stripe-server.js +0 -429
- package/dist/src/stripe-shared.d.ts +0 -109
- package/dist/src/stripe-shared.js +0 -276
- package/dist/src/stripe-ui-conformance.d.ts +0 -5
- package/dist/src/stripe-ui-conformance.js +0 -79
- package/dist/src/stripe-ui-structure.d.ts +0 -3
- package/dist/src/stripe-ui-structure.js +0 -168
- package/dist/test-fixtures/stripe-known-deviations.json +0 -110
- package/dist/test-fixtures/stripe-openapi-operations.SOURCE.md +0 -14
- package/dist/test-fixtures/stripe-openapi-operations.json +0 -4717
- package/dist/test-fixtures/stripe-schemas.SOURCE.md +0 -35
- package/dist/test-fixtures/stripe-schemas.json +0 -3813
- package/src/screens/connect-oauth.tsx +0 -400
- package/src/screens/connect-settings.tsx +0 -121
- package/src/screens/consent-skin.ts +0 -20
- package/src/screens/financial-connections.tsx +0 -101
- package/src/screens/identity.tsx +0 -96
- package/src/screens/public-details.tsx +0 -105
- package/src/semantics/after-payment.ts +0 -118
- package/src/semantics/billing.ts +0 -216
- package/src/semantics/connect.ts +0 -487
- package/src/semantics/credit-notes.ts +0 -168
- package/src/semantics/disputes.ts +0 -62
- package/src/semantics/ephemeral-keys.ts +0 -34
- package/src/semantics/files.ts +0 -143
- package/src/semantics/ledger.ts +0 -253
- package/src/semantics/payment-intents.ts +0 -463
- package/src/semantics/payment-links.ts +0 -148
- package/src/semantics/payment-methods.ts +0 -145
- package/src/semantics/plans.ts +0 -131
- package/src/semantics/platform.ts +0 -220
- package/src/semantics/renewals.ts +0 -279
- package/src/semantics/setup-intents.ts +0 -87
- package/src/semantics/subscription-schedules.ts +0 -129
- package/src/semantics/tax.ts +0 -220
- package/src/semantics/terminal.ts +0 -195
- package/src/semantics/test-clocks.ts +0 -77
- package/src/semantics/tokens.ts +0 -52
- package/src/semantics/treasury.ts +0 -383
- package/src/semantics/webhook-endpoints.ts +0 -87
- package/src/stripe-budget.ts +0 -181
- package/src/stripe-capabilities.ts +0 -5651
- package/src/stripe-conformance.ts +0 -124
- package/src/stripe-connector.ts +0 -462
- package/src/stripe-emit.ts +0 -157
- package/src/stripe-events.ts +0 -434
- package/src/stripe-js.ts +0 -70
- package/src/stripe-mirror-ui.ts +0 -90
- package/src/stripe-perform-harness.ts +0 -29
- package/src/stripe-server.ts +0 -393
- package/src/stripe-shared.ts +0 -297
- package/src/stripe-ui-conformance.ts +0 -88
- package/src/stripe-ui-structure.ts +0 -182
- package/test-fixtures/stripe-known-deviations.json +0 -110
- package/test-fixtures/stripe-openapi-operations.json +0 -4717
- package/test-fixtures/stripe-schemas.json +0 -3813
- /package/dist/src/{screens → engine}/industries.d.ts +0 -0
- /package/dist/src/{screens → engine}/industries.js +0 -0
- /package/dist/src/{semantics → engine}/test-cards.d.ts +0 -0
- /package/dist/src/{semantics → engine}/test-cards.js +0 -0
- /package/src/{screens → engine}/industries.ts +0 -0
- /package/src/{semantics → engine}/test-cards.ts +0 -0
package/dist/src/manifest.js
CHANGED
|
@@ -1,491 +1,285 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
code: 'payment_intent_unexpected_state',
|
|
5
|
-
message: `This PaymentIntent could not be ${verb} because it has a status of {from}. ${allowed}`,
|
|
6
|
-
});
|
|
7
|
-
const OPEN = ['requires_payment_method', 'requires_confirmation', 'requires_action', 'requires_capture', 'processing'];
|
|
8
|
-
/** A move no API call makes: Stripe's own (`vendor`), the clock's (`time`), or the person on a
|
|
9
|
-
* Stripe-hosted page (`external`: Checkout, the billing portal, a hosted invoice or 3DS page). */
|
|
10
|
-
const by = (actor, from, to, source) => ({ actor, from, to, source });
|
|
11
|
-
/** A bank account's `status` as a payout or payment destination. Stripe validates its routing number,
|
|
12
|
-
* verifies it (micro-deposits, or instantly) and marks it errored when a payout or debit to it fails
|
|
13
|
-
* (the page each machine cites); no call the twin serves does any of that (the customer-source verify is
|
|
14
|
-
* a gap), so no move of it is the twin's. */
|
|
15
|
-
const bankAccountStatus = (_doc) => ({ initial: 'new', transitions: [] });
|
|
16
|
-
/** A flag an update sets either way. */
|
|
17
|
-
const flag = (operation, source) => ['true', 'false'].map((to) => ({ operation, from: '*', to, source }));
|
|
18
|
-
/** A PaymentIntent's `status`: which operation may move it from where, and what Stripe answers otherwise. */
|
|
19
|
-
const paymentIntentStatus = {
|
|
20
|
-
// "After you create the PaymentIntent, its status is `requires_payment_method` until you attach a payment method"
|
|
21
|
-
// (docs.stripe.com/payments/paymentintents/lifecycle)
|
|
22
|
-
initial: 'requires_payment_method',
|
|
23
|
-
transitions: [
|
|
24
|
-
// created with its payment method, it "enters the `requires_confirmation` status and is ready to confirm" (the same page)
|
|
25
|
-
{ operation: 'PostPaymentIntents', from: ['requires_payment_method'], to: 'requires_confirmation', source: 'https://docs.stripe.com/payments/paymentintents/lifecycle' },
|
|
26
|
-
// confirm lands on one of its outcomes, decided by the payment method and the capture method
|
|
27
|
-
...['requires_payment_method', 'requires_action', 'requires_capture', 'succeeded'].map((to) => ({
|
|
28
|
-
operation: 'PostPaymentIntentsIntentConfirm',
|
|
29
|
-
from: ['requires_payment_method', 'requires_confirmation', 'requires_action'],
|
|
30
|
-
to,
|
|
31
|
-
refusal: { status: 400, code: 'payment_intent_unexpected_state', message: 'You cannot confirm this PaymentIntent because it has a status of {from}.' },
|
|
32
|
-
source: 'https://docs.stripe.com/api/payment_intents/confirm',
|
|
33
|
-
})),
|
|
34
|
-
// a bank debit confirmed (created with `confirm`, confirmed, or verified by micro-deposits) is submitted and
|
|
35
|
-
// processes: "The PaymentIntent you create initially has a status of `processing`"; "When the bank account is
|
|
36
|
-
// successfully verified, Stripe returns the PaymentIntent object with a status of `processing`"
|
|
37
|
-
...['PostPaymentIntents', 'PostPaymentIntentsIntentConfirm'].map((operation) => ({
|
|
38
|
-
operation, from: ['requires_payment_method', 'requires_confirmation', 'requires_action'], to: 'processing',
|
|
39
|
-
source: 'https://docs.stripe.com/payments/ach-direct-debit/accept-a-payment?payment-ui=direct-api',
|
|
40
|
-
})),
|
|
41
|
-
// and succeeds: "After the payment has succeeded, the PaymentIntent status is updated from `processing`
|
|
42
|
-
// to `succeeded`" (semantics/payment-intents.ts settleBankDebits)
|
|
43
|
-
by('vendor', ['processing'], 'succeeded', 'https://docs.stripe.com/payments/ach-direct-debit/accept-a-payment?payment-ui=direct-api'),
|
|
44
|
-
// creating one with `confirm` confirms it at once, landing where a confirm lands
|
|
45
|
-
...['requires_payment_method', 'requires_action', 'requires_capture', 'succeeded'].map((to) => ({
|
|
46
|
-
operation: 'PostPaymentIntents',
|
|
47
|
-
from: ['requires_payment_method', 'requires_confirmation'],
|
|
48
|
-
to,
|
|
49
|
-
source: 'spec:PostPaymentIntents "Set to `true` to attempt to [confirm this PaymentIntent](https://docs.stripe.com/api/payment_intents/confirm) immediately."',
|
|
50
|
-
})),
|
|
51
|
-
{
|
|
52
|
-
operation: 'PostPaymentIntentsIntentCapture',
|
|
53
|
-
from: ['requires_capture'],
|
|
54
|
-
to: 'succeeded',
|
|
55
|
-
refusal: unexpected('captured', 'Only a PaymentIntent with one of the following statuses may be captured: requires_capture.'),
|
|
56
|
-
source: 'https://docs.stripe.com/api/payment_intents/capture',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
operation: 'PostPaymentIntentsIntentIncrementAuthorization',
|
|
60
|
-
from: ['requires_capture'],
|
|
61
|
-
to: 'requires_capture',
|
|
62
|
-
refusal: unexpected('incremented', 'Only a PaymentIntent with a status of requires_capture may be incremented.'),
|
|
63
|
-
source: 'https://docs.stripe.com/api/payment_intents/increment_authorization',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
operation: 'PostPaymentIntentsIntentCancel',
|
|
67
|
-
from: OPEN,
|
|
68
|
-
to: 'canceled',
|
|
69
|
-
refusal: unexpected('canceled', 'Only a PaymentIntent with one of the following statuses may be canceled: requires_payment_method, requires_capture, requires_confirmation, requires_action, processing.'),
|
|
70
|
-
source: 'https://docs.stripe.com/api/payment_intents/cancel',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
operation: 'PostPaymentIntentsIntentVerifyMicrodeposits',
|
|
74
|
-
from: ['requires_action'],
|
|
75
|
-
to: 'processing',
|
|
76
|
-
refusal: { status: 400, code: 'payment_intent_unexpected_state', message: 'This PaymentIntent could not be verified because it has a status of {from}.' },
|
|
77
|
-
source: 'https://docs.stripe.com/payments/ach-direct-debit/accept-a-payment?payment-ui=direct-api',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
// paying the invoice an intent collects for settles the intent
|
|
81
|
-
operation: 'PostInvoicesInvoicePay',
|
|
82
|
-
from: OPEN,
|
|
83
|
-
to: 'succeeded',
|
|
84
|
-
source: 'https://docs.stripe.com/api/invoices/pay',
|
|
85
|
-
},
|
|
86
|
-
...['succeeded', 'requires_action'].map((to) => ({
|
|
87
|
-
operation: 'PostPaymentIntentsIntentApplyCustomerBalance',
|
|
88
|
-
from: OPEN,
|
|
89
|
-
to,
|
|
90
|
-
refusal: { status: 400, code: 'payment_intent_unexpected_state', message: 'This PaymentIntent could not be updated because it has a status of {from}.' },
|
|
91
|
-
source: 'https://docs.stripe.com/api/payment_intents/apply_customer_balance',
|
|
92
|
-
})),
|
|
93
|
-
// a card presented to the Terminal reader processing an intent pays it (held, under manual capture)
|
|
94
|
-
...['succeeded', 'requires_capture'].map((to) => ({
|
|
95
|
-
operation: 'PostTestHelpersTerminalReadersReaderPresentPaymentMethod', from: ['requires_payment_method', 'requires_confirmation'], to,
|
|
96
|
-
source: 'https://docs.stripe.com/api/terminal/readers/present_payment_method',
|
|
97
|
-
})),
|
|
98
|
-
// the customer pays, in the billing portal, the invoice an intent collects for after its charge was declined
|
|
99
|
-
by('external', ['requires_payment_method'], 'succeeded', 'https://docs.stripe.com/customer-management'),
|
|
100
|
-
// Stripe also fails a bank debit back to needing a payment method, completes 3-D Secure on the bank's page and
|
|
101
|
-
// cancels a hold left uncaptured; the twin's bank debits succeed unless their test account stays processing, it has no 3-D Secure page, and it keeps
|
|
102
|
-
// holds until they are captured or canceled
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
/** A charge's `captured`: an authorization (capture=false) is captured once. */
|
|
106
|
-
const chargeCaptured = {
|
|
107
|
-
initial: true,
|
|
108
|
-
transitions: [
|
|
109
|
-
{
|
|
110
|
-
operation: 'PostChargesChargeCapture',
|
|
111
|
-
from: ['false'],
|
|
112
|
-
to: 'true',
|
|
113
|
-
refusal: { status: 400, code: 'charge_already_captured', message: 'Charge ch_xxx has already been captured.' },
|
|
114
|
-
source: 'https://docs.stripe.com/api/charges/capture',
|
|
115
|
-
},
|
|
116
|
-
// a manual-capture intent's capture captures the charge its confirm authorized
|
|
117
|
-
{ operation: 'PostPaymentIntentsIntentCapture', from: ['false'], to: 'true', source: 'https://docs.stripe.com/api/payment_intents/capture' },
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
/** A charge's `refunded`: true once refunds take its whole amount, false again when a refund that made it so is
|
|
121
|
-
* canceled. A capture or a cancel never makes it so: "`refunded` will no longer be `true` for payment cancellation
|
|
122
|
-
* flows", and a partial capture makes no Refund (docs.stripe.com/changelog/basil/2025-03-31/remove-refund-from-partial-
|
|
123
|
-
* capture-and-payment-cancellation-flow). */
|
|
124
|
-
const chargeRefunded = {
|
|
125
|
-
initial: false,
|
|
126
|
-
transitions: [
|
|
127
|
-
...['PostRefunds', 'PostChargesChargeRefunds', 'PostCreditNotes'].map((operation) => ({ operation, from: ['false'], to: 'true', source: 'https://docs.stripe.com/api/charges/object#charge_object-refunded' })),
|
|
128
|
-
{ operation: 'PostRefundsRefundCancel', from: ['true'], to: 'false', source: 'https://docs.stripe.com/api/refunds/cancel' },
|
|
129
|
-
// (an authorization left uncaptured is canceled after seven days, "Uncaptured PaymentIntents are cancelled a set
|
|
130
|
-
// number of days (7 by default) after their creation", docs.stripe.com/api/payment_intents/capture; the twin keeps it)
|
|
131
|
-
],
|
|
132
|
-
};
|
|
133
|
-
/** A charge's `status`: the twin settles a charge when it is made (a declined one is never
|
|
134
|
-
* stored); an asynchronous one settles later, on the network's word. */
|
|
135
|
-
const chargeStatus = {
|
|
136
|
-
initial: 'succeeded',
|
|
137
|
-
transitions: [
|
|
138
|
-
// (an asynchronous charge is pending at Stripe until it settles or fails; the twin's settle when made)
|
|
139
|
-
],
|
|
140
|
-
};
|
|
141
|
-
/** A charge's `paid`: true once it succeeded or was authorized; a pending one becomes paid when it settles. */
|
|
142
|
-
const chargePaid = {
|
|
143
|
-
initial: true,
|
|
144
|
-
// (a charge is paid when it settles; the twin's settle when made)
|
|
145
|
-
transitions: [],
|
|
146
|
-
};
|
|
147
|
-
/** A refund's `status`: only one waiting on the customer (requires_action) may be canceled; the
|
|
148
|
-
* rest is the network's. */
|
|
149
|
-
const refundStatus = {
|
|
150
|
-
initial: 'succeeded',
|
|
151
|
-
transitions: [
|
|
152
|
-
{
|
|
153
|
-
operation: 'PostRefundsRefundCancel',
|
|
154
|
-
from: ['requires_action'],
|
|
155
|
-
to: 'canceled',
|
|
156
|
-
refusal: { status: 400, code: 'refund_status_invalid', message: 'Refund {id} cannot be canceled because its status is {from}.' },
|
|
157
|
-
source: 'https://docs.stripe.com/api/refunds/cancel',
|
|
158
|
-
},
|
|
159
|
-
// a card refund the available balance does not cover is held pending, and made once the balance covers it: "Stripe
|
|
160
|
-
// holds the refund as pending for card transactions ... until your Stripe balance becomes sufficient"
|
|
161
|
-
// (docs.stripe.com/refunds; semantics/refunds.ts)
|
|
162
|
-
// (a paid invoice's credit note makes its refund as a refund call does: "Refunds: create a new refund (using
|
|
163
|
-
// refund_amount)", docs.stripe.com/api/credit_notes/create)
|
|
164
|
-
...['PostRefunds', 'PostChargesChargeRefunds', 'PostCreditNotes'].map((operation) => ({ operation, from: ['succeeded'], to: 'pending', source: 'https://docs.stripe.com/refunds' })),
|
|
165
|
-
by('vendor', ['pending'], 'succeeded', 'https://docs.stripe.com/refunds'),
|
|
166
|
-
// a bank-transfer payment's refund waits in requires_action for the customer's bank details, and is made so
|
|
167
|
-
// (semantics/refunds.ts); (Stripe also fails some refunds; the twin's do not fail)
|
|
168
|
-
],
|
|
169
|
-
};
|
|
170
|
-
const SETUP_OPEN = ['requires_payment_method', 'requires_confirmation', 'requires_action'];
|
|
171
|
-
const setupUnexpected = (verb) => ({ status: 400, code: 'setup_intent_unexpected_state', message: `You cannot ${verb} this SetupIntent because it has a status of {from}.` });
|
|
172
|
-
/** A SetupIntent's `status`: confirm settles it (or leaves a bank account awaiting micro-deposits),
|
|
173
|
-
* cancel ends an open one, and verification completes the micro-deposit wait. */
|
|
174
|
-
const setupIntentStatus = {
|
|
175
|
-
// "After you create the SetupIntent, it has a status of `requires_payment_method` until you attach a payment method"
|
|
176
|
-
// (docs.stripe.com/payments/paymentintents/lifecycle)
|
|
177
|
-
initial: 'requires_payment_method',
|
|
178
|
-
transitions: [
|
|
179
|
-
// created with its payment method, it "enters the `requires_confirmation` status and is ready to confirm" (the same page)
|
|
180
|
-
{ operation: 'PostSetupIntents', from: ['requires_payment_method'], to: 'requires_confirmation', source: 'https://docs.stripe.com/payments/paymentintents/lifecycle' },
|
|
181
|
-
...['requires_action', 'succeeded'].map((to) => ({
|
|
182
|
-
operation: 'PostSetupIntentsIntentConfirm',
|
|
183
|
-
from: SETUP_OPEN,
|
|
184
|
-
to,
|
|
185
|
-
refusal: setupUnexpected('confirm'),
|
|
186
|
-
source: 'https://docs.stripe.com/api/setup_intents/confirm',
|
|
187
|
-
})),
|
|
188
|
-
{
|
|
189
|
-
operation: 'PostSetupIntentsIntentCancel',
|
|
190
|
-
from: SETUP_OPEN,
|
|
191
|
-
to: 'canceled',
|
|
192
|
-
refusal: setupUnexpected('cancel'),
|
|
193
|
-
source: 'https://docs.stripe.com/api/setup_intents/cancel',
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
operation: 'PostSetupIntentsIntentVerifyMicrodeposits',
|
|
197
|
-
from: ['requires_action'],
|
|
198
|
-
to: 'succeeded',
|
|
199
|
-
refusal: { status: 400, code: 'setup_intent_unexpected_state', message: 'This SetupIntent could not be verified because it has a status of {from}.' },
|
|
200
|
-
source: 'https://docs.stripe.com/api/setup_intents/verify_microdeposits',
|
|
201
|
-
},
|
|
202
|
-
// (Stripe completes 3-D Secure on the bank's page and settles an asynchronous method from processing; the
|
|
203
|
-
// twin has no such page and settles every method at once)
|
|
204
|
-
],
|
|
205
|
-
};
|
|
206
|
-
const invoiceRefusal = (message) => ({ status: 400, code: 'invoice_not_editable', message });
|
|
207
|
-
/** An invoice's `status`: a draft is finalized (or sent, which finalizes it) into open, an open one
|
|
208
|
-
* is paid, written off or voided. Sending leaves any other status where it is. */
|
|
209
|
-
const invoiceStatus = {
|
|
210
|
-
initial: 'draft',
|
|
211
|
-
transitions: [
|
|
212
|
-
{
|
|
213
|
-
operation: 'PostInvoicesInvoiceFinalize',
|
|
214
|
-
from: ['draft'],
|
|
215
|
-
to: 'open',
|
|
216
|
-
refusal: invoiceRefusal('This invoice cannot be finalized because it has status {from}.'),
|
|
217
|
-
source: 'https://docs.stripe.com/api/invoices/finalize',
|
|
218
|
-
},
|
|
219
|
-
// docs.stripe.com/invoicing/integration: "To finalize a draft invoice, use the Dashboard, send it to the customer, or pay it."
|
|
220
|
-
{ operation: 'PostInvoicesInvoiceSend', from: ['draft'], to: 'open', source: 'https://docs.stripe.com/invoicing/integration' },
|
|
221
|
-
{ operation: 'PostInvoicesInvoiceSend', from: ['open', 'paid', 'uncollectible', 'void'], source: 'https://docs.stripe.com/api/invoices/send' },
|
|
222
|
-
{
|
|
223
|
-
operation: 'PostInvoicesInvoicePay',
|
|
224
|
-
from: ['open', 'uncollectible'],
|
|
225
|
-
to: 'paid',
|
|
226
|
-
refusal: invoiceRefusal('This invoice cannot be paid because it has status {from}.'),
|
|
227
|
-
refusals: { paid: { status: 400, code: 'invoice_payment_intent_requires_action', message: 'This invoice has already been paid.' } },
|
|
228
|
-
source: 'https://docs.stripe.com/api/invoices/pay',
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
operation: 'PostInvoicesInvoiceMarkUncollectible',
|
|
232
|
-
from: ['open'],
|
|
233
|
-
to: 'uncollectible',
|
|
234
|
-
refusal: invoiceRefusal('Only open invoices can be marked uncollectible (this one is {from}).'),
|
|
235
|
-
source: 'https://docs.stripe.com/api/invoices/mark_uncollectible',
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
// only a finalized invoice is voided; a draft is deleted
|
|
239
|
-
operation: 'PostInvoicesInvoiceVoid',
|
|
240
|
-
from: ['open', 'uncollectible'],
|
|
241
|
-
to: 'void',
|
|
242
|
-
refusal: invoiceRefusal('This invoice cannot be voided because it has status {from}.'),
|
|
243
|
-
source: 'https://docs.stripe.com/api/invoices/void',
|
|
244
|
-
},
|
|
245
|
-
// confirming or capturing the PaymentIntent an invoice collects through pays the invoice
|
|
246
|
-
...['PostPaymentIntentsIntentConfirm', 'PostPaymentIntentsIntentCapture'].map((operation) => ({
|
|
247
|
-
operation, from: ['draft', 'open', 'uncollectible'], to: 'paid', source: 'https://docs.stripe.com/billing/subscriptions/build-subscriptions',
|
|
248
|
-
})),
|
|
249
|
-
// as does its bank debit succeeding once submitted (semantics/payment-intents.ts settleBankDebits)
|
|
250
|
-
by('vendor', ['draft', 'open', 'uncollectible'], 'paid', 'https://docs.stripe.com/billing/subscriptions/build-subscriptions'),
|
|
251
|
-
// a bank transfer that arrives in the customer's cash balance pays an open invoice that takes transfers
|
|
252
|
-
// (automatic reconciliation; in test mode the funding helper stands in for the transfer)
|
|
253
|
-
{ operation: 'PostTestHelpersCustomersCustomerFundCashBalance', from: ['open'], to: 'paid', source: 'https://docs.stripe.com/payments/customer-balance/reconciliation' },
|
|
254
|
-
// a subscription's first invoice is paid on the Checkout page that started it
|
|
255
|
-
by('external', ['draft'], 'paid', 'https://docs.stripe.com/payments/checkout/how-checkout-works'),
|
|
256
|
-
// a subscription's renewal, drafted at its period's end, is finalized about an hour later and charged: paid, or
|
|
257
|
-
// open when the charge is declined (semantics/renewals.ts)
|
|
258
|
-
by('time', ['draft'], 'paid', 'https://docs.stripe.com/invoicing/integration/workflow-transitions#finalized'),
|
|
259
|
-
by('time', ['draft'], 'open', 'https://docs.stripe.com/billing/subscriptions/overview#payment-status'),
|
|
260
|
-
// an update that ends a subscription's trial invoices its new period and attempts payment at once: paid, or open
|
|
261
|
-
// when the charge is declined or not attempted (semantics/subscriptions.ts applyTrialEnd)
|
|
262
|
-
{ operation: 'PostSubscriptionsSubscriptionExposedId', from: ['draft'], to: 'paid', source: 'https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment' },
|
|
263
|
-
// a trialing subscription's first invoice, for nothing, is paid as it is made ("An immediate invoice is still
|
|
264
|
-
// created, but the amount is 0", docs.stripe.com/billing/subscriptions/trials/free-trials)
|
|
265
|
-
{ operation: 'PostSubscriptions', from: ['draft'], to: 'paid', source: 'https://docs.stripe.com/billing/subscriptions/trials/free-trials' },
|
|
266
|
-
{ operation: 'PostSubscriptionsSubscriptionExposedId', from: ['draft'], to: 'open', source: 'https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment' },
|
|
267
|
-
// the customer pays an open invoice in the billing portal
|
|
268
|
-
by('external', ['open'], 'paid', 'https://docs.stripe.com/customer-management'),
|
|
269
|
-
// (Stripe also finalizes any other auto-advancing draft after an hour, retries an open invoice on its schedule
|
|
270
|
-
// and, retries exhausted, may write it off, and takes payment on the hosted invoice page; the twin's other
|
|
271
|
-
// invoices move only by the calls above)
|
|
272
|
-
],
|
|
273
|
-
};
|
|
274
|
-
/** A subscription's `status` as the twin's own operations move it; canceling ends any subscription. */
|
|
275
|
-
const subscriptionStatus = {
|
|
276
|
-
initial: 'active',
|
|
277
|
-
transitions: [
|
|
278
|
-
{ operation: 'DeleteSubscriptionsSubscriptionExposedId', from: '*', to: 'canceled', source: 'https://docs.stripe.com/api/subscriptions/cancel' },
|
|
279
|
-
// (a test clock's advance moves no subscription itself: when the clock reaches its target, a trial that ended there
|
|
280
|
-
// ends by time's move below, on the next request; semantics/test-clocks.ts finishClockAdvances)
|
|
281
|
-
// "Deleting the simulation also deletes the test customers associated with the clock and cancels their
|
|
282
|
-
// subscriptions" (docs.stripe.com/billing/testing/test-clocks/api-advanced-usage)
|
|
283
|
-
{ operation: 'DeleteTestHelpersTestClocksTestClock', from: '*', to: 'canceled', source: 'https://docs.stripe.com/billing/testing/test-clocks/api-advanced-usage' },
|
|
284
|
-
// "Cancels a subscription schedule and its associated subscription immediately" (docs.stripe.com/api/subscription_schedules/cancel)
|
|
285
|
-
{ operation: 'PostSubscriptionSchedulesScheduleCancel', from: ['active', 'trialing', 'past_due', 'incomplete'], to: 'canceled', source: 'https://docs.stripe.com/api/subscription_schedules/cancel' },
|
|
286
|
-
// confirming or capturing the first invoice's PaymentIntent, or paying the invoice itself, pays it and
|
|
287
|
-
// activates the subscription
|
|
288
|
-
...['PostPaymentIntentsIntentConfirm', 'PostPaymentIntentsIntentCapture'].map((operation) => ({
|
|
289
|
-
operation, from: ['incomplete'], to: 'active', source: 'https://docs.stripe.com/billing/subscriptions/build-subscriptions',
|
|
290
|
-
})),
|
|
291
|
-
// or when its bank debit succeeds once submitted (semantics/payment-intents.ts settleBankDebits)
|
|
292
|
-
by('vendor', ['incomplete'], 'active', 'https://docs.stripe.com/billing/subscriptions/build-subscriptions'),
|
|
293
|
-
// paying the invoice a subscription waits on (its first, or a renewal that failed) makes it active
|
|
294
|
-
{ operation: 'PostInvoicesInvoicePay', from: ['incomplete', 'past_due'], to: 'active', source: 'https://docs.stripe.com/billing/subscriptions/overview#payment-status' },
|
|
295
|
-
// an update's `trial_end`: `now` ends a trial at once and charges the new period, active when paid and past_due when
|
|
296
|
-
// not; a future timestamp starts a trial on a subscription out of one (semantics/subscriptions.ts applyTrialEnd)
|
|
297
|
-
{ operation: 'PostSubscriptionsSubscriptionExposedId', from: ['trialing'], to: 'active', source: 'https://docs.stripe.com/api/subscriptions/update#update_subscription-trial_end' },
|
|
298
|
-
{ operation: 'PostSubscriptionsSubscriptionExposedId', from: ['trialing'], to: 'past_due', source: 'https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment' },
|
|
299
|
-
{
|
|
300
|
-
operation: 'PostSubscriptionsSubscriptionExposedId', from: ['active', 'past_due'], to: 'trialing',
|
|
301
|
-
// (Where the documentation stops and the twin decides: the wording of the refusal for a subscription neither
|
|
302
|
-
// active nor past_due; a canceled one answers what Stripe answers any update of a canceled subscription.)
|
|
303
|
-
refusal: { status: 400, message: 'A trial can only be added to an active or past_due subscription; this one is {from}.' },
|
|
304
|
-
refusals: { canceled: { status: 400, message: 'A canceled subscription can only update its cancellation_details and metadata.' } },
|
|
305
|
-
source: 'https://docs.stripe.com/billing/subscriptions/trials/free-trials#adding-a-new-trial-to-a-subscription-previously-in-a-trial',
|
|
306
|
-
},
|
|
307
|
-
// a trial ends on its own clock (Stripe pauses one that ends with no payment method to bill; the twin's
|
|
308
|
-
// trials end active), and a renewal whose charge is declined leaves the subscription past_due
|
|
309
|
-
// (semantics/renewals.ts)
|
|
310
|
-
by('time', ['trialing'], 'active', 'https://docs.stripe.com/billing/subscriptions/trials'),
|
|
311
|
-
by('time', ['active'], 'past_due', 'https://docs.stripe.com/billing/subscriptions/overview#payment-status'),
|
|
312
|
-
// one set to cancel at its period's end is canceled when the period ends
|
|
313
|
-
by('time', ['active', 'trialing', 'past_due'], 'canceled', 'https://docs.stripe.com/billing/subscriptions/cancel#cancel-at-end-of-cycle'),
|
|
314
|
-
// the customer pays the invoice it waits on in the billing portal
|
|
315
|
-
by('external', ['past_due'], 'active', 'https://docs.stripe.com/customer-management'),
|
|
316
|
-
// (Stripe also expires an incomplete subscription after 23 hours, and retries a failed renewal on its schedule,
|
|
317
|
-
// the settings ending the retries unpaid or canceled; the twin makes no retry)
|
|
318
|
-
// the customer cancels in the billing portal
|
|
319
|
-
by('external', ['active', 'trialing', 'past_due', 'unpaid', 'paused'], 'canceled', 'spec:/components/schemas/portal_subscription_cancel "Whether to cancel subscriptions immediately or at the end of the billing period."'),
|
|
320
|
-
],
|
|
321
|
-
};
|
|
322
|
-
const notOpen = (verb) => ({ status: 400, code: 'checkout_session_not_open', message: `You may only ${verb} a Checkout Session that is currently in the \`open\` state.` });
|
|
323
|
-
/** A Checkout Session's `status`: an open session expires (asked to, or 24 hours on), or completes
|
|
324
|
-
* when the customer pays on the hosted page. Completion is the external actor's move, the one the
|
|
325
|
-
* hosted Checkout page (src/screens/checkout.tsx) performs. */
|
|
326
|
-
const checkoutStatus = {
|
|
327
|
-
initial: 'open',
|
|
328
|
-
transitions: [
|
|
329
|
-
{ operation: 'PostCheckoutSessionsSessionExpire', from: ['open'], to: 'expired', refusal: notOpen('expire'), source: 'https://docs.stripe.com/api/checkout/sessions/expire' },
|
|
330
|
-
{ actor: 'external', from: ['open'], to: 'complete', refusal: notOpen('complete'), source: 'https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-status' },
|
|
331
|
-
// (Stripe expires an open session at expires_at; the twin keeps it open until asked)
|
|
332
|
-
],
|
|
333
|
-
};
|
|
334
|
-
/** A Checkout Session's `payment_status`: the customer completing a payment or subscription session
|
|
335
|
-
* pays it; a delayed payment method settles later. */
|
|
336
|
-
const checkoutPaymentStatus = {
|
|
337
|
-
initial: 'unpaid',
|
|
338
|
-
transitions: [
|
|
339
|
-
{ actor: 'external', from: '*', to: 'paid', source: 'https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-payment_status' },
|
|
340
|
-
// (a delayed method settles a session later at Stripe; the twin's settle on the page)
|
|
341
|
-
],
|
|
342
|
-
};
|
|
343
|
-
/** A dispute's `status`: closing concedes it; the bank decides the rest, and an unanswered one is
|
|
344
|
-
* lost when its evidence is due. */
|
|
345
|
-
const disputeStatus = {
|
|
346
|
-
initial: 'warning_needs_response',
|
|
347
|
-
transitions: [
|
|
348
|
-
{ operation: 'PostDisputesDisputeClose', from: '*', to: 'lost', source: 'https://docs.stripe.com/api/disputes/close' },
|
|
349
|
-
// submitting evidence puts a dispute (or an inquiry) under review; in test mode the evidence decides it
|
|
350
|
-
{ operation: 'PostDisputesDispute', from: ['needs_response'], to: 'under_review', source: 'https://docs.stripe.com/api/disputes/update#update_dispute-submit' },
|
|
351
|
-
{ operation: 'PostDisputesDispute', from: ['warning_needs_response'], to: 'warning_under_review', source: 'https://docs.stripe.com/api/disputes/update#update_dispute-submit' },
|
|
352
|
-
by('vendor', ['under_review'], 'won', 'https://docs.stripe.com/testing#evidence'),
|
|
353
|
-
by('vendor', ['under_review'], 'lost', 'https://docs.stripe.com/testing#evidence'),
|
|
354
|
-
// (the bank decides a dispute under review, escalates an inquiry and loses one left unanswered; the twin
|
|
355
|
-
// decides none)
|
|
356
|
-
// Stripe also closes an inquiry the bank drops (warning_closed); no inquiry the twin holds is dropped
|
|
357
|
-
],
|
|
358
|
-
};
|
|
359
|
-
/** A payout's `status`: cancel ends it; reversing cancels it and pays a reversal, never twice. */
|
|
360
|
-
const payoutStatus = {
|
|
361
|
-
initial: 'pending',
|
|
362
|
-
transitions: [
|
|
363
|
-
// only a pending payout can be canceled (docs.stripe.com/api/payouts/cancel); reversing a paid one makes a new
|
|
364
|
-
// payout and leaves the original paid (semantics/balance.ts)
|
|
365
|
-
{ operation: 'PostPayoutsPayoutCancel', from: ['pending'], to: 'canceled', source: 'https://docs.stripe.com/api/payouts/cancel' },
|
|
366
|
-
// it arrives in the bank on its arrival date
|
|
367
|
-
by('time', ['pending'], 'paid', 'https://docs.stripe.com/payouts#payout-statuses'),
|
|
368
|
-
// (a bank may fail a payout at Stripe; the twin's arrive)
|
|
369
|
-
],
|
|
370
|
-
};
|
|
371
|
-
/** A credit note's `status`: issued, then voided once. */
|
|
372
|
-
const creditNoteStatus = {
|
|
373
|
-
initial: 'issued',
|
|
374
|
-
transitions: [
|
|
375
|
-
{
|
|
376
|
-
operation: 'PostCreditNotesIdVoid',
|
|
377
|
-
from: ['issued'],
|
|
378
|
-
to: 'void',
|
|
379
|
-
refusal: { status: 400, code: 'credit_note_already_voided', message: 'This credit note has already been voided.' },
|
|
380
|
-
source: 'https://docs.stripe.com/api/credit_notes/void',
|
|
381
|
-
},
|
|
382
|
-
],
|
|
383
|
-
};
|
|
384
|
-
const scheduleEnded = (verb) => ({ status: 400, code: 'subscription_schedule_status_invalid', message: `This subscription schedule has status {from} and cannot be ${verb}.` });
|
|
385
|
-
/** A subscription schedule's `status`: canceling or releasing ends it; an ended one refuses both. */
|
|
386
|
-
const scheduleStatus = {
|
|
387
|
-
initial: 'active',
|
|
388
|
-
transitions: [
|
|
389
|
-
// "A subscription schedule can only be canceled if its status is not_started or active"; "A schedule can only be
|
|
390
|
-
// released if its status is not_started or active" (the cancel and release pages)
|
|
391
|
-
{ operation: 'PostSubscriptionSchedulesScheduleCancel', from: ['active', 'not_started'], to: 'canceled', refusal: scheduleEnded('canceled'), source: 'https://docs.stripe.com/api/subscription_schedules/cancel' },
|
|
392
|
-
{ operation: 'PostSubscriptionSchedulesScheduleRelease', from: ['active', 'not_started'], to: 'released', refusal: scheduleEnded('released'), source: 'https://docs.stripe.com/api/subscription_schedules/release' },
|
|
393
|
-
// its phases run on the clock: it starts at its start date and ends with its last phase
|
|
394
|
-
// (a schedule whose end_behavior is cancel completes at its end at Stripe; the twin's release)
|
|
395
|
-
// (Stripe starts a schedule at its start date and ends it with its last phase; the twin's start at once
|
|
396
|
-
// and end when canceled or released)
|
|
397
|
-
],
|
|
398
|
-
};
|
|
399
|
-
const quoteRefusal = (verb) => ({ status: 400, code: 'quote_invalid_status', message: `This quote cannot be ${verb} because it has status {from}.` });
|
|
400
|
-
/** A quote's `status`: a draft is finalized into open, an open one accepted, and either canceled. */
|
|
401
|
-
const quoteStatus = {
|
|
402
|
-
initial: 'draft',
|
|
403
|
-
transitions: [
|
|
404
|
-
{ operation: 'PostQuotesQuoteFinalize', from: ['draft'], to: 'open', refusal: quoteRefusal('finalized'), source: 'https://docs.stripe.com/api/quotes/finalize' },
|
|
405
|
-
{ operation: 'PostQuotesQuoteAccept', from: ['open'], to: 'accepted', refusal: quoteRefusal('accepted'), source: 'https://docs.stripe.com/api/quotes/accept' },
|
|
406
|
-
{ operation: 'PostQuotesQuoteCancel', from: ['draft', 'open'], to: 'canceled', refusal: quoteRefusal('canceled'), source: 'https://docs.stripe.com/api/quotes/cancel' },
|
|
407
|
-
// an open quote not accepted by its expires_at is canceled
|
|
408
|
-
// (Stripe cancels an open quote at its expires_at; the twin keeps it open)
|
|
409
|
-
],
|
|
410
|
-
};
|
|
411
|
-
const setBy = (operation, values, source) => values.map((to) => ({ operation, from: '*', to, source }));
|
|
412
|
-
/** An Issuing authorization's `status`: approve and decline close a pending one, once; a capture
|
|
413
|
-
* closes it, or leaves it pending when told not to close. */
|
|
414
|
-
const issuingAuthorizationStatus = {
|
|
415
|
-
initial: 'pending',
|
|
416
|
-
transitions: [
|
|
417
|
-
// approving keeps it pending (approved) until the merchant captures; declining closes it
|
|
418
|
-
{ operation: 'PostIssuingAuthorizationsAuthorizationApprove', from: ['pending'], refusal: { status: 400, code: 'authorization_already_finalized', message: 'This authorization has already been finalized (status {from}).' }, source: 'https://docs.stripe.com/issuing/purchases/authorizations' },
|
|
419
|
-
{ operation: 'PostIssuingAuthorizationsAuthorizationDecline', from: ['pending'], to: 'closed', refusal: { status: 400, code: 'authorization_already_finalized', message: 'This authorization has already been finalized (status {from}).' }, source: 'https://docs.stripe.com/api/issuing/authorizations/decline' },
|
|
420
|
-
{ operation: 'PostTestHelpersIssuingAuthorizationsAuthorizationCapture', from: ['pending'], to: 'closed', source: 'https://docs.stripe.com/api/issuing/authorizations/test_mode_capture' },
|
|
421
|
-
{ operation: 'PostTestHelpersIssuingAuthorizationsAuthorizationCapture', from: ['pending'], source: 'https://docs.stripe.com/api/issuing/authorizations/test_mode_capture' },
|
|
422
|
-
// a real-time request no one answered is decided when its window ends: "If Stripe doesn't receive your approve or
|
|
423
|
-
// decline response within 2 seconds, the Authorization is automatically approved or declined based on your timeout
|
|
424
|
-
// settings" (semantics/issuing.ts lapseRealtimeRequests)
|
|
425
|
-
by('time', ['pending'], 'closed', 'https://docs.stripe.com/issuing/controls/real-time-authorizations'),
|
|
426
|
-
// (Stripe also closes, reverses and expires one as the merchant and the clock act; in test mode the
|
|
427
|
-
// capture helper above closes it, and the twin serves no other)
|
|
428
|
-
],
|
|
429
|
-
};
|
|
430
|
-
/** A Treasury flow's `status` as the twin's own operations move it: only a processing flow cancels. */
|
|
431
|
-
const flowCancel = (operation, code, name, network) => ({
|
|
432
|
-
initial: 'processing',
|
|
433
|
-
transitions: [
|
|
434
|
-
{ operation, from: ['processing'], to: 'canceled', refusal: { status: 400, code, message: `This ${name} cannot be canceled because it is no longer processing.` }, source: 'https://docs.stripe.com/api/treasury' },
|
|
435
|
-
...network,
|
|
436
|
-
],
|
|
437
|
-
});
|
|
438
|
-
/** An outbound flow on the network: Stripe posts or fails it and a posted one may come back returned (in
|
|
439
|
-
* test mode by test helpers the twin does not serve), so none of those moves is the twin's. */
|
|
440
|
-
const outbound = (_doc) => [];
|
|
1
|
+
import { data, values } from "./semantics/events.js";
|
|
2
|
+
import { STRIPE_EVENTS } from "./semantics/shared.js";
|
|
3
|
+
import { states } from "./semantics/states.js";
|
|
441
4
|
export const manifest = {
|
|
442
5
|
vendor: 'stripe',
|
|
443
6
|
service: 'stripe',
|
|
444
7
|
body: { form: { coerce: true } },
|
|
445
8
|
ids: { template: '{prefix}_twin_{n}', acceptProvided: true },
|
|
446
|
-
// on declared resources, but never served by the twin: Stripe's unknown-URL answer
|
|
447
9
|
unmodeled: [
|
|
448
10
|
'DeleteAccountsAccountBankAccountsId',
|
|
11
|
+
'DeleteAccountsAccountExternalAccountsId',
|
|
449
12
|
'DeleteAccountsAccountPeoplePerson',
|
|
13
|
+
'DeleteAccountsAccountPersonsPerson',
|
|
14
|
+
'DeleteCouponsCoupon',
|
|
15
|
+
'DeleteCustomersCustomerSourcesId',
|
|
450
16
|
'DeleteCustomersCustomerSubscriptionsSubscriptionExposedId',
|
|
17
|
+
'DeleteCustomersCustomerTaxIdsId',
|
|
18
|
+
'DeleteEphemeralKeysKey',
|
|
19
|
+
'DeleteInvoiceitemsInvoiceitem',
|
|
20
|
+
'DeleteInvoicesInvoice',
|
|
21
|
+
'DeleteProductsId',
|
|
22
|
+
'DeleteProductsProductFeaturesId',
|
|
23
|
+
'DeleteRadarValueListItemsItem',
|
|
24
|
+
'DeleteRadarValueListsValueList',
|
|
25
|
+
'DeleteSubscriptionItemsItem',
|
|
451
26
|
'DeleteTaxIdsId',
|
|
27
|
+
'DeleteTerminalConfigurationsConfiguration',
|
|
28
|
+
'DeleteTerminalLocationsLocation',
|
|
29
|
+
'DeleteTerminalReadersReader',
|
|
30
|
+
'DeleteTestHelpersTestClocksTestClock',
|
|
31
|
+
'DeleteWebhookEndpointsWebhookEndpoint',
|
|
452
32
|
'GetAccountsAccountBankAccountsId',
|
|
33
|
+
'GetAccountsAccountCapabilities',
|
|
34
|
+
'GetAccountsAccountCapabilitiesCapability',
|
|
35
|
+
'GetAccountsAccountExternalAccountsId',
|
|
453
36
|
'GetAccountsAccountPeople',
|
|
454
37
|
'GetAccountsAccountPeoplePerson',
|
|
38
|
+
'GetAccountsAccountPersonsPerson',
|
|
455
39
|
'GetApplicationFeesFeeRefundsId',
|
|
40
|
+
'GetApplicationFeesId',
|
|
41
|
+
'GetAppsSecrets',
|
|
456
42
|
'GetBalanceHistory',
|
|
457
43
|
'GetBalanceHistoryId',
|
|
44
|
+
'GetBalanceTransactionsId',
|
|
45
|
+
'GetBillingAlertsId',
|
|
46
|
+
'GetBillingCreditGrantsId',
|
|
47
|
+
'GetBillingMetersId',
|
|
48
|
+
'GetBillingPortalConfigurationsConfiguration',
|
|
458
49
|
'GetChargesChargeDispute',
|
|
50
|
+
'GetChargesChargeRefunds',
|
|
51
|
+
'GetChargesChargeRefundsRefund',
|
|
52
|
+
'GetClimateOrdersOrder',
|
|
53
|
+
'GetCreditNotesId',
|
|
54
|
+
'GetCreditNotesPreview',
|
|
55
|
+
'GetCustomersCustomerBalanceTransactionsTransaction',
|
|
56
|
+
'GetCustomersCustomerCashBalanceTransactionsTransaction',
|
|
57
|
+
'GetCustomersCustomerPaymentMethods',
|
|
58
|
+
'GetCustomersCustomerPaymentMethodsPaymentMethod',
|
|
59
|
+
'GetCustomersCustomerSourcesId',
|
|
459
60
|
'GetCustomersCustomerSubscriptions',
|
|
460
61
|
'GetCustomersCustomerSubscriptionsSubscriptionExposedId',
|
|
461
|
-
'
|
|
62
|
+
'GetCustomersCustomerTaxIds',
|
|
63
|
+
'GetCustomersCustomerTaxIdsId',
|
|
64
|
+
'GetDisputesDispute',
|
|
65
|
+
'GetEntitlementsActiveEntitlements',
|
|
66
|
+
'GetEntitlementsFeaturesId',
|
|
67
|
+
'GetEventsId',
|
|
462
68
|
'GetFileLinksLink',
|
|
69
|
+
'GetFilesFile',
|
|
70
|
+
'GetFinancialConnectionsAccountsAccount',
|
|
71
|
+
'GetFinancialConnectionsSessionsSession',
|
|
72
|
+
'GetFinancialConnectionsTransactions',
|
|
463
73
|
'GetFinancialConnectionsTransactionsTransaction',
|
|
464
|
-
'
|
|
74
|
+
'GetIdentityVerificationReportsReport',
|
|
75
|
+
'GetIdentityVerificationSessionsSession',
|
|
76
|
+
'GetInvoiceitemsInvoiceitem',
|
|
77
|
+
'GetInvoicesInvoiceLines',
|
|
78
|
+
'GetIssuingAuthorizationsAuthorization',
|
|
79
|
+
'GetIssuingCardholdersCardholder',
|
|
80
|
+
'GetIssuingDisputesDispute',
|
|
81
|
+
'GetIssuingPersonalizationDesignsPersonalizationDesign',
|
|
82
|
+
'GetIssuingTransactionsTransaction',
|
|
465
83
|
'GetLinkAccountSessionsSession',
|
|
466
84
|
'GetLinkedAccounts',
|
|
467
85
|
'GetLinkedAccountsAccount',
|
|
86
|
+
'GetMandatesMandate',
|
|
87
|
+
'GetPaymentIntentsIntent',
|
|
88
|
+
'GetPaymentIntentsSearch',
|
|
89
|
+
'GetPaymentLinksPaymentLink',
|
|
90
|
+
'GetPayoutsPayout',
|
|
91
|
+
'GetProductsId',
|
|
92
|
+
'GetProductsProductFeaturesId',
|
|
93
|
+
'GetProductsSearch',
|
|
94
|
+
'GetQuotesQuote',
|
|
95
|
+
'GetRadarValueListItems',
|
|
96
|
+
'GetRadarValueListItemsItem',
|
|
97
|
+
'GetRadarValueListsValueList',
|
|
98
|
+
'GetRefundsRefund',
|
|
99
|
+
'GetReportingReportRunsReportRun',
|
|
100
|
+
'GetReviewsReview',
|
|
101
|
+
'GetSetupIntentsIntent',
|
|
102
|
+
'GetSourcesSource',
|
|
103
|
+
'GetSubscriptionItems',
|
|
104
|
+
'GetSubscriptionItemsItem',
|
|
105
|
+
'GetSubscriptionSchedulesSchedule',
|
|
106
|
+
'GetSubscriptionsSearch',
|
|
107
|
+
'GetTaxCalculationsCalculation',
|
|
468
108
|
'GetTaxIdsId',
|
|
109
|
+
'GetTaxRatesTaxRate',
|
|
110
|
+
'GetTaxRegistrationsId',
|
|
111
|
+
'GetTaxTransactionsTransaction',
|
|
112
|
+
'GetTerminalConfigurationsConfiguration',
|
|
113
|
+
'GetTerminalLocationsLocation',
|
|
114
|
+
'GetTerminalReadersReader',
|
|
115
|
+
'GetTestHelpersTestClocks',
|
|
116
|
+
'GetTestHelpersTestClocksTestClock',
|
|
117
|
+
'GetTokensToken',
|
|
118
|
+
'GetTopups',
|
|
119
|
+
'GetTopupsTopup',
|
|
120
|
+
'GetTransfersTransfer',
|
|
469
121
|
'GetTransfersTransferReversalsId',
|
|
122
|
+
'GetTreasuryFinancialAccountsFinancialAccount',
|
|
123
|
+
'GetTreasuryInboundTransfers',
|
|
124
|
+
'GetTreasuryInboundTransfersId',
|
|
125
|
+
'GetTreasuryOutboundPayments',
|
|
126
|
+
'GetTreasuryOutboundPaymentsId',
|
|
127
|
+
'GetTreasuryOutboundTransfers',
|
|
128
|
+
'GetTreasuryOutboundTransfersOutboundTransfer',
|
|
129
|
+
'GetTreasuryReceivedCredits',
|
|
130
|
+
'GetTreasuryReceivedCreditsId',
|
|
131
|
+
'GetTreasuryReceivedDebits',
|
|
132
|
+
'GetTreasuryReceivedDebitsId',
|
|
133
|
+
'GetTreasuryTransactionEntries',
|
|
134
|
+
'GetTreasuryTransactionEntriesId',
|
|
135
|
+
'GetTreasuryTransactions',
|
|
136
|
+
'GetTreasuryTransactionsId',
|
|
137
|
+
'GetWebhookEndpointsWebhookEndpoint',
|
|
138
|
+
'PostAccountsAccount',
|
|
470
139
|
'PostAccountsAccountBankAccounts',
|
|
471
140
|
'PostAccountsAccountBankAccountsId',
|
|
141
|
+
'PostAccountsAccountCapabilitiesCapability',
|
|
142
|
+
'PostAccountsAccountExternalAccounts',
|
|
472
143
|
'PostAccountsAccountExternalAccountsId',
|
|
473
144
|
'PostAccountsAccountPeople',
|
|
474
145
|
'PostAccountsAccountPeoplePerson',
|
|
146
|
+
'PostAccountsAccountPersons',
|
|
147
|
+
'PostAccountsAccountPersonsPerson',
|
|
475
148
|
'PostApplicationFeesFeeRefundsId',
|
|
149
|
+
'PostApplicationFeesIdRefunds',
|
|
150
|
+
'PostBillingAlerts',
|
|
151
|
+
'PostBillingAlertsIdActivate',
|
|
152
|
+
'PostBillingAlertsIdArchive',
|
|
153
|
+
'PostBillingAlertsIdDeactivate',
|
|
154
|
+
'PostBillingCreditGrants',
|
|
155
|
+
'PostBillingCreditGrantsId',
|
|
156
|
+
'PostBillingMeters',
|
|
476
157
|
'PostBillingMetersId',
|
|
158
|
+
'PostBillingMetersIdDeactivate',
|
|
159
|
+
'PostBillingMetersIdReactivate',
|
|
160
|
+
'PostBillingPortalConfigurationsConfiguration',
|
|
161
|
+
'PostCharges',
|
|
162
|
+
'PostChargesCharge',
|
|
163
|
+
'PostChargesChargeCapture',
|
|
164
|
+
'PostChargesChargeRefunds',
|
|
165
|
+
'PostChargesChargeRefundsRefund',
|
|
166
|
+
'PostCheckoutSessionsSession',
|
|
167
|
+
'PostCheckoutSessionsSessionExpire',
|
|
168
|
+
'PostClimateOrders',
|
|
169
|
+
'PostClimateOrdersOrder',
|
|
170
|
+
'PostClimateOrdersOrderCancel',
|
|
171
|
+
'PostCouponsCoupon',
|
|
172
|
+
'PostCreditNotes',
|
|
173
|
+
'PostCreditNotesId',
|
|
174
|
+
'PostCreditNotesIdVoid',
|
|
175
|
+
'PostCustomersCustomerBalanceTransactions',
|
|
477
176
|
'PostCustomersCustomerBalanceTransactionsTransaction',
|
|
177
|
+
'PostCustomersCustomerSources',
|
|
478
178
|
'PostCustomersCustomerSubscriptions',
|
|
479
179
|
'PostCustomersCustomerSubscriptionsSubscriptionExposedId',
|
|
180
|
+
'PostCustomersCustomerTaxIds',
|
|
181
|
+
'PostDisputesDispute',
|
|
182
|
+
'PostDisputesDisputeClose',
|
|
183
|
+
'PostEntitlementsFeatures',
|
|
184
|
+
'PostEntitlementsFeaturesId',
|
|
185
|
+
'PostFileLinks',
|
|
480
186
|
'PostFileLinksLink',
|
|
187
|
+
'PostFiles',
|
|
188
|
+
'PostFinancialConnectionsAccountsAccountDisconnect',
|
|
189
|
+
'PostFinancialConnectionsSessions',
|
|
190
|
+
'PostIdentityVerificationSessions',
|
|
481
191
|
'PostIdentityVerificationSessionsSession',
|
|
192
|
+
'PostInvoiceitems',
|
|
193
|
+
'PostInvoiceitemsInvoiceitem',
|
|
482
194
|
'PostInvoicesInvoice',
|
|
195
|
+
'PostInvoicesInvoiceFinalize',
|
|
196
|
+
'PostInvoicesInvoiceMarkUncollectible',
|
|
197
|
+
'PostInvoicesInvoiceSend',
|
|
198
|
+
'PostIssuingAuthorizationsAuthorization',
|
|
199
|
+
'PostIssuingCardholdersCardholder',
|
|
200
|
+
'PostIssuingDisputes',
|
|
201
|
+
'PostIssuingDisputesDispute',
|
|
202
|
+
'PostIssuingDisputesDisputeSubmit',
|
|
203
|
+
'PostIssuingPersonalizationDesigns',
|
|
204
|
+
'PostIssuingPersonalizationDesignsPersonalizationDesign',
|
|
205
|
+
'PostIssuingTransactionsTransaction',
|
|
483
206
|
'PostLinkAccountSessions',
|
|
207
|
+
'PostPaymentIntentsIntent',
|
|
208
|
+
'PostPaymentIntentsIntentApplyCustomerBalance',
|
|
209
|
+
'PostPaymentIntentsIntentCapture',
|
|
210
|
+
'PostPaymentIntentsIntentConfirm',
|
|
211
|
+
'PostPaymentIntentsIntentIncrementAuthorization',
|
|
212
|
+
'PostPaymentIntentsIntentVerifyMicrodeposits',
|
|
213
|
+
'PostPaymentLinks',
|
|
214
|
+
'PostPaymentLinksPaymentLink',
|
|
215
|
+
'PostPaymentMethods',
|
|
484
216
|
'PostPaymentMethodsPaymentMethod',
|
|
217
|
+
'PostPaymentMethodsPaymentMethodAttach',
|
|
485
218
|
'PostPayoutsPayout',
|
|
219
|
+
'PostPayoutsPayoutCancel',
|
|
220
|
+
'PostPlans',
|
|
221
|
+
'PostPricesPrice',
|
|
222
|
+
'PostProductsId',
|
|
223
|
+
'PostProductsProductFeatures',
|
|
224
|
+
'PostQuotes',
|
|
486
225
|
'PostQuotesQuote',
|
|
226
|
+
'PostQuotesQuoteAccept',
|
|
227
|
+
'PostQuotesQuoteCancel',
|
|
228
|
+
'PostQuotesQuoteFinalize',
|
|
229
|
+
'PostRadarValueLists',
|
|
230
|
+
'PostRadarValueListsValueList',
|
|
231
|
+
'PostRefundsRefund',
|
|
232
|
+
'PostRefundsRefundCancel',
|
|
233
|
+
'PostReportingReportRuns',
|
|
234
|
+
'PostReviewsReviewApprove',
|
|
235
|
+
'PostSetupIntents',
|
|
236
|
+
'PostSetupIntentsIntent',
|
|
237
|
+
'PostSetupIntentsIntentCancel',
|
|
238
|
+
'PostSetupIntentsIntentConfirm',
|
|
239
|
+
'PostSetupIntentsIntentVerifyMicrodeposits',
|
|
240
|
+
'PostSources',
|
|
241
|
+
'PostSourcesSource',
|
|
242
|
+
'PostSubscriptionItems',
|
|
243
|
+
'PostSubscriptionItemsItem',
|
|
244
|
+
'PostSubscriptionSchedules',
|
|
245
|
+
'PostSubscriptionSchedulesSchedule',
|
|
246
|
+
'PostSubscriptionSchedulesScheduleCancel',
|
|
247
|
+
'PostSubscriptionSchedulesScheduleRelease',
|
|
248
|
+
'PostSubscriptions',
|
|
249
|
+
'PostTaxCalculations',
|
|
250
|
+
'PostTaxIds',
|
|
251
|
+
'PostTaxRates',
|
|
252
|
+
'PostTaxRatesTaxRate',
|
|
253
|
+
'PostTaxRegistrations',
|
|
487
254
|
'PostTaxRegistrationsId',
|
|
255
|
+
'PostTerminalConfigurations',
|
|
256
|
+
'PostTerminalConfigurationsConfiguration',
|
|
257
|
+
'PostTerminalLocations',
|
|
258
|
+
'PostTerminalLocationsLocation',
|
|
259
|
+
'PostTerminalReaders',
|
|
260
|
+
'PostTerminalReadersReader',
|
|
261
|
+
'PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate',
|
|
262
|
+
'PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate',
|
|
263
|
+
'PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject',
|
|
264
|
+
'PostTestHelpersTestClocks',
|
|
265
|
+
'PostTestHelpersTestClocksTestClockAdvance',
|
|
266
|
+
'PostTestHelpersTreasuryInboundTransfersIdSucceed',
|
|
267
|
+
'PostTokens',
|
|
268
|
+
'PostTopups',
|
|
269
|
+
'PostTopupsTopup',
|
|
270
|
+
'PostTopupsTopupCancel',
|
|
271
|
+
'PostTransfersIdReversals',
|
|
272
|
+
'PostTransfersTransfer',
|
|
488
273
|
'PostTransfersTransferReversalsId',
|
|
274
|
+
'PostTreasuryFinancialAccounts',
|
|
275
|
+
'PostTreasuryFinancialAccountsFinancialAccount',
|
|
276
|
+
'PostTreasuryInboundTransfers',
|
|
277
|
+
'PostTreasuryInboundTransfersInboundTransferCancel',
|
|
278
|
+
'PostTreasuryOutboundPayments',
|
|
279
|
+
'PostTreasuryOutboundPaymentsIdCancel',
|
|
280
|
+
'PostTreasuryOutboundTransfers',
|
|
281
|
+
'PostTreasuryOutboundTransfersOutboundTransferCancel',
|
|
282
|
+
'PostWebhookEndpointsWebhookEndpoint',
|
|
489
283
|
],
|
|
490
284
|
time: 'unix',
|
|
491
285
|
error: { error: { type: '{kind}', message: '{message}', code: '{code}', param: '{param}' } },
|
|
@@ -497,6 +291,10 @@ export const manifest = {
|
|
|
497
291
|
pattern: '^\\d{4}-\\d{2}-\\d{2}(\\.[a-z_]+)?$',
|
|
498
292
|
error: { status: 400, kind: 'invalid_request_error', code: 'invalid_api_version', message: 'Invalid Stripe version: {value}. Check the API version reference: https://stripe.com/docs/api/versioning' },
|
|
499
293
|
},
|
|
294
|
+
// source: https://github.com/stripe/stripe-mock/issues/31 "Unrecognized request URL (GET: /v1/test)."
|
|
295
|
+
// source: spec:/components/schemas/api_errors/properties/type "invalid_request_error"
|
|
296
|
+
// Stripe's published API answer, shown by its maintainer for an unknown URL.
|
|
297
|
+
gap: { status: 404, kind: 'invalid_request_error', message: 'Unrecognized request URL ({method}: {path}). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.' },
|
|
500
298
|
notFound: { status: 404, kind: 'invalid_request_error', code: 'resource_missing', message: "No such {object}: '{id}'" },
|
|
501
299
|
list: {
|
|
502
300
|
style: 'envelope',
|
|
@@ -516,555 +314,359 @@ export const manifest = {
|
|
|
516
314
|
message: 'Keys for idempotent requests can only be used with the same parameters they were originally used with. Provide a new idempotency key, or use the original parameters that were used with this key.',
|
|
517
315
|
},
|
|
518
316
|
},
|
|
317
|
+
// the pack as the World registers it (world-core packRegistry)
|
|
318
|
+
// the fail-closed ceiling on live calls against Stripe (world-core rateBudget.ts, architecture D8), inside its sandbox
|
|
319
|
+
// allowance
|
|
320
|
+
// source: https://docs.stripe.com/rate-limits "25 requests per second"
|
|
321
|
+
rateBudget: {
|
|
322
|
+
// the vendor's documented allowance this budget stays inside (cited above)
|
|
323
|
+
allowance: { perMinute: 1500, source: 'https://docs.stripe.com/rate-limits' },
|
|
324
|
+
windowMs: 60_000,
|
|
325
|
+
ceiling: 120,
|
|
326
|
+
defaultWeight: 1,
|
|
327
|
+
maxRetryAfterSeconds: 300,
|
|
328
|
+
rules: [
|
|
329
|
+
{ match: '^POST /v1/payouts$', weight: 5 },
|
|
330
|
+
{ match: '^(POST|DELETE) ', weight: 2 },
|
|
331
|
+
],
|
|
332
|
+
reason: 'Stripe documents scalar limits (docs.stripe.com/rate-limits, read 2026-07-26): 100 requests/second in live mode, 25/second in ' +
|
|
333
|
+
'sandbox, 25/second for an individual endpoint unless noted, 15 payout creates/second; over it, 429 with a Stripe-Rate-Limited-Reason ' +
|
|
334
|
+
'header. 120 weighted units / 60s is 2 requests/second, 2% of live mode and 8% of the tightest general limit. POST/DELETE cost 2, a ' +
|
|
335
|
+
'judgement about blast radius (a write creates a charge, refund or receipt e-mail and cannot be taken back), not a published ratio; ' +
|
|
336
|
+
"POST /v1/payouts costs 5 because payout creation is documented at 15/second. Stripe's own window is a second, so an intra-second " +
|
|
337
|
+
'burst reaches its limiter first; the 429 cooldown is the backstop for that shape.',
|
|
338
|
+
},
|
|
339
|
+
descriptor: {
|
|
340
|
+
protocol: '3',
|
|
341
|
+
transport: 'rest',
|
|
342
|
+
archetype: 'crud',
|
|
343
|
+
bin: 'world-stripe',
|
|
344
|
+
resources: ['charge', 'customer', 'payment_intent', 'setup_intent', 'payment_method', 'subscription', 'price', 'product', 'invoice', 'invoiceitem', 'refund', 'event'],
|
|
345
|
+
specSource: "Stripe's OpenAPI document (spec/, provenance in spec/SOURCE.md)",
|
|
346
|
+
description: 'Stripe REST twin — spec-correct shapes, signed events, and the hosted pages an application sends people through.',
|
|
347
|
+
// Stripe.js calls the same-origin '/v1/…' and loads from api.stripe.com — the dev proxy forwards '/v1/' to the twin
|
|
348
|
+
// and strips the absolute host so calls come back same-origin
|
|
349
|
+
browserRouting: { apiPathPrefix: '/v1/', loaderHost: 'https://api.stripe.com' },
|
|
350
|
+
// the official server SDK and its Python bindings, and the STRIPE_* credential stems (NEXT_PRIVATE_STRIPE_* too);
|
|
351
|
+
// `stripeconnect` is deliberately not claimed: no Connect-only credential stem is modelled
|
|
352
|
+
adoption: { pypi: ['stripe'], sdks: ['stripe'], envStems: ['STRIPE', 'NEXTPRIVATESTRIPE'] },
|
|
353
|
+
// the API and the screens' hosts, each claimed for the paths its screens serve: an application that sends a person
|
|
354
|
+
// to one of their urls lands in the World; any other path on a claimed host is refused in a World rather than sent
|
|
355
|
+
// to the real Stripe
|
|
356
|
+
// a World's applications hold the platform's keys the dashboard shows (the credential door), never fixtures: the API
|
|
357
|
+
// refuses a key Stripe did not issue
|
|
358
|
+
credentialDoor: { path: '/_twin/app-credentials', body: {}, fill: { STRIPE_SECRET_KEY: 'secret_key', STRIPE_API_KEY: 'secret_key', STRIPE_PRIVATE_KEY: 'secret_key', BILLING_STRIPE_API_KEY: 'secret_key', STRIPE_PUBLISHABLE_KEY: 'publishable_key', NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: 'publishable_key', NEXT_PUBLIC_STRIPE_PUBLIC_KEY: 'publishable_key', NEXT_PUBLIC_STRIPE_KEY: 'publishable_key', STRIPE_WEBHOOK_SECRET: 'webhook_secret', STRIPE_WEBHOOK_SIGNING_SECRET: 'webhook_secret', STRIPE_ENDPOINT_SECRET: 'webhook_secret', STRIPE_WEBHOOK_SECRET_KEY: 'webhook_secret', NEXT_PRIVATE_STRIPE_WEBHOOK_SECRET: 'webhook_secret', BILLING_STRIPE_WEBHOOK_SECRET: 'webhook_secret', STRIPE_CONNECT_WEBHOOK_SECRET: 'connect_webhook_secret', STRIPE_WEBHOOK_SECRET_CONNECT: 'connect_webhook_secret', STRIPE_CONNECT_WEBHOOK_SIGNING_SECRET: 'connect_webhook_secret' } },
|
|
359
|
+
hosts: [
|
|
360
|
+
{ host: 'api.stripe.com' }, { host: 'checkout.stripe.com', pathPattern: '^/c/pay/' }, { host: 'billing.stripe.com', pathPattern: '^/p/session/' },
|
|
361
|
+
{ host: 'connect.stripe.com', pathPattern: '^/setup/' },
|
|
362
|
+
{ host: 'dashboard.stripe.com', pathPattern: '^/radar/lists(?:/[^/]+)?/?$|^/test/issuing/balance/?$|^/settings/public/?$' },
|
|
363
|
+
{ host: 'verify.stripe.com', pathPattern: '^/start/' },
|
|
364
|
+
{ host: 'js.stripe.com', pathPattern: '^/v3/?$|^/(v3|[a-z]+)/stripe\\.js$' },
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
// what GET /twin says this twin is
|
|
368
|
+
discovery: {
|
|
369
|
+
twinOf: 'the Stripe REST API, Checkout, the customer portal, Connect onboarding, and Stripe.js',
|
|
370
|
+
stores: 'customers, payment objects, checkout sessions, products and prices, subscriptions and invoices, Connect accounts, Issuing, and signed events',
|
|
371
|
+
},
|
|
372
|
+
// the World's doors (./semantics/doors.ts): what stands in for an act Stripe's API does not have
|
|
373
|
+
doors: [
|
|
374
|
+
{ id: 'account', method: 'POST', path: '/_twin/account', note: "the platform's own account settings, as the Dashboard changes them" },
|
|
375
|
+
{ id: 'appCredentials', method: 'POST', path: '/_twin/app-credentials', note: 'the platform\'s API keys (secret and publishable), as the runtime issues them' },
|
|
376
|
+
{ id: 'webhookEndpoints', method: 'POST', path: '/_twin/webhook-endpoints', note: '{ url, events, connect? }: an endpoint added on the Dashboard\'s Webhooks page, signed with the secret the World\'s application holds' },
|
|
377
|
+
{ id: 'drain', method: 'POST', path: '/_twin/drain', note: "time's events, sent when a runner drives them: payouts paid and funds made available" },
|
|
378
|
+
],
|
|
519
379
|
// The screens applications and people reach (docs/contributing/architecture.md, "Screens"). Demand is the
|
|
520
|
-
//
|
|
380
|
+
// applications' code that sends a customer to the page (journeys/demand.json).
|
|
521
381
|
screens: [
|
|
382
|
+
{ id: 'checkout-js', kind: 'content', host: 'api.stripe.com', path: '/v1/payment_pages/{session}', takes: ['POST'], status: 'done', source: 'https://docs.stripe.com/payments/advanced', demand: 'Postiz CheckoutProvider: the published Stripe.js contract over the session store; the private wire is authored (screens/checkout-js.ts).' },
|
|
522
383
|
{
|
|
523
384
|
id: 'checkout', kind: 'flow', host: 'checkout.stripe.com', path: '/c/pay/{session}', status: 'done',
|
|
524
|
-
demand: '
|
|
385
|
+
demand: 'Dub, Rallly, Postiz and Twenty send customers to Checkout (journeys/demand.json)',
|
|
525
386
|
controls: ['email', 'cardNumber', 'cardExpiry', 'cardCvc', 'billingName', 'billingCountry', 'billingPostalCode', 'Pay', '← Back'],
|
|
526
387
|
source: 'https://docs.stripe.com/payments/checkout/how-checkout-works',
|
|
527
388
|
},
|
|
528
389
|
{
|
|
529
390
|
id: 'billing-portal', kind: 'flow', host: 'billing.stripe.com', path: '/p/session/{session}', status: 'done',
|
|
530
|
-
demand: '
|
|
391
|
+
demand: 'Cal.com, Dub, Postiz, Rallly and Twenty send customers to the billing portal', controls: ['Cancel plan', 'Renew plan', '← Return to {business name}'],
|
|
531
392
|
source: 'https://docs.stripe.com/customer-management',
|
|
532
393
|
},
|
|
533
394
|
{
|
|
534
|
-
|
|
535
|
-
|
|
395
|
+
// an Account Link's url (/setup/{account_link}) opens the onboarding session the page is (/setup/s/{session})
|
|
396
|
+
id: 'connect-onboarding', kind: 'flow', host: 'connect.stripe.com', path: '/setup', status: 'done',
|
|
397
|
+
demand: "Dub onboards its partners' connected accounts with Account Links", controls: ['Agree and submit', '← Return to platform'],
|
|
536
398
|
source: 'https://docs.stripe.com/connect/hosted-onboarding',
|
|
537
399
|
},
|
|
538
400
|
{
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
401
|
+
// Stripe.js, the client library an application's page loads: /v3/, /v3/stripe.js and /<release train>/stripe.js
|
|
402
|
+
id: 'stripe-js', kind: 'content', host: 'js.stripe.com', path: '/', status: 'done',
|
|
403
|
+
demand: "Dub's upgrade button loads Stripe.js and calls redirectToCheckout",
|
|
404
|
+
source: 'https://docs.stripe.com/js',
|
|
542
405
|
},
|
|
543
406
|
{
|
|
544
|
-
id: '
|
|
545
|
-
demand: '
|
|
546
|
-
source: 'https://docs.stripe.com/
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
id: 'financial-connections', kind: 'flow', host: 'js.stripe.com', path: '/v3/financial-connections/{client_secret}', status: 'done',
|
|
550
|
-
demand: 'a linked bank account exists only once its holder links it here', controls: ['Link accounts', 'Cancel'],
|
|
551
|
-
source: 'https://docs.stripe.com/js/financial_connections/collect_financial_connections_accounts',
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
id: 'dashboard', kind: 'workspace', host: 'dashboard.stripe.com', path: '/test/{section}; /settings/public; /settings/connect/onboarding-options/oauth', status: 'done',
|
|
555
|
-
demand: 'testers and agents inspect payments, customers and subscriptions; an operator sets the business name Checkout shows (Public details) and a Connect platform its OAuth client_id and redirect URIs',
|
|
556
|
-
controls: ['Business name', 'Save', 'Enable OAuth for Standard accounts', 'Redirect URIs'], source: 'https://docs.stripe.com/dashboard/basics',
|
|
407
|
+
id: 'dashboard', kind: 'workspace', host: 'dashboard.stripe.com', path: '/', status: 'done',
|
|
408
|
+
demand: 'Operator setup for the cited application calls: Public details; Radar lists for Dub add-to-stripe-fraud-value-lists.ts:3-7; sandbox funding for Open Autonomy world/model/scenario.ts:60,62',
|
|
409
|
+
controls: ['Business name', 'Save', 'New list', 'Name', 'Alias', 'List type', 'Add', 'Add test funds', 'Amount'], source: 'https://docs.stripe.com/dashboard/basics',
|
|
557
410
|
},
|
|
558
411
|
],
|
|
559
412
|
resources: {
|
|
560
|
-
'billing.meter': {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
},
|
|
568
|
-
'billing.meter_event': { storedAs: 'billing_meter_event', idPrefix: 'mtr_evt' },
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
storedAs: 'billing_alert', idPrefix: 'alert', notFound: "No such alert: '{id}'",
|
|
572
|
-
state: { status: { initial: 'active', transitions: [
|
|
573
|
-
{ operation: 'PostBillingAlertsIdActivate', from: '*', to: 'active', source: 'https://docs.stripe.com/api/billing/alert/activate' },
|
|
574
|
-
{ operation: 'PostBillingAlertsIdDeactivate', from: '*', to: 'inactive', source: 'https://docs.stripe.com/api/billing/alert/deactivate' },
|
|
575
|
-
{ operation: 'PostBillingAlertsIdArchive', from: '*', to: 'archived', source: 'https://docs.stripe.com/api/billing/alert/archive' },
|
|
576
|
-
] } },
|
|
577
|
-
},
|
|
578
|
-
payment_intent: {
|
|
579
|
-
idPrefix: 'pi',
|
|
580
|
-
state: { status: paymentIntentStatus },
|
|
581
|
-
notState: ['cancellation_reason', 'capture_method', 'confirmation_method', 'setup_future_usage'],
|
|
413
|
+
'billing.meter': { refresh: { list: 'GetBillingMeters' },
|
|
414
|
+
// source: spec:/components/schemas/billing.meter/properties/status "active"
|
|
415
|
+
assigned: { object: { value: 'billing.meter' }, created: { now: true }, updated: { now: true }, livemode: { value: false }, status: { value: 'active' }, status_transitions: { value: { deactivated_at: null } },
|
|
416
|
+
// source: https://docs.stripe.com/api/billing/meter/create "stripe_customer_id"
|
|
417
|
+
// Where the page stops: omitted mappings use the creation example’s customer/value payload keys.
|
|
418
|
+
customer_mapping: { value: { type: 'by_id', event_payload_key: 'stripe_customer_id' } }, value_settings: { value: { event_payload_key: 'value' } } },
|
|
419
|
+
storedAs: 'billing_meter', idPrefix: 'mtr', notFound: "No such meter: '{id}'", ...states["billing.meter"], filters: ['status'],
|
|
420
|
+
},
|
|
421
|
+
'billing.meter_event': { refresh: { none: 'a meter event is written, never read: the API reads back only its meter’s summaries (GET /v1/billing/meters/{id}/event_summaries)' }, storedAs: 'billing_meter_event', idPrefix: 'mtr_evt' },
|
|
422
|
+
payment_intent: { refresh: { list: 'GetPaymentIntents' },
|
|
423
|
+
idPrefix: 'pi', ...states["payment_intent"],
|
|
582
424
|
embeds: { customer: 'customer', latest_charge: 'charge', payment_method: 'payment_method', invoice: 'invoice' },
|
|
583
425
|
filters: ['customer'],
|
|
584
426
|
},
|
|
585
427
|
// an update stores what it is given, nested objects whole, as the twin always has (Stripe merges
|
|
586
428
|
// metadata keys; `update: 'replace'` keeps the twin's answer)
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
429
|
+
// next_invoice_sequence, "The suffix of the customer's next invoice number" (docs.stripe.com/api/customers/object): one
|
|
430
|
+
// past its numbered invoices (a finalized invoice is never deleted)
|
|
431
|
+
customer: { refresh: { list: 'GetCustomers' }, idPrefix: 'cus', update: 'replace', ...states["customer"], filters: ['email'], counts: { next_invoice_sequence: { of: 'invoice', by: 'customer', present: 'number', plus: 1 } } },
|
|
432
|
+
customer_balance_transaction: { refresh: { list: 'GetCustomersCustomerBalanceTransactions' }, parent: { param: 'customer', field: 'customer', resource: 'customer' }, idPrefix: 'cbtxn', ...states["customer_balance_transaction"], },
|
|
433
|
+
customer_cash_balance_transaction: { refresh: { list: 'GetCustomersCustomerCashBalanceTransactions' }, parent: { param: 'customer', field: 'customer', resource: 'customer' }, storedAs: 'cash_balance_transaction', idPrefix: 'ccsbtxn', ...states["customer_cash_balance_transaction"], },
|
|
591
434
|
// a card is chargeable at once; any other source waits for its owner to authorize it through its
|
|
592
435
|
// flow, and is used up (single-use) or lapses
|
|
593
436
|
// what a customer's sources list answers (a card, a bank account, a Source, an account) as one
|
|
594
437
|
// resource over the stored sources; the card fields and an account's type/business_type are
|
|
595
438
|
// attributes. A customer's bank account verifies as a payout account does.
|
|
596
|
-
payment_source: {
|
|
439
|
+
payment_source: { refresh: { none: 'a customer’s sources are listed only per customer, cards, bank accounts and Sources together (GET /v1/customers/{customer}/sources); the twin keeps them among the Sources, which no list reads' },
|
|
597
440
|
storedAs: 'source',
|
|
598
|
-
idPrefix: 'src',
|
|
599
|
-
state: { status: bankAccountStatus('https://docs.stripe.com/api/customer_bank_accounts/object#customer_bank_account_object-status') },
|
|
600
|
-
notState: ['allow_redisplay', 'business_type', 'regulated_status', 'type'],
|
|
441
|
+
idPrefix: 'src', ...states["payment_source"],
|
|
601
442
|
},
|
|
602
|
-
source: {
|
|
603
|
-
idPrefix: 'src',
|
|
604
|
-
state: {
|
|
605
|
-
status: {
|
|
606
|
-
initial: 'chargeable',
|
|
607
|
-
transitions: [
|
|
608
|
-
// (Stripe makes a redirect source chargeable when the customer authorizes it on the bank's page;
|
|
609
|
-
// the twin has no such page, so a non-card source stays pending)
|
|
610
|
-
// Stripe also fails a source the customer abandons, consumes a single-use one once charged and
|
|
611
|
-
// cancels one left unused; the twin's sources stay chargeable
|
|
612
|
-
],
|
|
613
|
-
},
|
|
614
|
-
},
|
|
615
|
-
notState: ['allow_redisplay', 'type'],
|
|
443
|
+
source: { refresh: { none: 'Stripe lists no Sources: each is read by its id (GET /v1/sources/{source})' },
|
|
444
|
+
idPrefix: 'src', ...states["source"],
|
|
616
445
|
},
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
446
|
+
// Connect OAuth's authorization codes: the row's id minted, the code's value drawn from the World's secret
|
|
447
|
+
_oauth_code: { idPrefix: '', ids: '{n}' },
|
|
448
|
+
charge: { refresh: { list: 'GetCharges' },
|
|
449
|
+
idPrefix: 'ch', ...states["charge"],
|
|
620
450
|
embeds: { customer: 'customer', payment_intent: 'payment_intent', invoice: 'invoice', balance_transaction: 'balance_transaction' },
|
|
621
451
|
filters: ['customer', 'payment_intent'],
|
|
622
452
|
},
|
|
623
|
-
refund: {
|
|
453
|
+
refund: { refresh: { list: 'GetRefunds' },
|
|
624
454
|
idPrefix: 're',
|
|
625
|
-
update: 'replace',
|
|
626
|
-
state: { status: refundStatus },
|
|
627
|
-
notState: ['pending_reason', 'reason'],
|
|
455
|
+
update: 'replace', ...states["refund"],
|
|
628
456
|
embeds: { charge: 'charge', payment_intent: 'payment_intent', balance_transaction: 'balance_transaction' },
|
|
629
457
|
filters: ['charge', 'payment_intent'],
|
|
630
458
|
},
|
|
631
|
-
setup_intent: {
|
|
459
|
+
setup_intent: { refresh: { list: 'GetSetupIntents' },
|
|
632
460
|
idPrefix: 'seti',
|
|
633
|
-
update: 'replace',
|
|
634
|
-
state: { status: setupIntentStatus },
|
|
635
|
-
notState: ['cancellation_reason'],
|
|
461
|
+
update: 'replace', ...states["setup_intent"],
|
|
636
462
|
embeds: { customer: 'customer', payment_method: 'payment_method' },
|
|
637
463
|
filters: ['customer', 'payment_method'],
|
|
638
464
|
},
|
|
639
|
-
payment_method: {
|
|
640
|
-
subscription: {
|
|
641
|
-
idPrefix: 'sub',
|
|
642
|
-
state: { status: subscriptionStatus },
|
|
643
|
-
notState: ['collection_method'],
|
|
465
|
+
payment_method: { refresh: { list: 'GetPaymentMethods' }, idPrefix: 'pm', ...states["payment_method"], embeds: { customer: 'customer' }, filters: ['customer', 'type'] },
|
|
466
|
+
subscription: { refresh: { list: 'GetSubscriptions', complete: false },
|
|
467
|
+
idPrefix: 'sub', ...states["subscription"],
|
|
644
468
|
embeds: { customer: 'customer', latest_invoice: 'invoice', default_payment_method: 'payment_method', schedule: 'subscription_schedule' },
|
|
469
|
+
// source: spec:/components/schemas/subscription/properties/items/description "List of subscription items, each with an attached price."
|
|
470
|
+
// source: https://docs.stripe.com/api/subscriptions/object "subscription_items?subscription="
|
|
471
|
+
collections: { items: { resource: 'subscription_item', by: 'subscription', list: { object: 'list', has_more: false, url: '/v1/subscription_items?subscription={id}' } } },
|
|
645
472
|
filters: ['customer'],
|
|
646
473
|
},
|
|
647
|
-
subscription_item: {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
474
|
+
subscription_item: { refresh: { none: 'subscription items are listed only per subscription (the list requires subscription), and each subscription answers its items in full (subscription.items)' }, idPrefix: 'si',
|
|
475
|
+
// source: spec:/components/schemas/subscription_item/properties/price "price"
|
|
476
|
+
embeds: { price: 'price' }, alwaysEmbedded: ['price'] },
|
|
477
|
+
invoice: { refresh: { list: 'GetInvoices' },
|
|
478
|
+
idPrefix: 'in', ...states["invoice"],
|
|
652
479
|
embeds: { customer: 'customer', subscription: 'subscription', charge: 'charge', payment_intent: 'payment_intent' },
|
|
653
|
-
filters: ['customer', 'status', 'subscription'],
|
|
480
|
+
filters: ['customer', 'status', 'subscription', 'collection_method'],
|
|
654
481
|
},
|
|
655
|
-
invoiceitem: { idPrefix: 'ii', embeds: { customer: 'customer', price: 'price' }, filters: ['customer', 'invoice'], order: { field: 'date', direction: 'desc' } },
|
|
656
|
-
'checkout.session': {
|
|
482
|
+
invoiceitem: { refresh: { list: 'GetInvoiceitems' }, idPrefix: 'ii', embeds: { customer: 'customer', price: 'price' }, filters: ['customer', 'invoice'], order: { field: 'date', direction: 'desc' } },
|
|
483
|
+
'checkout.session': { refresh: { list: 'GetCheckoutSessions' },
|
|
657
484
|
storedAs: 'checkout_session',
|
|
658
|
-
idPrefix: 'cs',
|
|
659
|
-
state: { status: checkoutStatus, payment_status: checkoutPaymentStatus },
|
|
660
|
-
notState: ['billing_address_collection', 'customer_creation', 'locale', 'mode', 'origin_context', 'payment_method_collection', 'redirect_on_completion', 'submit_type', 'ui_mode'],
|
|
485
|
+
idPrefix: 'cs', ...states["checkout.session"],
|
|
661
486
|
filters: ['customer', 'payment_intent', 'subscription', 'status'],
|
|
662
487
|
// the objects a session links to, as its x-expandableFields name them
|
|
663
488
|
embeds: { customer: 'customer', invoice: 'invoice', payment_intent: 'payment_intent', payment_link: 'payment_link', setup_intent: 'setup_intent', subscription: 'subscription' },
|
|
664
489
|
},
|
|
665
|
-
ephemeral_key: { idPrefix: 'ephkey' },
|
|
490
|
+
ephemeral_key: { refresh: { none: 'an ephemeral key is answered once, by its create: the API has no read of one' }, idPrefix: 'ephkey' },
|
|
666
491
|
// a mandate's status is the network's to move; nothing here moves it
|
|
667
|
-
mandate: {
|
|
668
|
-
idPrefix: 'mandate',
|
|
669
|
-
state: {
|
|
670
|
-
status: {
|
|
671
|
-
initial: 'active',
|
|
672
|
-
transitions: [
|
|
673
|
-
// a single-use mandate is spent by its payment: inactive "The mandate was rejected, revoked, or previously
|
|
674
|
-
// used, and may not be used to initiate future payments" (semantics/payment-intents.ts settleBankDebits)
|
|
675
|
-
by('vendor', ['active'], 'inactive', 'https://docs.stripe.com/api/mandates/object'),
|
|
676
|
-
// (Stripe also activates a pending mandate and deactivates one revoked; the twin's are active when made)
|
|
677
|
-
],
|
|
678
|
-
},
|
|
679
|
-
},
|
|
680
|
-
notState: ['type'],
|
|
492
|
+
mandate: { refresh: { none: 'a mandate is read by its id (GET /v1/mandates/{mandate}): the API lists none' },
|
|
493
|
+
idPrefix: 'mandate', ...states["mandate"],
|
|
681
494
|
},
|
|
682
|
-
dispute: { idPrefix: 'dp', update: 'replace',
|
|
683
|
-
payout: {
|
|
495
|
+
dispute: { refresh: { list: 'GetDisputes' }, idPrefix: 'dp', update: 'replace', ...states["dispute"], embeds: { charge: 'charge', payment_intent: 'payment_intent' }, filters: ['charge', 'payment_intent'] },
|
|
496
|
+
payout: { refresh: { list: 'GetPayouts' }, idPrefix: 'po', ...states["payout"], embeds: { balance_transaction: 'balance_transaction', destination: 'account' } },
|
|
684
497
|
// the twin's ledger is seeded available; Stripe holds funds pending until their available_on
|
|
685
|
-
balance_transaction: {
|
|
686
|
-
idPrefix: 'txn',
|
|
687
|
-
state: { status: { initial: 'available', vendorInitial: 'pending', transitions: [by('time', ['pending'], 'available', 'https://docs.stripe.com/api/balance_transactions/object#balance_transaction_object-status')] } },
|
|
688
|
-
notState: ['balance_type', 'type'],
|
|
498
|
+
balance_transaction: { refresh: { list: 'GetBalanceTransactions' },
|
|
499
|
+
idPrefix: 'txn', ...states["balance_transaction"],
|
|
689
500
|
filters: ['type', 'currency'],
|
|
690
501
|
},
|
|
691
502
|
// a coupon lapses at its redeem_by: "Date after which the coupon can no longer be redeemed", and `valid` is
|
|
692
503
|
// "Taking account of the above properties, whether this coupon can still be applied to a customer" (the served
|
|
693
504
|
// spec's coupon); the twin keeps no redemption count, so max_redemptions never lapses one
|
|
694
|
-
coupon: {
|
|
695
|
-
idPrefix: 'coupon', update: 'replace',
|
|
696
|
-
state: { valid: { initial: true, transitions: [by('time', ['true'], 'false', 'spec:/components/schemas/coupon/properties/redeem_by "Date after which the coupon can no longer be redeemed."')] } },
|
|
505
|
+
coupon: { refresh: { list: 'GetCoupons' },
|
|
506
|
+
idPrefix: 'coupon', update: 'replace', ...states["coupon"],
|
|
697
507
|
},
|
|
698
508
|
// switched on and off by an update (Stripe also lapses one at expires_at or when fully redeemed; the
|
|
699
509
|
// twin keeps no redemption count or expiry)
|
|
700
|
-
|
|
510
|
+
// source: https://docs.stripe.com/changelog/clover/2025-09-30/polymorphic-coupon "When you retrieve Promotion Codes, they don’t auto-expand the promotion.coupon field"
|
|
511
|
+
// Before Clover the top-level coupon auto-expands; Clover omits that field in its view.
|
|
512
|
+
promotion_code: { embeds: { coupon: 'coupon' }, alwaysEmbedded: ['coupon'], refresh: { list: 'GetPromotionCodes' },
|
|
701
513
|
idPrefix: 'promo',
|
|
702
514
|
update: 'replace',
|
|
703
|
-
notFound: "No such promotion code: '{id}'",
|
|
704
|
-
state: {
|
|
705
|
-
active: {
|
|
706
|
-
initial: true,
|
|
707
|
-
transitions: [
|
|
708
|
-
...flag('PostPromotionCodesPromotionCode', 'https://docs.stripe.com/api/promotion_codes/update'),
|
|
709
|
-
],
|
|
710
|
-
},
|
|
711
|
-
},
|
|
515
|
+
notFound: "No such promotion code: '{id}'", ...states["promotion_code"],
|
|
712
516
|
},
|
|
713
|
-
|
|
714
|
-
subscription_schedule: {
|
|
517
|
+
subscription_schedule: { refresh: { list: 'GetSubscriptionSchedules' },
|
|
715
518
|
idPrefix: 'sub_sched',
|
|
716
|
-
update: 'replace',
|
|
717
|
-
state: { status: scheduleStatus },
|
|
718
|
-
notState: ['end_behavior'],
|
|
519
|
+
update: 'replace', ...states["subscription_schedule"],
|
|
719
520
|
embeds: { customer: 'customer', subscription: 'subscription' },
|
|
720
521
|
filters: ['customer', 'subscription'],
|
|
721
522
|
},
|
|
722
|
-
'entitlements.feature': {
|
|
723
|
-
storedAs: 'entitlements_feature', idPrefix: 'feat', notFound: "No such feature: '{id}'",
|
|
724
|
-
state: { active: { initial: true, transitions: flag('PostEntitlementsFeaturesId', 'spec:PostEntitlementsFeaturesId "Update a feature’s metadata or permanently deactivate it."') } },
|
|
523
|
+
'entitlements.feature': { refresh: { list: 'GetEntitlementsFeatures' },
|
|
524
|
+
storedAs: 'entitlements_feature', idPrefix: 'feat', notFound: "No such feature: '{id}'", ...states["entitlements.feature"],
|
|
725
525
|
},
|
|
726
|
-
// an advance answers advancing and the clock is ready once it has reached the time (
|
|
727
|
-
'
|
|
728
|
-
storedAs: 'test_clock',
|
|
729
|
-
idPrefix: 'clock',
|
|
730
|
-
notFound: "No such test clock: '{id}'",
|
|
731
|
-
state: {
|
|
732
|
-
status: {
|
|
733
|
-
initial: 'ready',
|
|
734
|
-
transitions: [
|
|
735
|
-
// "advancing: The clock has started to advance but hasn't reached the specified time"; "ready: The clock has
|
|
736
|
-
// completed advancing to the specified time" (docs.stripe.com/billing/testing/test-clocks/api-advanced-usage)
|
|
737
|
-
{ operation: 'PostTestHelpersTestClocksTestClockAdvance', from: ['ready'], to: 'advancing', refusal: { status: 400, code: 'test_clock_not_ready', message: 'This test clock is still advancing.' }, source: 'https://docs.stripe.com/api/test_clocks/advance' },
|
|
738
|
-
by('vendor', ['advancing'], 'ready', 'https://docs.stripe.com/billing/testing/test-clocks/api-advanced-usage'),
|
|
739
|
-
// (Stripe may also end an advance in internal_failure; the twin's advances complete)
|
|
740
|
-
],
|
|
741
|
-
},
|
|
742
|
-
},
|
|
743
|
-
},
|
|
744
|
-
event: { idPrefix: 'evt', filters: ['type'] },
|
|
526
|
+
// an advance answers advancing and the clock is ready once it has reached the time (./engine/test-clocks.ts)
|
|
527
|
+
event: { refresh: { list: 'GetEvents', complete: false }, idPrefix: 'evt', filters: ['type'] },
|
|
745
528
|
// disabled and re-enabled by an update's `disabled` (Stripe also disables one that keeps failing; the
|
|
746
529
|
// twin counts no failures)
|
|
747
|
-
webhook_endpoint: {
|
|
530
|
+
webhook_endpoint: { refresh: { list: 'GetWebhookEndpoints' },
|
|
748
531
|
idPrefix: 'we',
|
|
749
|
-
notFound: "No such webhook endpoint: '{id}'",
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
...['enabled', 'disabled'].map((to) => ({ operation: 'PostWebhookEndpointsWebhookEndpoint', from: '*', to, source: 'https://docs.stripe.com/api/webhook_endpoints/update#update_webhook_endpoint-disabled' })),
|
|
755
|
-
],
|
|
756
|
-
},
|
|
757
|
-
},
|
|
532
|
+
notFound: "No such webhook endpoint: '{id}'", ...states["webhook_endpoint"],
|
|
533
|
+
},
|
|
534
|
+
account: {
|
|
535
|
+
// source: spec:/components/schemas/account/properties/individual "person"
|
|
536
|
+
embeds: { individual: 'person' }, alwaysEmbedded: ['individual'], refresh: { list: 'GetAccounts', complete: false }, idPrefix: 'acct', ...states["account"],
|
|
758
537
|
},
|
|
759
|
-
|
|
760
|
-
person: { idPrefix: 'person', notState: ['political_exposure'], parent: { param: 'account', field: 'account', resource: 'account' } },
|
|
538
|
+
person: { refresh: { list: 'GetAccountsAccountPersons' }, idPrefix: 'person', ...states["person"], parent: { param: 'account', field: 'account', resource: 'account' } },
|
|
761
539
|
// a capability lives in its account's capability map; requesting one leaves it pending, withdrawing it inactive
|
|
762
|
-
capability: {
|
|
763
|
-
idPrefix: 'cap',
|
|
764
|
-
state: {
|
|
765
|
-
status: {
|
|
766
|
-
initial: 'unrequested',
|
|
767
|
-
transitions: [
|
|
768
|
-
...['pending', 'inactive'].map((to) => ({ operation: 'PostAccountsAccountCapabilitiesCapability', from: '*', to, source: 'https://docs.stripe.com/api/capabilities/update' })),
|
|
769
|
-
// Stripe reviews the account's requirements
|
|
770
|
-
by('vendor', ['pending', 'inactive'], 'active', 'https://docs.stripe.com/connect/account-capabilities#capability-status'),
|
|
771
|
-
by('vendor', ['active', 'pending'], 'inactive', 'https://docs.stripe.com/connect/account-capabilities#capability-status'),
|
|
772
|
-
],
|
|
773
|
-
},
|
|
774
|
-
},
|
|
540
|
+
capability: { refresh: { none: 'the twin keeps a capability in its account’s capabilities, which the accounts’ list reads back (GET /v1/accounts)' },
|
|
541
|
+
idPrefix: 'cap', ...states["capability"],
|
|
775
542
|
},
|
|
776
543
|
// allow_redisplay and regulated_status belong to a card destination: consent and the issuer's
|
|
777
544
|
// regulation, set when it is added, not a lifecycle
|
|
778
|
-
external_account: {
|
|
779
|
-
idPrefix: 'ba',
|
|
780
|
-
state: { status: bankAccountStatus('https://docs.stripe.com/api/external_account_bank_accounts/object#account_bank_account_object-status') },
|
|
781
|
-
notState: ['allow_redisplay', 'regulated_status'],
|
|
545
|
+
external_account: { refresh: { none: 'an account answers its external accounts (account.external_accounts), which the accounts’ list reads back (GET /v1/accounts)' },
|
|
546
|
+
idPrefix: 'ba', ...states["external_account"],
|
|
782
547
|
},
|
|
783
|
-
account_link: { idPrefix: 'acctlink' },
|
|
784
|
-
account_session: { idPrefix: 'accts' },
|
|
785
|
-
transfer: { idPrefix: 'tr', update: 'replace', filters: ['destination'] },
|
|
786
|
-
transfer_reversal: { idPrefix: 'trr' },
|
|
548
|
+
account_link: { refresh: { none: 'an account link is answered once, by its create: the API has no read of one' }, idPrefix: 'acctlink' },
|
|
549
|
+
account_session: { refresh: { none: 'an account session is answered once, by its create: the API has no read of one' }, idPrefix: 'accts' },
|
|
550
|
+
transfer: { refresh: { list: 'GetTransfers' }, idPrefix: 'tr', update: 'replace', filters: ['destination'] },
|
|
551
|
+
transfer_reversal: { refresh: { list: 'GetTransfersIdReversals' }, parent: { param: 'id', field: 'transfer', resource: 'transfer' }, idPrefix: 'trr' },
|
|
787
552
|
// refunded once fee refunds take its whole amount
|
|
788
|
-
application_fee: {
|
|
789
|
-
idPrefix: 'fee', notFound: "No such application fee: '{id}'", filters: ['charge'],
|
|
790
|
-
state: { refunded: { initial: false, transitions: [
|
|
791
|
-
{ operation: 'PostApplicationFeesIdRefunds', from: ['false'], to: 'true', source: 'https://docs.stripe.com/api/fee_refunds/create' },
|
|
792
|
-
// a refund of its charge with refund_application_fee refunds it in proportion
|
|
793
|
-
...['PostRefunds', 'PostChargesChargeRefunds'].map((operation) => ({ operation, from: ['false'], to: 'true', source: 'https://docs.stripe.com/api/refunds/create#create_refund-refund_application_fee' })),
|
|
794
|
-
] } },
|
|
795
|
-
},
|
|
796
|
-
fee_refund: { idPrefix: 'fr' },
|
|
797
|
-
'apps.secret': { storedAs: 'apps_secret', idPrefix: 'apmc' },
|
|
798
|
-
token: { idPrefix: 'tok' },
|
|
799
|
-
file: { idPrefix: 'file', notState: ['purpose'], filters: ['purpose'] },
|
|
800
|
-
file_link: { idPrefix: 'link' },
|
|
801
|
-
// the user submits on Stripe's hosted verification page and Stripe checks it (the twin's own helper
|
|
802
|
-
// outside Stripe's surface, POST …/verify, stands in for both at once)
|
|
803
|
-
'identity.verification_session': {
|
|
804
|
-
storedAs: 'verification_session',
|
|
805
|
-
idPrefix: 'vs',
|
|
806
|
-
notFound: "No such VerificationSession: '{id}'",
|
|
807
|
-
state: {
|
|
808
|
-
status: {
|
|
809
|
-
initial: 'requires_input',
|
|
810
|
-
transitions: [
|
|
811
|
-
by('external', ['requires_input'], 'processing', 'https://docs.stripe.com/identity/how-sessions-work'),
|
|
812
|
-
by('vendor', ['processing'], 'verified', 'https://docs.stripe.com/identity/how-sessions-work'),
|
|
813
|
-
by('vendor', ['processing'], 'requires_input', 'https://docs.stripe.com/identity/how-sessions-work'),
|
|
814
|
-
],
|
|
815
|
-
},
|
|
816
|
-
},
|
|
817
|
-
notState: ['type'],
|
|
553
|
+
application_fee: { refresh: { list: 'GetApplicationFees' },
|
|
554
|
+
idPrefix: 'fee', notFound: "No such application fee: '{id}'", filters: ['charge'], ...states["application_fee"],
|
|
818
555
|
},
|
|
819
|
-
|
|
820
|
-
'
|
|
556
|
+
fee_refund: { refresh: { list: 'GetApplicationFeesIdRefunds' }, parent: { param: 'id', field: 'fee', resource: 'application_fee' }, idPrefix: 'fr' },
|
|
557
|
+
'apps.secret': { refresh: { none: 'secrets are listed only per scope (the list requires scope), which a root does not name' }, storedAs: 'apps_secret', idPrefix: 'apmc' },
|
|
558
|
+
'billing_portal.session': { refresh: { none: 'a portal session is answered once, by its create: the API has no read of one' }, storedAs: 'billing_portal_session', idPrefix: 'bps', ...states["billing_portal.session"], },
|
|
821
559
|
// is_default is Stripe's: the configuration the dashboard made first
|
|
822
|
-
'billing_portal.configuration': {
|
|
823
|
-
storedAs: 'billing_portal_configuration', idPrefix: 'bpc', notFound: "No such configuration: '{id}'",
|
|
824
|
-
state: { active: { initial: true, transitions: flag('PostBillingPortalConfigurationsConfiguration', 'https://docs.stripe.com/api/customer_portal/configurations/update') } },
|
|
825
|
-
notState: ['is_default'],
|
|
826
|
-
},
|
|
827
|
-
// `state` is a US state code, not a lifecycle
|
|
828
|
-
tax_rate: {
|
|
829
|
-
idPrefix: 'txr', notFound: "No such tax rate: '{id}'",
|
|
830
|
-
state: { active: { initial: true, transitions: flag('PostTaxRatesTaxRate', 'https://docs.stripe.com/api/tax_rates/update') } },
|
|
831
|
-
notState: ['jurisdiction_level', 'rate_type', 'state', 'tax_type'],
|
|
832
|
-
},
|
|
833
|
-
// its status is derived on every read from whether a head office is set; nothing stores it
|
|
834
|
-
'tax.settings': { storedAs: 'tax_settings', idPrefix: 'taxset', notState: ['status'] },
|
|
835
|
-
'tax.calculation': { storedAs: 'tax_calculation', idPrefix: 'taxcalc', notFound: "No such tax calculation: '{id}'" },
|
|
836
|
-
// a registration is active from creation here; its dates move it on the clock
|
|
837
|
-
'tax.registration': {
|
|
838
|
-
storedAs: 'tax_registration', idPrefix: 'taxreg', notFound: "No such tax registration: '{id}'", filters: ['status'],
|
|
839
|
-
state: {
|
|
840
|
-
// Stripe schedules a registration with a future active_from and expires one at expires_at; the twin's
|
|
841
|
-
// are active from the start and never expire
|
|
842
|
-
status: { initial: 'active', transitions: [] },
|
|
843
|
-
},
|
|
844
|
-
},
|
|
845
|
-
'tax.transaction': { storedAs: 'tax_transaction', idPrefix: 'tax', notFound: "No such tax transaction: '{id}'", notState: ['type'] },
|
|
846
|
-
payment_link: {
|
|
847
|
-
idPrefix: 'plink',
|
|
848
|
-
update: 'replace', notFound: "No such payment link: '{id}'",
|
|
849
|
-
state: { active: { initial: true, transitions: flag('PostPaymentLinksPaymentLink', 'https://docs.stripe.com/api/payment_links/payment_links/update') } },
|
|
850
|
-
notState: ['billing_address_collection', 'customer_creation', 'payment_method_collection', 'submit_type'],
|
|
560
|
+
'billing_portal.configuration': { refresh: { list: 'GetBillingPortalConfigurations' },
|
|
561
|
+
storedAs: 'billing_portal_configuration', idPrefix: 'bpc', notFound: "No such configuration: '{id}'", ...states["billing_portal.configuration"],
|
|
851
562
|
},
|
|
852
|
-
|
|
563
|
+
'tax.calculation': { refresh: { none: 'a calculation is read by its id (GET /v1/tax/calculations/{calculation}): the API lists none' }, storedAs: 'tax_calculation', idPrefix: 'taxcalc', notFound: "No such tax calculation: '{id}'" },
|
|
564
|
+
'tax.transaction': { refresh: { none: 'a tax transaction is read by its id (GET /v1/tax/transactions/{transaction}): the API lists none' }, storedAs: 'tax_transaction', idPrefix: 'tax', notFound: "No such tax transaction: '{id}'", ...states["tax.transaction"], },
|
|
853
565
|
// a review is open until it is closed; approving closes it, once
|
|
854
|
-
review: {
|
|
566
|
+
review: { refresh: { list: 'GetReviews', complete: false },
|
|
855
567
|
storedAs: 'radar_review',
|
|
856
|
-
idPrefix: 'prv',
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
notState: ['closed_reason', 'opened_reason'],
|
|
867
|
-
},
|
|
868
|
-
'radar.value_list': { storedAs: 'radar_value_list', idPrefix: 'rsl', notFound: "No such radar value list: '{id}'", notState: ['item_type'], filters: ['alias'] },
|
|
869
|
-
'radar.value_list_item': { storedAs: 'radar_value_list_item', idPrefix: 'rsli', notFound: "No such radar value list item: '{id}'" },
|
|
870
|
-
'issuing.cardholder': {
|
|
568
|
+
idPrefix: 'prv', ...states["review"],
|
|
569
|
+
},
|
|
570
|
+
'radar.value_list': { refresh: { list: 'GetRadarValueLists' }, storedAs: 'radar_value_list', idPrefix: 'rsl', notFound: "No such radar value list: '{id}'", ...states["radar.value_list"],
|
|
571
|
+
// source: spec:/components/schemas/radar.value_list/properties/created/description "Time at which the object was created."
|
|
572
|
+
assigned: { created: { now: true }, object: { value: 'radar.value_list' }, livemode: { value: false }, metadata: { value: {} },
|
|
573
|
+
// source: spec:/components/schemas/radar.value_list/properties/created_by/description "The name or email address of the user who created this value list."
|
|
574
|
+
// Where documentation stops: local API-key creates identify their synthetic account operator as twin.
|
|
575
|
+
created_by: { value: 'twin' }, list_items: { value: { object: 'list', data: [], has_more: false, url: '/v1/radar/value_list_items' } } }, filters: ['alias'] },
|
|
576
|
+
'radar.value_list_item': { refresh: { none: 'value list items are listed only per value list (the list requires value_list), and each list answers its items (radar.value_list.list_items)' }, storedAs: 'radar_value_list_item', idPrefix: 'rsli', notFound: "No such radar value list item: '{id}'" },
|
|
577
|
+
'issuing.cardholder': { refresh: { list: 'GetIssuingCardholders' },
|
|
871
578
|
storedAs: 'issuing_cardholder',
|
|
872
579
|
idPrefix: 'ich',
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
580
|
+
// source: spec:/components/schemas/issuing.cardholder/properties/created/description "Time at which the object was created."
|
|
581
|
+
assigned: { created: { now: true }, object: { value: 'issuing.cardholder' }, livemode: { value: false }, metadata: { value: {} },
|
|
582
|
+
// source: spec:/components/schemas/issuing_cardholder_requirements/properties/past_due/description "Array of fields that need to be collected"
|
|
583
|
+
requirements: { value: { disabled_reason: null, past_due: [] } } },
|
|
584
|
+
notFound: "No such cardholder: '{id}'", ...states["issuing.cardholder"],
|
|
876
585
|
filters: ['status', 'type', 'email'],
|
|
877
586
|
},
|
|
878
|
-
'issuing.card': {
|
|
587
|
+
'issuing.card': { refresh: { list: 'GetIssuingCards' },
|
|
879
588
|
storedAs: 'issuing_card',
|
|
880
589
|
idPrefix: 'ic',
|
|
881
|
-
notFound: "No such card: '{id}'",
|
|
882
|
-
|
|
883
|
-
|
|
590
|
+
notFound: "No such card: '{id}'", ...states["issuing.card"],
|
|
591
|
+
// source: spec:/components/schemas/issuing.card/properties/cardholder "issuing.cardholder"
|
|
592
|
+
embeds: { cardholder: 'issuing.cardholder' }, alwaysEmbedded: ['cardholder'],
|
|
884
593
|
filters: ['cardholder', 'status', 'type'],
|
|
885
594
|
},
|
|
886
|
-
'issuing.authorization': {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
notFound: "No such dispute: '{id}'",
|
|
892
|
-
state: {
|
|
893
|
-
status: {
|
|
894
|
-
initial: 'unsubmitted',
|
|
895
|
-
transitions: [
|
|
896
|
-
{ operation: 'PostIssuingDisputesDisputeSubmit', from: ['unsubmitted'], to: 'submitted', refusal: { status: 400, code: 'dispute_unsubmitted_required', message: 'This dispute has already been submitted (status {from}).' }, source: 'spec:PostIssuingDisputesDisputeSubmit "Submits an Issuing <code>Dispute</code> to the card network."' },
|
|
897
|
-
// (Stripe decides a submitted dispute won or lost and expires one never submitted; the twin decides none)
|
|
898
|
-
],
|
|
899
|
-
},
|
|
900
|
-
},
|
|
901
|
-
notState: ['loss_reason'],
|
|
902
|
-
filters: ['status', 'transaction'],
|
|
903
|
-
},
|
|
904
|
-
'issuing.token': {
|
|
905
|
-
storedAs: 'issuing_token',
|
|
906
|
-
idPrefix: 'iss_tok',
|
|
907
|
-
notFound: "No such issuing token: '{id}'",
|
|
908
|
-
state: { status: { initial: 'active', transitions: [...setBy('PostIssuingTokensToken', ['active', 'deleted', 'suspended'], 'https://docs.stripe.com/api/issuing/tokens/update')] } },
|
|
909
|
-
notState: ['network', 'wallet_provider'],
|
|
910
|
-
filters: ['card', 'status'],
|
|
911
|
-
},
|
|
912
|
-
// a design waits in review (inactive) until the review test helpers decide it
|
|
913
|
-
'issuing.personalization_design': {
|
|
914
|
-
storedAs: 'personalization_design',
|
|
915
|
-
idPrefix: 'pd',
|
|
916
|
-
notFound: "No such personalization design: '{id}'",
|
|
917
|
-
state: {
|
|
918
|
-
status: {
|
|
919
|
-
// a new design waits on Stripe's review (docs.stripe.com/issuing/cards/physical/personalization-design)
|
|
920
|
-
initial: 'review',
|
|
921
|
-
transitions: [
|
|
922
|
-
...setBy('PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate', ['active'], 'spec:PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate "to <code>active</code>"'),
|
|
923
|
-
...setBy('PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate', ['inactive'], 'spec:PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate "to <code>inactive</code>"'),
|
|
924
|
-
...setBy('PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject', ['rejected'], 'spec:PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject "to <code>rejected</code>"'),
|
|
925
|
-
// (outside test mode Stripe's review decides it; the twin is test mode, where these helpers do)
|
|
926
|
-
],
|
|
927
|
-
},
|
|
928
|
-
},
|
|
929
|
-
},
|
|
930
|
-
'terminal.location': { storedAs: 'terminal_location', idPrefix: 'tml', notFound: "No such location: '{id}'" },
|
|
931
|
-
// a simulated reader is online from registration; a real one drops off and comes back
|
|
932
|
-
'terminal.reader': {
|
|
933
|
-
storedAs: 'terminal_reader', idPrefix: 'tmr', notFound: "No such reader: '{id}'", notState: ['device_type'], filters: ['location', 'status'],
|
|
934
|
-
// (a real reader goes offline and back; the twin's simulated readers stay online)
|
|
935
|
-
state: { status: { initial: 'online', transitions: [] } },
|
|
936
|
-
},
|
|
937
|
-
'terminal.configuration': { storedAs: 'terminal_configuration', idPrefix: 'tmc', notFound: "No such configuration: '{id}'", notState: ['is_account_default'] },
|
|
938
|
-
topup: {
|
|
939
|
-
idPrefix: 'tu',
|
|
940
|
-
state: {
|
|
941
|
-
status: {
|
|
942
|
-
// a top-up starts pending (the create page's example answers "status": "pending") and its funds arrive days
|
|
943
|
-
// later: "USA (USD) ACH Debit Transfer 5 days" (docs.stripe.com/connect/top-ups; semantics/terminal.ts)
|
|
944
|
-
initial: 'pending',
|
|
945
|
-
transitions: [
|
|
946
|
-
{ operation: 'PostTopupsTopupCancel', from: ['pending'], to: 'canceled', refusal: { status: 400, code: 'topup_unexpected_state', message: 'This top-up cannot be canceled because it has a status of {from}.' }, source: 'https://docs.stripe.com/api/topups/cancel' },
|
|
947
|
-
// to the Issuing balance alike: "Your top-ups can take up to 5 business days to become available"
|
|
948
|
-
// (docs.stripe.com/issuing/funding/balance)
|
|
949
|
-
by('vendor', ['pending'], 'succeeded', 'https://docs.stripe.com/connect/top-ups'),
|
|
950
|
-
// (Stripe also fails a top-up or reverses a settled one; the twin's top-ups do neither)
|
|
951
|
-
],
|
|
952
|
-
},
|
|
953
|
-
},
|
|
954
|
-
notState: ['initiated_by'],
|
|
955
|
-
filters: ['status'],
|
|
956
|
-
},
|
|
957
|
-
// closing an account (POST …/close) is not modeled here; is_default is Stripe's
|
|
958
|
-
'treasury.financial_account': { storedAs: 'financial_account', idPrefix: 'fa', notFound: "No such financial account: '{id}'", state: { status: { initial: 'open', transitions: [] } }, notState: ['is_default'], filters: ['status'] },
|
|
959
|
-
'treasury.outbound_payment': {
|
|
595
|
+
'issuing.authorization': { refresh: { list: 'GetIssuingAuthorizations' }, storedAs: 'issuing_authorization', idPrefix: 'iauth', ...states["issuing.authorization"],
|
|
596
|
+
// source: spec:/components/schemas/issuing.authorization/properties/card "issuing.card"
|
|
597
|
+
embeds: { card: 'issuing.card', cardholder: 'issuing.cardholder' }, alwaysEmbedded: ['card'], filters: ['card', 'cardholder', 'status'], },
|
|
598
|
+
'issuing.transaction': { refresh: { list: 'GetIssuingTransactions' }, storedAs: 'issuing_transaction', idPrefix: 'ipi', notFound: "No such transaction: '{id}'", ...states["issuing.transaction"], filters: ['card', 'cardholder'] },
|
|
599
|
+
'treasury.outbound_payment': { refresh: { none: 'outbound payments are listed only per financial account (the list requires financial_account)' },
|
|
960
600
|
storedAs: 'outbound_payment',
|
|
961
601
|
idPrefix: 'obp',
|
|
962
|
-
notFound: "No such outbound payment: '{id}'",
|
|
963
|
-
state: { status: flowCancel('PostTreasuryOutboundPaymentsIdCancel', 'outbound_payment_not_cancelable', 'OutboundPayment', outbound('https://docs.stripe.com/treasury/moving-money/financial-accounts/out-of/outbound-payments')) },
|
|
602
|
+
notFound: "No such outbound payment: '{id}'", ...states["treasury.outbound_payment"],
|
|
964
603
|
filters: ['financial_account', 'status'],
|
|
965
604
|
},
|
|
966
|
-
'treasury.outbound_transfer': {
|
|
605
|
+
'treasury.outbound_transfer': { refresh: { none: 'outbound transfers are listed only per financial account (the list requires financial_account)' },
|
|
967
606
|
storedAs: 'outbound_transfer',
|
|
968
607
|
idPrefix: 'obt',
|
|
969
|
-
notFound: "No such outbound transfer: '{id}'",
|
|
970
|
-
state: { status: flowCancel('PostTreasuryOutboundTransfersOutboundTransferCancel', 'outbound_transfer_not_cancelable', 'OutboundTransfer', outbound('https://docs.stripe.com/treasury/moving-money/financial-accounts/out-of/outbound-transfers')) },
|
|
608
|
+
notFound: "No such outbound transfer: '{id}'", ...states["treasury.outbound_transfer"],
|
|
971
609
|
filters: ['financial_account', 'status'],
|
|
972
610
|
},
|
|
973
|
-
'treasury.inbound_transfer': {
|
|
611
|
+
'treasury.inbound_transfer': { refresh: { none: 'inbound transfers are listed only per financial account (the list requires financial_account)' },
|
|
974
612
|
storedAs: 'inbound_transfer',
|
|
975
613
|
idPrefix: 'ibt',
|
|
976
|
-
notFound: "No such inbound transfer: '{id}'",
|
|
977
|
-
// "An InboundTransfer is processing if it is created and pending. The status changes to succeeded once the funds have
|
|
978
|
-
// been "confirmed""; in test mode the succeed helper confirms them (docs.stripe.com/api/treasury/inbound_transfers)
|
|
979
|
-
state: { status: flowCancel('PostTreasuryInboundTransfersInboundTransferCancel', 'inbound_transfer_not_cancelable', 'InboundTransfer', [
|
|
980
|
-
{ operation: 'PostTestHelpersTreasuryInboundTransfersIdSucceed', from: ['processing'], to: 'succeeded', refusal: { status: 400, code: 'inbound_transfer_not_processing', message: 'This InboundTransfer cannot succeed because it is no longer processing.' }, source: 'https://docs.stripe.com/api/treasury/inbound_transfers' },
|
|
981
|
-
]) },
|
|
614
|
+
notFound: "No such inbound transfer: '{id}'", ...states["treasury.inbound_transfer"],
|
|
982
615
|
filters: ['financial_account', 'status'],
|
|
983
616
|
},
|
|
984
617
|
// received credits and debits are materialized by the network (test helpers the twin does not serve)
|
|
985
|
-
'treasury.received_credit': { storedAs: 'received_credit', idPrefix: 'rc', notFound: "No such received credit: '{id}'",
|
|
986
|
-
'treasury.received_debit': { storedAs: 'received_debit', idPrefix: 'rd', notFound: "No such received debit: '{id}'",
|
|
618
|
+
'treasury.received_credit': { refresh: { none: 'received credits are listed only per financial account (the list requires financial_account)' }, storedAs: 'received_credit', idPrefix: 'rc', notFound: "No such received credit: '{id}'", ...states["treasury.received_credit"], filters: ['financial_account', 'status'] },
|
|
619
|
+
'treasury.received_debit': { refresh: { none: 'received debits are listed only per financial account (the list requires financial_account)' }, storedAs: 'received_debit', idPrefix: 'rd', notFound: "No such received debit: '{id}'", ...states["treasury.received_debit"], filters: ['financial_account', 'status'] },
|
|
987
620
|
// a ledger transaction is posted or left open by the flow that writes it; the network settles an open one
|
|
988
|
-
'treasury.transaction': {
|
|
989
|
-
storedAs: 'treasury_transaction', idPrefix: 'trxn', notFound: "No such treasury transaction: '{id}'",
|
|
990
|
-
// void: "The Transaction never impacted the balance. For example, a Transaction would enter this state if an
|
|
991
|
-
// OutboundPayment was initiated but then canceled" (docs.stripe.com/api/treasury/transactions/object); canceling an
|
|
992
|
-
// outbound flow voids its open transaction (semantics/treasury.ts). (Stripe also posts an open transaction as its
|
|
993
|
-
// flow settles; the twin's outbound flows stay processing)
|
|
994
|
-
state: { status: { initial: 'open', transitions: [
|
|
995
|
-
...['PostTreasuryOutboundPaymentsIdCancel', 'PostTreasuryOutboundTransfersOutboundTransferCancel', 'PostTreasuryInboundTransfersInboundTransferCancel'].map((operation) => ({ operation, from: ['open'], to: 'void', source: 'https://docs.stripe.com/api/treasury/transactions/object' })),
|
|
996
|
-
// an inbound transfer's transaction posts when it succeeds ("a transaction is created and posted")
|
|
997
|
-
{ operation: 'PostTestHelpersTreasuryInboundTransfersIdSucceed', from: ['open'], to: 'posted', source: 'https://docs.stripe.com/api/treasury/inbound_transfers' },
|
|
998
|
-
] } },
|
|
999
|
-
},
|
|
1000
|
-
'treasury.transaction_entry': { storedAs: 'treasury_transaction_entry', idPrefix: 'trxne', notFound: "No such transaction entry: '{id}'", notState: ['flow_type', 'type'] },
|
|
1001
|
-
'climate.order': {
|
|
1002
|
-
storedAs: 'climate_order',
|
|
1003
|
-
idPrefix: 'climorder',
|
|
1004
|
-
notFound: "No such order: '{id}'",
|
|
1005
|
-
state: {
|
|
1006
|
-
status: {
|
|
1007
|
-
// an order is created confirmed: the create page's example answers "status": "confirmed" with confirmed_at set
|
|
1008
|
-
// (docs.stripe.com/api/climate/order/create)
|
|
1009
|
-
initial: 'confirmed',
|
|
1010
|
-
transitions: [
|
|
1011
|
-
{ operation: 'PostClimateOrdersOrderCancel', from: ['awaiting_funds', 'confirmed', 'open'], to: 'canceled', refusal: { status: 400, code: 'climate_order_not_cancelable', message: 'This order can no longer be canceled because it is {from}.' }, source: 'https://docs.stripe.com/api/climate/order/cancel' },
|
|
1012
|
-
// funded, confirmed by the supplier, then delivered
|
|
1013
|
-
// (Stripe funds, confirms and delivers an order over months; the twin's orders stay where they are made)
|
|
1014
|
-
],
|
|
1015
|
-
},
|
|
1016
|
-
},
|
|
1017
|
-
notState: ['cancellation_reason'],
|
|
1018
|
-
},
|
|
1019
|
-
'financial_connections.session': { storedAs: 'fc_session', idPrefix: 'fcsess' },
|
|
1020
|
-
'financial_connections.account': {
|
|
1021
|
-
storedAs: 'fc_account',
|
|
1022
|
-
idPrefix: 'fca',
|
|
1023
|
-
notFound: "No such account: '{id}'",
|
|
1024
|
-
state: {
|
|
1025
|
-
status: {
|
|
1026
|
-
initial: 'active',
|
|
1027
|
-
transitions: [
|
|
1028
|
-
{ operation: 'PostFinancialConnectionsAccountsAccountDisconnect', from: '*', to: 'disconnected', source: 'https://docs.stripe.com/api/financial_connections/accounts/disconnect' },
|
|
1029
|
-
// (Stripe marks an account inactive when the bank link breaks, and active again; the twin's links hold)
|
|
1030
|
-
],
|
|
1031
|
-
},
|
|
1032
|
-
},
|
|
1033
|
-
notState: ['category', 'subcategory'],
|
|
621
|
+
'treasury.transaction': { refresh: { none: 'Treasury transactions are listed only per financial account (the list requires financial_account)' },
|
|
622
|
+
storedAs: 'treasury_transaction', idPrefix: 'trxn', notFound: "No such treasury transaction: '{id}'", ...states["treasury.transaction"],
|
|
1034
623
|
},
|
|
624
|
+
'treasury.transaction_entry': { refresh: { none: 'transaction entries are listed only per financial account (the list requires financial_account)' }, storedAs: 'treasury_transaction_entry', idPrefix: 'trxne', notFound: "No such transaction entry: '{id}'", ...states["treasury.transaction_entry"], },
|
|
625
|
+
'financial_connections.session': { refresh: { none: 'a session is read by its id (GET /v1/financial_connections/sessions/{session}): the API lists none' }, storedAs: 'fc_session', idPrefix: 'fcsess' },
|
|
1035
626
|
// a linked account's transactions arrive posted here; the bank settles a pending one
|
|
1036
|
-
'financial_connections.transaction': {
|
|
1037
|
-
storedAs: 'fc_transaction', idPrefix: 'fctxn',
|
|
1038
|
-
// (a bank's pending transaction posts or is voided at Stripe; the twin's arrive posted)
|
|
1039
|
-
state: { status: { initial: 'posted', transitions: [] } },
|
|
1040
|
-
},
|
|
1041
|
-
'forwarding.request': { storedAs: 'forwarding_request', idPrefix: 'fwdr', notFound: "No such forwarding request: '{id}'" },
|
|
1042
|
-
// the twin runs a report at once; Stripe runs it in the background
|
|
1043
|
-
'reporting.report_run': {
|
|
1044
|
-
storedAs: 'report_run', idPrefix: 'frr', notFound: "No such report run: '{id}'",
|
|
1045
|
-
// "When first created, the object appears with status="pending""; "When the run completes, Stripe updates the
|
|
1046
|
-
// object, and it has a status of succeeded" (docs.stripe.com/reports/api; semantics/platform.ts finishReportRuns).
|
|
1047
|
-
// (Stripe may also fail a run; the twin's runs succeed)
|
|
1048
|
-
state: { status: { initial: 'pending', transitions: [by('vendor', ['pending'], 'succeeded', 'https://docs.stripe.com/reports/api')] } },
|
|
627
|
+
'financial_connections.transaction': { refresh: { none: 'transactions are listed only per linked account (the list requires account)' },
|
|
628
|
+
storedAs: 'fc_transaction', idPrefix: 'fctxn', ...states["financial_connections.transaction"],
|
|
1049
629
|
},
|
|
1050
630
|
// archived (active=false) and restored by an update
|
|
1051
|
-
product: {
|
|
1052
|
-
product_feature: {
|
|
1053
|
-
|
|
631
|
+
product: { refresh: { list: 'GetProducts' }, idPrefix: 'prod', update: 'replace', ...states["product"], },
|
|
632
|
+
product_feature: {
|
|
633
|
+
// source: spec:/components/schemas/product_feature/properties/entitlement_feature "entitlements.feature"
|
|
634
|
+
embeds: { entitlement_feature: 'entitlements.feature' }, alwaysEmbedded: ['entitlement_feature'], refresh: { list: 'GetProductsProductFeatures' }, parent: { param: 'product', field: '_product', resource: 'product' }, idPrefix: 'prodft'
|
|
635
|
+
},
|
|
636
|
+
price: { refresh: { list: 'GetPrices', complete: false },
|
|
1054
637
|
idPrefix: 'price',
|
|
1055
|
-
update: 'replace',
|
|
1056
|
-
// deleting a plan leaves its price for its subscribers, inactive: "Deleting plans means new subscribers can’t be added.
|
|
1057
|
-
// Existing subscribers aren’t affected." (docs.stripe.com/api/plans/delete; semantics/plans.ts)
|
|
1058
|
-
state: { active: { initial: true, transitions: [...flag('PostPricesPrice', 'https://docs.stripe.com/api/prices/update#update_price-active'), { operation: 'DeletePlansPlan', from: ['true'], to: 'false', source: 'https://docs.stripe.com/api/plans/delete' }] } },
|
|
638
|
+
update: 'replace', ...states["price"], embeds: { product: 'product' },
|
|
1059
639
|
},
|
|
1060
640
|
},
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
641
|
+
// the webhooks Stripe's writes send (./semantics/shared.ts), each event's data and account rendered by ./semantics/events.ts
|
|
642
|
+
events: { ...STRIPE_EVENTS, render: data, values },
|
|
643
|
+
// a vendor-backed World's root: Stripe's webhooks sent to the World's ingest door, signed as Stripe signs every event
|
|
644
|
+
// (Stripe-Signature: t=<seconds>,v1=<HMAC-SHA256 of "<t>.<body>">, docs.stripe.com/webhooks#verify-manually), the
|
|
645
|
+
// event's type in its body and its object at data.object (docs.stripe.com/api/events/object); the types whose
|
|
646
|
+
// resource neither the events' write names nor <resource>.created|updated|deleted say
|
|
647
|
+
ingest: {
|
|
648
|
+
scheme: { kind: 'timestamp-v1', header: 'Stripe-Signature' },
|
|
649
|
+
type: { body: 'type' },
|
|
650
|
+
object: 'data.object',
|
|
651
|
+
types: {
|
|
652
|
+
'checkout.session.completed': { resource: 'checkout.session' },
|
|
653
|
+
'checkout.session.expired': { resource: 'checkout.session' },
|
|
654
|
+
'charge.succeeded': { resource: 'charge' },
|
|
655
|
+
'charge.failed': { resource: 'charge' },
|
|
656
|
+
'charge.refunded': { resource: 'charge' },
|
|
657
|
+
'payment_intent.requires_action': { resource: 'payment_intent' },
|
|
658
|
+
'payment_intent.canceled': { resource: 'payment_intent' },
|
|
659
|
+
'payment_method.automatically_updated': { resource: 'payment_method' },
|
|
660
|
+
'invoice.payment_succeeded': { resource: 'invoice' },
|
|
661
|
+
'invoice.payment_failed': { resource: 'invoice' },
|
|
662
|
+
'invoice.voided': { resource: 'invoice' },
|
|
663
|
+
'transfer.reversed': { resource: 'transfer' },
|
|
664
|
+
'account.external_account.updated': { resource: 'external_account' },
|
|
665
|
+
'account.external_account.created': { resource: 'external_account' },
|
|
666
|
+
'account.external_account.deleted': { resource: 'external_account', deleted: true },
|
|
667
|
+
'payout.paid': { resource: 'payout' },
|
|
668
|
+
'payout.failed': { resource: 'payout' },
|
|
669
|
+
'issuing_authorization.request': { resource: 'issuing.authorization' },
|
|
670
|
+
},
|
|
1069
671
|
},
|
|
1070
672
|
};
|