@peable.to/contracts 0.4.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/address.js +81 -0
- package/dist/cjs/common/envelopes.js +101 -0
- package/dist/cjs/common/objects.js +85 -0
- package/dist/cjs/common/params.js +211 -0
- package/dist/cjs/common/primitives.js +39 -0
- package/dist/cjs/contributions.js +22 -0
- package/dist/cjs/index.js +40 -137
- package/dist/cjs/openapi/document.js +297 -0
- package/dist/cjs/openapi/index.js +7 -0
- package/dist/cjs/openapi/webhooks.js +17 -0
- package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
- package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
- package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
- package/dist/cjs/resources/billingEngine/index.js +43 -0
- package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
- package/dist/cjs/resources/billingEngine/invoices.js +509 -0
- package/dist/cjs/resources/billingEngine/params.js +43 -0
- package/dist/cjs/resources/billingEngine/public.js +326 -0
- package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
- package/dist/cjs/resources/catalog/billing.js +755 -0
- package/dist/cjs/resources/catalog/billingSettings.js +131 -0
- package/dist/cjs/resources/catalog/coupons.js +222 -0
- package/dist/cjs/resources/catalog/entitlements.js +257 -0
- package/dist/cjs/resources/catalog/index.js +58 -0
- package/dist/cjs/resources/catalog/meters.js +279 -0
- package/dist/cjs/resources/catalog/prices.js +423 -0
- package/dist/cjs/resources/catalog/products.js +228 -0
- package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
- package/dist/cjs/resources/catalog/shared.js +75 -0
- package/dist/cjs/resources/catalog/testClocks.js +127 -0
- package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
- package/dist/cjs/resources/checkout/contributions.js +172 -0
- package/dist/cjs/resources/checkout/files.js +133 -0
- package/dist/cjs/resources/checkout/index.js +57 -0
- package/dist/cjs/resources/checkout/merchants.js +290 -0
- package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
- package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
- package/dist/cjs/resources/checkout/shared.js +368 -0
- package/dist/cjs/resources/connect/account.js +332 -0
- package/dist/cjs/resources/connect/applicationFees.js +113 -0
- package/dist/cjs/resources/connect/balance.js +212 -0
- package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
- package/dist/cjs/resources/connect/index.js +51 -0
- package/dist/cjs/resources/connect/onboarding.js +82 -0
- package/dist/cjs/resources/connect/payouts.js +196 -0
- package/dist/cjs/resources/connect/reporting.js +235 -0
- package/dist/cjs/resources/connect/requestLogs.js +110 -0
- package/dist/cjs/resources/connect/transfers.js +227 -0
- package/dist/cjs/resources/core/customers.js +194 -0
- package/dist/cjs/resources/core/index.js +23 -0
- package/dist/cjs/resources/core/paymentMethods.js +134 -0
- package/dist/cjs/resources/events/events.js +357 -0
- package/dist/cjs/resources/events/index.js +29 -0
- package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
- package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
- package/dist/cjs/resources/payments/charges.js +157 -0
- package/dist/cjs/resources/payments/disputes.js +204 -0
- package/dist/cjs/resources/payments/index.js +41 -0
- package/dist/cjs/resources/payments/paymentIntents.js +529 -0
- package/dist/cjs/resources/payments/refunds.js +245 -0
- package/dist/cjs/resources/payments/setupIntents.js +158 -0
- package/dist/cjs/resources/payments/social.js +182 -0
- package/dist/cjs/resources/payments/testHelpers.js +39 -0
- package/dist/cjs/resources/tax/assessments.js +217 -0
- package/dist/cjs/resources/tax/businessProfile.js +99 -0
- package/dist/cjs/resources/tax/calculations.js +176 -0
- package/dist/cjs/resources/tax/capabilities.js +42 -0
- package/dist/cjs/resources/tax/codes.js +37 -0
- package/dist/cjs/resources/tax/complianceActions.js +56 -0
- package/dist/cjs/resources/tax/deadlines.js +59 -0
- package/dist/cjs/resources/tax/documents.js +128 -0
- package/dist/cjs/resources/tax/index.js +80 -0
- package/dist/cjs/resources/tax/locationEvidence.js +131 -0
- package/dist/cjs/resources/tax/operatingLocations.js +98 -0
- package/dist/cjs/resources/tax/products.js +67 -0
- package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
- package/dist/cjs/resources/tax/registrations.js +82 -0
- package/dist/cjs/resources/tax/reports.js +92 -0
- package/dist/cjs/resources/tax/reviewItems.js +116 -0
- package/dist/cjs/resources/tax/ruleSet.js +68 -0
- package/dist/cjs/resources/tax/salesDestinations.js +94 -0
- package/dist/cjs/resources/tax/settings.js +104 -0
- package/dist/cjs/resources/tax/shared.js +62 -0
- package/dist/cjs/resources/tax/transactions.js +102 -0
- package/dist/cjs/route.js +22 -0
- package/dist/cjs/routes.js +31 -0
- package/dist/cjs/vocabulary/billingPortal.js +15 -0
- package/dist/cjs/vocabulary/catalog.js +110 -0
- package/dist/cjs/vocabulary/checkout.js +53 -0
- package/dist/cjs/vocabulary/connect.js +95 -0
- package/dist/cjs/vocabulary/dashboard.js +68 -0
- package/dist/cjs/vocabulary/errors.js +175 -0
- package/dist/cjs/vocabulary/events.js +176 -0
- package/dist/cjs/vocabulary/files.js +44 -0
- package/dist/cjs/vocabulary/identity.js +12 -0
- package/dist/cjs/vocabulary/index.js +39 -0
- package/dist/cjs/vocabulary/invoices.js +52 -0
- package/dist/cjs/vocabulary/lists.js +22 -0
- package/dist/cjs/vocabulary/merchants.js +23 -0
- package/dist/cjs/vocabulary/money.js +104 -0
- package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
- package/dist/cjs/vocabulary/payments.js +195 -0
- package/dist/cjs/vocabulary/reporting.js +27 -0
- package/dist/cjs/vocabulary/subscriptions.js +60 -0
- package/dist/cjs/vocabulary/tax.js +237 -0
- package/dist/cjs/vocabulary/version.js +12 -0
- package/dist/esm/common/address.js +76 -0
- package/dist/esm/common/envelopes.js +95 -0
- package/dist/esm/common/objects.js +74 -0
- package/dist/esm/common/params.js +203 -0
- package/dist/esm/common/primitives.js +35 -0
- package/dist/esm/contributions.js +5 -0
- package/dist/esm/index.js +26 -134
- package/dist/esm/openapi/document.js +294 -0
- package/dist/esm/openapi/index.js +2 -0
- package/dist/esm/openapi/webhooks.js +14 -0
- package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
- package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
- package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
- package/dist/esm/resources/billingEngine/index.js +26 -0
- package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
- package/dist/esm/resources/billingEngine/invoices.js +506 -0
- package/dist/esm/resources/billingEngine/params.js +39 -0
- package/dist/esm/resources/billingEngine/public.js +323 -0
- package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
- package/dist/esm/resources/catalog/billing.js +752 -0
- package/dist/esm/resources/catalog/billingSettings.js +128 -0
- package/dist/esm/resources/catalog/coupons.js +219 -0
- package/dist/esm/resources/catalog/entitlements.js +254 -0
- package/dist/esm/resources/catalog/index.js +38 -0
- package/dist/esm/resources/catalog/meters.js +276 -0
- package/dist/esm/resources/catalog/prices.js +419 -0
- package/dist/esm/resources/catalog/products.js +225 -0
- package/dist/esm/resources/catalog/promotionCodes.js +171 -0
- package/dist/esm/resources/catalog/shared.js +67 -0
- package/dist/esm/resources/catalog/testClocks.js +124 -0
- package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
- package/dist/esm/resources/checkout/contributions.js +167 -0
- package/dist/esm/resources/checkout/files.js +130 -0
- package/dist/esm/resources/checkout/index.js +25 -0
- package/dist/esm/resources/checkout/merchants.js +287 -0
- package/dist/esm/resources/checkout/paymentLinks.js +327 -0
- package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
- package/dist/esm/resources/checkout/shared.js +363 -0
- package/dist/esm/resources/connect/account.js +329 -0
- package/dist/esm/resources/connect/applicationFees.js +110 -0
- package/dist/esm/resources/connect/balance.js +209 -0
- package/dist/esm/resources/connect/connectedAccounts.js +257 -0
- package/dist/esm/resources/connect/index.js +34 -0
- package/dist/esm/resources/connect/onboarding.js +79 -0
- package/dist/esm/resources/connect/payouts.js +193 -0
- package/dist/esm/resources/connect/reporting.js +232 -0
- package/dist/esm/resources/connect/requestLogs.js +107 -0
- package/dist/esm/resources/connect/transfers.js +224 -0
- package/dist/esm/resources/core/customers.js +191 -0
- package/dist/esm/resources/core/index.js +6 -0
- package/dist/esm/resources/core/paymentMethods.js +131 -0
- package/dist/esm/resources/events/events.js +353 -0
- package/dist/esm/resources/events/index.js +12 -0
- package/dist/esm/resources/events/webhookDeliveries.js +90 -0
- package/dist/esm/resources/events/webhookEndpoints.js +212 -0
- package/dist/esm/resources/payments/charges.js +154 -0
- package/dist/esm/resources/payments/disputes.js +201 -0
- package/dist/esm/resources/payments/index.js +24 -0
- package/dist/esm/resources/payments/paymentIntents.js +526 -0
- package/dist/esm/resources/payments/refunds.js +242 -0
- package/dist/esm/resources/payments/setupIntents.js +155 -0
- package/dist/esm/resources/payments/social.js +179 -0
- package/dist/esm/resources/payments/testHelpers.js +36 -0
- package/dist/esm/resources/tax/assessments.js +214 -0
- package/dist/esm/resources/tax/businessProfile.js +96 -0
- package/dist/esm/resources/tax/calculations.js +173 -0
- package/dist/esm/resources/tax/capabilities.js +39 -0
- package/dist/esm/resources/tax/codes.js +34 -0
- package/dist/esm/resources/tax/complianceActions.js +53 -0
- package/dist/esm/resources/tax/deadlines.js +56 -0
- package/dist/esm/resources/tax/documents.js +125 -0
- package/dist/esm/resources/tax/index.js +63 -0
- package/dist/esm/resources/tax/locationEvidence.js +128 -0
- package/dist/esm/resources/tax/operatingLocations.js +95 -0
- package/dist/esm/resources/tax/products.js +64 -0
- package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
- package/dist/esm/resources/tax/registrations.js +79 -0
- package/dist/esm/resources/tax/reports.js +89 -0
- package/dist/esm/resources/tax/reviewItems.js +113 -0
- package/dist/esm/resources/tax/ruleSet.js +65 -0
- package/dist/esm/resources/tax/salesDestinations.js +91 -0
- package/dist/esm/resources/tax/settings.js +101 -0
- package/dist/esm/resources/tax/shared.js +58 -0
- package/dist/esm/resources/tax/transactions.js +99 -0
- package/dist/esm/route.js +16 -0
- package/dist/esm/routes.js +27 -0
- package/dist/esm/vocabulary/billingPortal.js +12 -0
- package/dist/esm/vocabulary/catalog.js +106 -0
- package/dist/esm/vocabulary/checkout.js +50 -0
- package/dist/esm/vocabulary/connect.js +92 -0
- package/dist/esm/vocabulary/dashboard.js +64 -0
- package/dist/esm/vocabulary/errors.js +170 -0
- package/dist/esm/vocabulary/events.js +173 -0
- package/dist/esm/vocabulary/files.js +41 -0
- package/dist/esm/vocabulary/identity.js +9 -0
- package/dist/esm/vocabulary/index.js +23 -0
- package/dist/esm/vocabulary/invoices.js +49 -0
- package/dist/esm/vocabulary/lists.js +19 -0
- package/dist/esm/vocabulary/merchants.js +20 -0
- package/dist/esm/vocabulary/money.js +98 -0
- package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
- package/dist/esm/vocabulary/payments.js +192 -0
- package/dist/esm/vocabulary/reporting.js +24 -0
- package/dist/esm/vocabulary/subscriptions.js +57 -0
- package/dist/esm/vocabulary/tax.js +233 -0
- package/dist/esm/vocabulary/version.js +9 -0
- package/dist/types/common/address.d.ts +62 -0
- package/dist/types/common/envelopes.d.ts +88 -0
- package/dist/types/common/objects.d.ts +107 -0
- package/dist/types/common/params.d.ts +156 -0
- package/dist/types/common/primitives.d.ts +56 -0
- package/dist/types/contributions.d.ts +1 -0
- package/dist/types/index.d.ts +16 -171
- package/dist/types/openapi/document.d.ts +16 -0
- package/dist/types/openapi/index.d.ts +2 -0
- package/dist/types/openapi/webhooks.d.ts +15 -0
- package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
- package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
- package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
- package/dist/types/resources/billingEngine/index.d.ts +6071 -0
- package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
- package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
- package/dist/types/resources/billingEngine/params.d.ts +51 -0
- package/dist/types/resources/billingEngine/public.d.ts +1860 -0
- package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
- package/dist/types/resources/catalog/billing.d.ts +1723 -0
- package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
- package/dist/types/resources/catalog/coupons.d.ts +403 -0
- package/dist/types/resources/catalog/entitlements.d.ts +422 -0
- package/dist/types/resources/catalog/index.d.ts +3155 -0
- package/dist/types/resources/catalog/meters.d.ts +474 -0
- package/dist/types/resources/catalog/prices.d.ts +1091 -0
- package/dist/types/resources/catalog/products.d.ts +430 -0
- package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
- package/dist/types/resources/catalog/shared.d.ts +34 -0
- package/dist/types/resources/catalog/testClocks.d.ts +220 -0
- package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
- package/dist/types/resources/checkout/contributions.d.ts +375 -0
- package/dist/types/resources/checkout/files.d.ts +280 -0
- package/dist/types/resources/checkout/index.d.ts +5678 -0
- package/dist/types/resources/checkout/merchants.d.ts +395 -0
- package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
- package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
- package/dist/types/resources/checkout/shared.d.ts +419 -0
- package/dist/types/resources/connect/account.d.ts +483 -0
- package/dist/types/resources/connect/applicationFees.d.ts +198 -0
- package/dist/types/resources/connect/balance.d.ts +399 -0
- package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
- package/dist/types/resources/connect/index.d.ts +2094 -0
- package/dist/types/resources/connect/onboarding.d.ts +95 -0
- package/dist/types/resources/connect/payouts.d.ts +527 -0
- package/dist/types/resources/connect/reporting.d.ts +506 -0
- package/dist/types/resources/connect/requestLogs.d.ts +236 -0
- package/dist/types/resources/connect/transfers.d.ts +436 -0
- package/dist/types/resources/core/customers.d.ts +619 -0
- package/dist/types/resources/core/index.d.ts +679 -0
- package/dist/types/resources/core/paymentMethods.d.ts +336 -0
- package/dist/types/resources/events/events.d.ts +731 -0
- package/dist/types/resources/events/index.d.ts +1727 -0
- package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
- package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
- package/dist/types/resources/payments/charges.d.ts +390 -0
- package/dist/types/resources/payments/disputes.d.ts +822 -0
- package/dist/types/resources/payments/index.d.ts +3517 -0
- package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
- package/dist/types/resources/payments/refunds.d.ts +684 -0
- package/dist/types/resources/payments/setupIntents.d.ts +391 -0
- package/dist/types/resources/payments/social.d.ts +266 -0
- package/dist/types/resources/payments/testHelpers.d.ts +178 -0
- package/dist/types/resources/tax/assessments.d.ts +787 -0
- package/dist/types/resources/tax/businessProfile.d.ts +134 -0
- package/dist/types/resources/tax/calculations.d.ts +261 -0
- package/dist/types/resources/tax/capabilities.d.ts +81 -0
- package/dist/types/resources/tax/codes.d.ts +29 -0
- package/dist/types/resources/tax/complianceActions.d.ts +97 -0
- package/dist/types/resources/tax/deadlines.d.ts +133 -0
- package/dist/types/resources/tax/documents.d.ts +257 -0
- package/dist/types/resources/tax/index.d.ts +1946 -0
- package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
- package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
- package/dist/types/resources/tax/products.d.ts +68 -0
- package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
- package/dist/types/resources/tax/registrations.d.ts +103 -0
- package/dist/types/resources/tax/reports.d.ts +129 -0
- package/dist/types/resources/tax/reviewItems.d.ts +226 -0
- package/dist/types/resources/tax/ruleSet.d.ts +219 -0
- package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
- package/dist/types/resources/tax/settings.d.ts +122 -0
- package/dist/types/resources/tax/shared.d.ts +43 -0
- package/dist/types/resources/tax/transactions.d.ts +404 -0
- package/dist/types/route.d.ts +86 -0
- package/dist/types/routes.d.ts +23 -0
- package/dist/types/vocabulary/billingPortal.d.ts +15 -0
- package/dist/types/vocabulary/catalog.d.ts +97 -0
- package/dist/types/vocabulary/checkout.d.ts +49 -0
- package/dist/types/vocabulary/connect.d.ts +62 -0
- package/dist/types/vocabulary/dashboard.d.ts +44 -0
- package/dist/types/vocabulary/errors.d.ts +146 -0
- package/dist/types/vocabulary/events.d.ts +171 -0
- package/dist/types/vocabulary/files.d.ts +30 -0
- package/dist/types/vocabulary/identity.d.ts +9 -0
- package/dist/types/vocabulary/index.d.ts +19 -0
- package/dist/types/vocabulary/invoices.d.ts +39 -0
- package/dist/types/vocabulary/lists.d.ts +9 -0
- package/dist/types/vocabulary/merchants.d.ts +9 -0
- package/dist/types/vocabulary/money.d.ts +59 -0
- package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
- package/dist/types/vocabulary/payments.d.ts +117 -0
- package/dist/types/vocabulary/reporting.d.ts +18 -0
- package/dist/types/vocabulary/subscriptions.d.ts +45 -0
- package/dist/types/vocabulary/tax.d.ts +163 -0
- package/dist/types/vocabulary/version.d.ts +10 -0
- package/package.json +51 -11
- package/dist/cjs/openapi.js +0 -165
- package/dist/esm/openapi.js +0 -161
- package/dist/types/openapi.d.ts +0 -148
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscriptionRoutes = exports.listSubscriptionItemsQuery = exports.deleteSubscriptionItemParams = exports.updateSubscriptionItemParams = exports.createSubscriptionItemParams = exports.listSubscriptionsQuery = exports.resumeSubscriptionParams = exports.cancelSubscriptionParams = exports.updateSubscriptionParams = exports.createSubscriptionParams = exports.subscriptionSchema = exports.deletedSubscriptionItemSchema = exports.subscriptionItemSchema = exports.discountSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const objects_1 = require("../../common/objects");
|
|
6
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
7
|
+
const objects_2 = require("../../common/objects");
|
|
8
|
+
const params_1 = require("../../common/params");
|
|
9
|
+
const primitives_1 = require("../../common/primitives");
|
|
10
|
+
const route_1 = require("../../route");
|
|
11
|
+
const subscriptions_1 = require("../../vocabulary/subscriptions");
|
|
12
|
+
const params_2 = require("./params");
|
|
13
|
+
/**
|
|
14
|
+
* Subscriptions (`sub_…`) and their items (`si_…`) — Orbit's native billing
|
|
15
|
+
* engine (ADR 0018 §1). Stripe's object model on Peable's wire (ADR 0014 D1):
|
|
16
|
+
* snake_case, Unix seconds, `livemode`, every amount a base-unit string.
|
|
17
|
+
*/
|
|
18
|
+
/** A discount applied to a subscription or an invoice. */
|
|
19
|
+
exports.discountSchema = (0, objects_2.defineComponent)('Discount', zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
object: zod_1.z.literal('discount'),
|
|
22
|
+
coupon: zod_1.z.string().describe('The coupon applied.'),
|
|
23
|
+
promotion_code: zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.nullable()
|
|
26
|
+
.describe('The promotion code (`promo_…`) it was redeemed through, if any.'),
|
|
27
|
+
start: primitives_1.unixSeconds.describe('When it started applying.'),
|
|
28
|
+
end: primitives_1.unixSeconds
|
|
29
|
+
.nullable()
|
|
30
|
+
.describe('When it stops (a `repeating` coupon); `null` for `once` and `forever`.'),
|
|
31
|
+
})
|
|
32
|
+
.strict());
|
|
33
|
+
/** One line of a subscription: a price and a quantity. */
|
|
34
|
+
exports.subscriptionItemSchema = (0, objects_2.defineObject)('subscription_item', 'SubscriptionItem', zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
id: zod_1.z.string(),
|
|
37
|
+
object: zod_1.z.literal('subscription_item'),
|
|
38
|
+
livemode: primitives_1.livemode,
|
|
39
|
+
subscription: zod_1.z.string().describe('The subscription (`sub_…`) it belongs to.'),
|
|
40
|
+
price: (0, objects_1.embedded)('price', 'The Price, always embedded (Stripe’s shape).'),
|
|
41
|
+
quantity: zod_1.z.number().int().nonnegative(),
|
|
42
|
+
metadata: primitives_1.metadata,
|
|
43
|
+
created: primitives_1.unixSeconds,
|
|
44
|
+
})
|
|
45
|
+
.strict());
|
|
46
|
+
/** What `DELETE /v1/subscription_items/:id` answers. */
|
|
47
|
+
exports.deletedSubscriptionItemSchema = (0, objects_2.defineComponent)('DeletedSubscriptionItem', (0, envelopes_1.deletedOf)('subscription_item'));
|
|
48
|
+
exports.subscriptionSchema = (0, objects_2.defineObject)('subscription', 'Subscription', zod_1.z
|
|
49
|
+
.object({
|
|
50
|
+
id: zod_1.z.string(),
|
|
51
|
+
object: zod_1.z.literal('subscription'),
|
|
52
|
+
livemode: primitives_1.livemode,
|
|
53
|
+
customer: (0, objects_2.expandable)('customer', '`cus_…`, or the Customer with `expand[]=customer`.'),
|
|
54
|
+
status: zod_1.z.enum(subscriptions_1.SUBSCRIPTION_STATUSES),
|
|
55
|
+
currency: primitives_1.currency,
|
|
56
|
+
items: (0, envelopes_1.listOf)(exports.subscriptionItemSchema).describe('Every live item, on one page.'),
|
|
57
|
+
collection_method: zod_1.z.enum(subscriptions_1.COLLECTION_METHODS),
|
|
58
|
+
days_until_due: zod_1.z
|
|
59
|
+
.number()
|
|
60
|
+
.int()
|
|
61
|
+
.nullable()
|
|
62
|
+
.describe("`send_invoice` only: days from finalization to the invoice's due date."),
|
|
63
|
+
default_payment_method: (0, objects_2.expandable)('payment_method', '`pm_…`, or the PaymentMethod with `expand[]=default_payment_method`.').nullable(),
|
|
64
|
+
description: zod_1.z.string().nullable(),
|
|
65
|
+
billing_cycle_anchor: primitives_1.unixSeconds,
|
|
66
|
+
current_period_start: primitives_1.unixSeconds,
|
|
67
|
+
current_period_end: primitives_1.unixSeconds,
|
|
68
|
+
start_date: primitives_1.unixSeconds,
|
|
69
|
+
trial_start: primitives_1.unixSeconds.nullable(),
|
|
70
|
+
trial_end: primitives_1.unixSeconds.nullable(),
|
|
71
|
+
trial_settings: zod_1.z
|
|
72
|
+
.object({
|
|
73
|
+
end_behavior: zod_1.z.object({ missing_payment_method: zod_1.z.enum(subscriptions_1.TRIAL_END_BEHAVIORS) }).strict(),
|
|
74
|
+
})
|
|
75
|
+
.strict(),
|
|
76
|
+
cancel_at_period_end: zod_1.z.boolean(),
|
|
77
|
+
cancel_at: primitives_1.unixSeconds.nullable(),
|
|
78
|
+
canceled_at: primitives_1.unixSeconds.nullable(),
|
|
79
|
+
ended_at: primitives_1.unixSeconds.nullable(),
|
|
80
|
+
cancellation_details: zod_1.z
|
|
81
|
+
.object({
|
|
82
|
+
reason: zod_1.z.enum(subscriptions_1.SUBSCRIPTION_CANCELLATION_REASONS).nullable(),
|
|
83
|
+
comment: zod_1.z.string().nullable(),
|
|
84
|
+
})
|
|
85
|
+
.strict(),
|
|
86
|
+
pause_collection: zod_1.z
|
|
87
|
+
.object({
|
|
88
|
+
behavior: zod_1.z.enum(subscriptions_1.PAUSE_COLLECTION_BEHAVIORS),
|
|
89
|
+
resumes_at: primitives_1.unixSeconds.nullable(),
|
|
90
|
+
})
|
|
91
|
+
.strict()
|
|
92
|
+
.nullable(),
|
|
93
|
+
automatic_tax: zod_1.z.object({ enabled: zod_1.z.boolean() }).strict(),
|
|
94
|
+
discount: exports.discountSchema.nullable(),
|
|
95
|
+
latest_invoice: (0, objects_2.expandable)('invoice', '`in_…`, or the Invoice with `expand[]=latest_invoice`.').nullable(),
|
|
96
|
+
test_clock: zod_1.z
|
|
97
|
+
.string()
|
|
98
|
+
.nullable()
|
|
99
|
+
.describe('The test clock (`clock_…`) the customer is attached to; test mode only.'),
|
|
100
|
+
metadata: primitives_1.metadata,
|
|
101
|
+
created: primitives_1.unixSeconds,
|
|
102
|
+
})
|
|
103
|
+
.strict(), {
|
|
104
|
+
examples: [
|
|
105
|
+
{
|
|
106
|
+
id: 'sub_0193b8f2c1a87d3e9f4a',
|
|
107
|
+
object: 'subscription',
|
|
108
|
+
livemode: false,
|
|
109
|
+
customer: 'cus_0193b8f2c1a87d3e9f4a',
|
|
110
|
+
status: 'active',
|
|
111
|
+
currency: 'EUR',
|
|
112
|
+
items: {
|
|
113
|
+
object: 'list',
|
|
114
|
+
data: [],
|
|
115
|
+
has_more: false,
|
|
116
|
+
url: '/v1/subscription_items?subscription=sub_0193b8f2c1a87d3e9f4a',
|
|
117
|
+
},
|
|
118
|
+
collection_method: 'charge_automatically',
|
|
119
|
+
days_until_due: null,
|
|
120
|
+
default_payment_method: 'pm_0193b8f2c1a87d3e9f4a',
|
|
121
|
+
description: null,
|
|
122
|
+
billing_cycle_anchor: 1793750400,
|
|
123
|
+
current_period_start: 1793750400,
|
|
124
|
+
current_period_end: 1796428800,
|
|
125
|
+
start_date: 1793750400,
|
|
126
|
+
trial_start: null,
|
|
127
|
+
trial_end: null,
|
|
128
|
+
trial_settings: { end_behavior: { missing_payment_method: 'create_invoice' } },
|
|
129
|
+
cancel_at_period_end: false,
|
|
130
|
+
cancel_at: null,
|
|
131
|
+
canceled_at: null,
|
|
132
|
+
ended_at: null,
|
|
133
|
+
cancellation_details: { reason: null, comment: null },
|
|
134
|
+
pause_collection: null,
|
|
135
|
+
automatic_tax: { enabled: false },
|
|
136
|
+
discount: null,
|
|
137
|
+
latest_invoice: 'in_0193b8f2c1a87d3e9f4a',
|
|
138
|
+
test_clock: null,
|
|
139
|
+
metadata: {},
|
|
140
|
+
created: 1793750400,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
});
|
|
144
|
+
// ---- Requests ------------------------------------------------------------------------
|
|
145
|
+
/** `trial_end`: Unix seconds, or `'now'` to end the trial at once. */
|
|
146
|
+
const trialEndParam = zod_1.z.union([params_1.unixSecondsParam, zod_1.z.literal('now')]);
|
|
147
|
+
/**
|
|
148
|
+
* An item's metadata in `items[]` of an update and on an item update: the
|
|
149
|
+
* named keys are set on the item (a merge, never an unset).
|
|
150
|
+
*/
|
|
151
|
+
const itemMetadataParam = zod_1.z.record(zod_1.z.string().max(40), zod_1.z.string().max(500));
|
|
152
|
+
const createSubscriptionItemEntry = zod_1.z
|
|
153
|
+
.object({
|
|
154
|
+
price: params_1.idParam,
|
|
155
|
+
quantity: params_2.quantityParam.optional(),
|
|
156
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
157
|
+
})
|
|
158
|
+
.strict();
|
|
159
|
+
exports.createSubscriptionParams = zod_1.z
|
|
160
|
+
.object({
|
|
161
|
+
customer: params_1.idParam,
|
|
162
|
+
items: zod_1.z.array(createSubscriptionItemEntry).min(1).max(20),
|
|
163
|
+
default_payment_method: params_1.idParam.optional(),
|
|
164
|
+
collection_method: zod_1.z.enum(subscriptions_1.COLLECTION_METHODS).optional(),
|
|
165
|
+
days_until_due: params_2.daysUntilDueParam.optional(),
|
|
166
|
+
description: (0, params_2.shortText)(500).optional(),
|
|
167
|
+
trial_period_days: zod_1.z.number().int().min(1).max(730).optional(),
|
|
168
|
+
trial_end: trialEndParam.optional(),
|
|
169
|
+
trial_settings: zod_1.z
|
|
170
|
+
.object({
|
|
171
|
+
end_behavior: zod_1.z.object({ missing_payment_method: zod_1.z.enum(subscriptions_1.TRIAL_END_BEHAVIORS) }).strict(),
|
|
172
|
+
})
|
|
173
|
+
.strict()
|
|
174
|
+
.optional(),
|
|
175
|
+
billing_cycle_anchor: params_1.unixSecondsParam.optional(),
|
|
176
|
+
proration_behavior: zod_1.z.enum(subscriptions_1.CREATE_PRORATION_BEHAVIORS).optional(),
|
|
177
|
+
cancel_at_period_end: zod_1.z.boolean().optional(),
|
|
178
|
+
cancel_at: params_1.unixSecondsParam.optional(),
|
|
179
|
+
coupon: params_1.idParam.optional(),
|
|
180
|
+
promotion_code: params_1.idParam.optional(),
|
|
181
|
+
discounts: params_2.discountsParam.optional(),
|
|
182
|
+
payment_behavior: zod_1.z.enum(subscriptions_1.PAYMENT_BEHAVIORS).optional(),
|
|
183
|
+
automatic_tax: params_2.automaticTaxParam.optional(),
|
|
184
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
185
|
+
expand: params_1.expandParam.optional(),
|
|
186
|
+
})
|
|
187
|
+
.strict();
|
|
188
|
+
/** A subscription item as `items[]` of an update names it. */
|
|
189
|
+
const updateSubscriptionItemEntry = zod_1.z
|
|
190
|
+
.object({
|
|
191
|
+
id: params_1.idParam.optional().describe('The `si_…` to change or remove; absent, a new item.'),
|
|
192
|
+
price: params_1.idParam.optional(),
|
|
193
|
+
quantity: params_2.quantityParam.optional(),
|
|
194
|
+
deleted: zod_1.z.boolean().optional().describe('Remove this item.'),
|
|
195
|
+
metadata: itemMetadataParam.optional(),
|
|
196
|
+
})
|
|
197
|
+
.strict();
|
|
198
|
+
/** A field sent as `""` is cleared; `metadata` is a patch. */
|
|
199
|
+
exports.updateSubscriptionParams = zod_1.z
|
|
200
|
+
.object({
|
|
201
|
+
items: zod_1.z.array(updateSubscriptionItemEntry).min(1).max(20).optional(),
|
|
202
|
+
proration_behavior: zod_1.z.enum(subscriptions_1.PRORATION_BEHAVIORS).optional(),
|
|
203
|
+
proration_date: params_1.unixSecondsParam
|
|
204
|
+
.optional()
|
|
205
|
+
.describe('The instant prorations are computed at; defaults to now.'),
|
|
206
|
+
default_payment_method: zod_1.z.union([params_1.idParam, zod_1.z.literal('')]).optional(),
|
|
207
|
+
collection_method: zod_1.z.enum(subscriptions_1.COLLECTION_METHODS).optional(),
|
|
208
|
+
days_until_due: params_2.daysUntilDueParam.optional(),
|
|
209
|
+
description: zod_1.z.union([(0, params_2.shortText)(500), zod_1.z.literal('')]).optional(),
|
|
210
|
+
cancel_at_period_end: zod_1.z.boolean().optional(),
|
|
211
|
+
cancel_at: zod_1.z.union([params_1.unixSecondsParam, zod_1.z.literal('')]).optional(),
|
|
212
|
+
pause_collection: zod_1.z
|
|
213
|
+
.union([
|
|
214
|
+
zod_1.z
|
|
215
|
+
.object({
|
|
216
|
+
behavior: zod_1.z.enum(subscriptions_1.PAUSE_COLLECTION_BEHAVIORS),
|
|
217
|
+
resumes_at: params_1.unixSecondsParam.optional(),
|
|
218
|
+
})
|
|
219
|
+
.strict(),
|
|
220
|
+
zod_1.z.literal(''),
|
|
221
|
+
])
|
|
222
|
+
.optional()
|
|
223
|
+
.describe('`""` resumes collection.'),
|
|
224
|
+
trial_end: trialEndParam.optional(),
|
|
225
|
+
coupon: zod_1.z.union([params_1.idParam, zod_1.z.literal('')]).optional(),
|
|
226
|
+
promotion_code: params_1.idParam.optional(),
|
|
227
|
+
discounts: zod_1.z.union([params_2.discountsParam, zod_1.z.literal('')]).optional(),
|
|
228
|
+
payment_behavior: zod_1.z.enum(subscriptions_1.PAYMENT_BEHAVIORS).optional(),
|
|
229
|
+
automatic_tax: params_2.automaticTaxParam.optional(),
|
|
230
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
231
|
+
expand: params_1.expandParam.optional(),
|
|
232
|
+
})
|
|
233
|
+
.strict();
|
|
234
|
+
/** `DELETE /v1/subscriptions/:id`: cancel now. */
|
|
235
|
+
exports.cancelSubscriptionParams = zod_1.z
|
|
236
|
+
.object({
|
|
237
|
+
invoice_now: zod_1.z
|
|
238
|
+
.boolean()
|
|
239
|
+
.optional()
|
|
240
|
+
.describe('Bill pending items and prorations now, in a final invoice.'),
|
|
241
|
+
prorate: zod_1.z.boolean().optional().describe('Credit the unused time of the current period.'),
|
|
242
|
+
cancellation_details: zod_1.z
|
|
243
|
+
.object({ comment: (0, params_2.shortText)(5000).optional() })
|
|
244
|
+
.strict()
|
|
245
|
+
.optional(),
|
|
246
|
+
expand: params_1.expandParam.optional(),
|
|
247
|
+
})
|
|
248
|
+
.strict();
|
|
249
|
+
/** `POST /v1/subscriptions/:id/resume` — a `paused` subscription. */
|
|
250
|
+
exports.resumeSubscriptionParams = zod_1.z
|
|
251
|
+
.object({
|
|
252
|
+
billing_cycle_anchor: zod_1.z
|
|
253
|
+
.enum(subscriptions_1.RESUME_BILLING_CYCLE_ANCHORS)
|
|
254
|
+
.optional()
|
|
255
|
+
.describe('`now` (default) starts a new period at once; `unchanged` keeps the anchor.'),
|
|
256
|
+
proration_behavior: zod_1.z.enum(subscriptions_1.PRORATION_BEHAVIORS).optional(),
|
|
257
|
+
expand: params_1.expandParam.optional(),
|
|
258
|
+
})
|
|
259
|
+
.strict();
|
|
260
|
+
exports.listSubscriptionsQuery = (0, params_1.listQuery)({
|
|
261
|
+
customer: params_1.idParam.optional(),
|
|
262
|
+
price: params_1.idParam.optional(),
|
|
263
|
+
status: zod_1.z
|
|
264
|
+
.enum(subscriptions_1.SUBSCRIPTION_LIST_STATUSES)
|
|
265
|
+
.optional()
|
|
266
|
+
.describe('A status, `all` (including canceled), or `ended` (canceled and incomplete_expired).'),
|
|
267
|
+
test_clock: params_1.idParam.optional(),
|
|
268
|
+
current_period_end: params_1.rangeParam.optional(),
|
|
269
|
+
});
|
|
270
|
+
exports.createSubscriptionItemParams = zod_1.z
|
|
271
|
+
.object({
|
|
272
|
+
subscription: params_1.idParam,
|
|
273
|
+
price: params_1.idParam,
|
|
274
|
+
quantity: params_2.quantityParam.optional(),
|
|
275
|
+
proration_behavior: zod_1.z.enum(subscriptions_1.PRORATION_BEHAVIORS).optional(),
|
|
276
|
+
proration_date: params_1.unixSecondsParam.optional(),
|
|
277
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
278
|
+
})
|
|
279
|
+
.strict();
|
|
280
|
+
exports.updateSubscriptionItemParams = zod_1.z
|
|
281
|
+
.object({
|
|
282
|
+
price: params_1.idParam.optional(),
|
|
283
|
+
quantity: params_2.quantityParam.optional(),
|
|
284
|
+
proration_behavior: zod_1.z.enum(subscriptions_1.PRORATION_BEHAVIORS).optional(),
|
|
285
|
+
proration_date: params_1.unixSecondsParam.optional(),
|
|
286
|
+
metadata: itemMetadataParam.optional(),
|
|
287
|
+
})
|
|
288
|
+
.strict();
|
|
289
|
+
exports.deleteSubscriptionItemParams = zod_1.z
|
|
290
|
+
.object({
|
|
291
|
+
proration_behavior: zod_1.z.enum(subscriptions_1.PRORATION_BEHAVIORS).optional(),
|
|
292
|
+
proration_date: params_1.unixSecondsParam.optional(),
|
|
293
|
+
})
|
|
294
|
+
.strict();
|
|
295
|
+
/** `subscription` is REQUIRED: items are listed per subscription. */
|
|
296
|
+
exports.listSubscriptionItemsQuery = (0, params_1.listQuery)({
|
|
297
|
+
subscription: params_1.idParam.describe('The subscription (`sub_…`) whose items to list.'),
|
|
298
|
+
});
|
|
299
|
+
// ---- Routes --------------------------------------------------------------------------
|
|
300
|
+
const subscriptionId = { id: 'The subscription (`sub_…`).' };
|
|
301
|
+
const itemId = { id: 'The subscription item (`si_…`).' };
|
|
302
|
+
exports.subscriptionRoutes = [
|
|
303
|
+
(0, route_1.defineRoute)({
|
|
304
|
+
operationId: 'createSubscription',
|
|
305
|
+
method: 'post',
|
|
306
|
+
path: '/v1/subscriptions',
|
|
307
|
+
tag: 'Subscriptions',
|
|
308
|
+
summary: 'Create a subscription',
|
|
309
|
+
description: '`payment_behavior` decides what happens when the first invoice cannot be paid at once.',
|
|
310
|
+
auth: 'service',
|
|
311
|
+
scope: 'payments:write',
|
|
312
|
+
idempotent: true,
|
|
313
|
+
body: exports.createSubscriptionParams,
|
|
314
|
+
response: exports.subscriptionSchema,
|
|
315
|
+
sdk: 'subscriptions.create',
|
|
316
|
+
expandable: 'subscription',
|
|
317
|
+
}),
|
|
318
|
+
(0, route_1.defineRoute)({
|
|
319
|
+
operationId: 'listSubscriptions',
|
|
320
|
+
method: 'get',
|
|
321
|
+
path: '/v1/subscriptions',
|
|
322
|
+
tag: 'Subscriptions',
|
|
323
|
+
summary: 'List subscriptions',
|
|
324
|
+
description: 'Newest first. Without `status`, every subscription but the canceled ones.',
|
|
325
|
+
auth: 'service',
|
|
326
|
+
scope: 'payments:read',
|
|
327
|
+
query: exports.listSubscriptionsQuery,
|
|
328
|
+
response: (0, envelopes_1.listOf)(exports.subscriptionSchema),
|
|
329
|
+
sdk: 'subscriptions.list',
|
|
330
|
+
expandable: 'subscription',
|
|
331
|
+
}),
|
|
332
|
+
(0, route_1.defineRoute)({
|
|
333
|
+
operationId: 'retrieveSubscription',
|
|
334
|
+
method: 'get',
|
|
335
|
+
path: '/v1/subscriptions/{id}',
|
|
336
|
+
tag: 'Subscriptions',
|
|
337
|
+
summary: 'Retrieve a subscription',
|
|
338
|
+
auth: 'service',
|
|
339
|
+
scope: 'payments:read',
|
|
340
|
+
params: subscriptionId,
|
|
341
|
+
query: params_1.expandOnlyQuery,
|
|
342
|
+
response: exports.subscriptionSchema,
|
|
343
|
+
sdk: 'subscriptions.retrieve',
|
|
344
|
+
expandable: 'subscription',
|
|
345
|
+
}),
|
|
346
|
+
(0, route_1.defineRoute)({
|
|
347
|
+
operationId: 'updateSubscription',
|
|
348
|
+
method: 'post',
|
|
349
|
+
path: '/v1/subscriptions/{id}',
|
|
350
|
+
tag: 'Subscriptions',
|
|
351
|
+
summary: 'Update a subscription',
|
|
352
|
+
description: 'Items, plan changes (prorated as `proration_behavior` says), collection, trial, cancellation at period end, pausing and discounts. A field sent as `""` is cleared; `metadata` is a patch.',
|
|
353
|
+
auth: 'service',
|
|
354
|
+
scope: 'payments:write',
|
|
355
|
+
idempotent: true,
|
|
356
|
+
params: subscriptionId,
|
|
357
|
+
body: exports.updateSubscriptionParams,
|
|
358
|
+
response: exports.subscriptionSchema,
|
|
359
|
+
sdk: 'subscriptions.update',
|
|
360
|
+
expandable: 'subscription',
|
|
361
|
+
}),
|
|
362
|
+
(0, route_1.defineRoute)({
|
|
363
|
+
operationId: 'cancelSubscription',
|
|
364
|
+
method: 'delete',
|
|
365
|
+
path: '/v1/subscriptions/{id}',
|
|
366
|
+
tag: 'Subscriptions',
|
|
367
|
+
summary: 'Cancel a subscription',
|
|
368
|
+
description: 'Now, optionally prorating the unused time and invoicing at once. Answers the canceled subscription.',
|
|
369
|
+
auth: 'service',
|
|
370
|
+
scope: 'payments:write',
|
|
371
|
+
params: subscriptionId,
|
|
372
|
+
body: exports.cancelSubscriptionParams,
|
|
373
|
+
response: exports.subscriptionSchema,
|
|
374
|
+
sdk: 'subscriptions.cancel',
|
|
375
|
+
expandable: 'subscription',
|
|
376
|
+
}),
|
|
377
|
+
(0, route_1.defineRoute)({
|
|
378
|
+
operationId: 'resumeSubscription',
|
|
379
|
+
method: 'post',
|
|
380
|
+
path: '/v1/subscriptions/{id}/resume',
|
|
381
|
+
tag: 'Subscriptions',
|
|
382
|
+
summary: 'Resume a paused subscription',
|
|
383
|
+
auth: 'service',
|
|
384
|
+
scope: 'payments:write',
|
|
385
|
+
idempotent: true,
|
|
386
|
+
params: subscriptionId,
|
|
387
|
+
body: exports.resumeSubscriptionParams,
|
|
388
|
+
response: exports.subscriptionSchema,
|
|
389
|
+
sdk: 'subscriptions.resume',
|
|
390
|
+
expandable: 'subscription',
|
|
391
|
+
}),
|
|
392
|
+
(0, route_1.defineRoute)({
|
|
393
|
+
operationId: 'searchSubscriptions',
|
|
394
|
+
method: 'get',
|
|
395
|
+
path: '/v1/subscriptions/search',
|
|
396
|
+
tag: 'Subscriptions',
|
|
397
|
+
summary: 'Search subscriptions',
|
|
398
|
+
description: "Stripe's query language over the subscription's fields and `metadata['key']`.",
|
|
399
|
+
auth: 'service',
|
|
400
|
+
scope: 'payments:read',
|
|
401
|
+
query: params_1.searchQuery,
|
|
402
|
+
response: (0, envelopes_1.searchResultOf)(exports.subscriptionSchema),
|
|
403
|
+
sdk: 'subscriptions.search',
|
|
404
|
+
expandable: 'subscription',
|
|
405
|
+
}),
|
|
406
|
+
(0, route_1.defineRoute)({
|
|
407
|
+
operationId: 'createSubscriptionItem',
|
|
408
|
+
method: 'post',
|
|
409
|
+
path: '/v1/subscription_items',
|
|
410
|
+
tag: 'Subscription items',
|
|
411
|
+
summary: 'Add an item to a subscription',
|
|
412
|
+
description: 'Prorated as `proration_behavior` says.',
|
|
413
|
+
auth: 'service',
|
|
414
|
+
scope: 'payments:write',
|
|
415
|
+
idempotent: true,
|
|
416
|
+
body: exports.createSubscriptionItemParams,
|
|
417
|
+
response: exports.subscriptionItemSchema,
|
|
418
|
+
sdk: 'subscriptionItems.create',
|
|
419
|
+
}),
|
|
420
|
+
(0, route_1.defineRoute)({
|
|
421
|
+
operationId: 'listSubscriptionItems',
|
|
422
|
+
method: 'get',
|
|
423
|
+
path: '/v1/subscription_items',
|
|
424
|
+
tag: 'Subscription items',
|
|
425
|
+
summary: "List a subscription's items",
|
|
426
|
+
auth: 'service',
|
|
427
|
+
scope: 'payments:read',
|
|
428
|
+
query: exports.listSubscriptionItemsQuery,
|
|
429
|
+
response: (0, envelopes_1.listOf)(exports.subscriptionItemSchema),
|
|
430
|
+
sdk: 'subscriptionItems.list',
|
|
431
|
+
expandable: 'subscription_item',
|
|
432
|
+
}),
|
|
433
|
+
(0, route_1.defineRoute)({
|
|
434
|
+
operationId: 'retrieveSubscriptionItem',
|
|
435
|
+
method: 'get',
|
|
436
|
+
path: '/v1/subscription_items/{id}',
|
|
437
|
+
tag: 'Subscription items',
|
|
438
|
+
summary: 'Retrieve a subscription item',
|
|
439
|
+
auth: 'service',
|
|
440
|
+
scope: 'payments:read',
|
|
441
|
+
params: itemId,
|
|
442
|
+
query: params_1.expandOnlyQuery,
|
|
443
|
+
response: exports.subscriptionItemSchema,
|
|
444
|
+
sdk: 'subscriptionItems.retrieve',
|
|
445
|
+
expandable: 'subscription_item',
|
|
446
|
+
}),
|
|
447
|
+
(0, route_1.defineRoute)({
|
|
448
|
+
operationId: 'updateSubscriptionItem',
|
|
449
|
+
method: 'post',
|
|
450
|
+
path: '/v1/subscription_items/{id}',
|
|
451
|
+
tag: 'Subscription items',
|
|
452
|
+
summary: 'Update a subscription item',
|
|
453
|
+
description: 'Its price or quantity, prorated as `proration_behavior` says.',
|
|
454
|
+
auth: 'service',
|
|
455
|
+
scope: 'payments:write',
|
|
456
|
+
idempotent: true,
|
|
457
|
+
params: itemId,
|
|
458
|
+
body: exports.updateSubscriptionItemParams,
|
|
459
|
+
response: exports.subscriptionItemSchema,
|
|
460
|
+
sdk: 'subscriptionItems.update',
|
|
461
|
+
}),
|
|
462
|
+
(0, route_1.defineRoute)({
|
|
463
|
+
operationId: 'deleteSubscriptionItem',
|
|
464
|
+
method: 'delete',
|
|
465
|
+
path: '/v1/subscription_items/{id}',
|
|
466
|
+
tag: 'Subscription items',
|
|
467
|
+
summary: 'Remove an item from a subscription',
|
|
468
|
+
description: 'Prorated as `proration_behavior` says.',
|
|
469
|
+
auth: 'service',
|
|
470
|
+
scope: 'payments:write',
|
|
471
|
+
params: itemId,
|
|
472
|
+
body: exports.deleteSubscriptionItemParams,
|
|
473
|
+
response: exports.deletedSubscriptionItemSchema,
|
|
474
|
+
sdk: 'subscriptionItems.del',
|
|
475
|
+
}),
|
|
476
|
+
];
|