@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,579 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CATALOG_LIMITS, PRICE_TAX_BEHAVIORS, RECURRING_INTERVALS } from '../../vocabulary/catalog.js';
|
|
3
|
+
import { SETUP_INTENT_STATUSES } from '../../vocabulary/payments.js';
|
|
4
|
+
import { billingFaircoinFxQuoteSchema } from '../catalog/billing.js';
|
|
5
|
+
import { embedded } from '../../common/objects.js';
|
|
6
|
+
import { listOf } from '../../common/envelopes.js';
|
|
7
|
+
import { defineComponent, defineObject, expandable } from '../../common/objects.js';
|
|
8
|
+
import { expandOnlyQuery, expandParam, listQuery, metadataCreateParam, metadataUpdateParam, } from '../../common/params.js';
|
|
9
|
+
import { amount, currency, livemode, metadata, network, unixSeconds, } from '../../common/primitives.js';
|
|
10
|
+
import { defineRoute } from '../../route.js';
|
|
11
|
+
import { CHECKOUT_CUSTOMER_CREATIONS, CHECKOUT_LIMITS, CHECKOUT_LOCALES, CHECKOUT_PAYMENT_STATUSES, CHECKOUT_SESSION_MODES, CHECKOUT_SESSION_STATUSES, CHECKOUT_SUBMIT_TYPES, CHECKOUT_TAX_ID_TYPES, CHECKOUT_UI_MODES, } from '../../vocabulary/checkout.js';
|
|
12
|
+
import { adjustableIssues, adjustableQuantityParam, amountParam, checkoutAutomaticTaxSchema, checkoutBrandingSchema, checkoutConsentSchema, checkoutCustomerDetailsSchema, checkoutDiscountSchema, checkoutIdParam, checkoutLineItemSchema, checkoutShippingDetailsSchema, checkoutTotalDetailsSchema, collectionParams, collectionResponseFields, countryCodeParam, checkoutEmailParam, localeParam, merchantDisplaySchema, quantityParam, railSchema, redirectUrlParam, } from './shared.js';
|
|
13
|
+
/**
|
|
14
|
+
* Checkout Sessions (`cs_…`, Orbit Phase 3) — Stripe Checkout's session model:
|
|
15
|
+
* a session is an ORDER (line items, discounts, tax, what to collect from the
|
|
16
|
+
* payer) that a payer completes on Peable's hosted or embedded checkout. The
|
|
17
|
+
* PaymentIntent (or SetupIntent) is created when the payer confirms, with the
|
|
18
|
+
* amount the session computed, and linked. Amounts are base-unit strings.
|
|
19
|
+
*/
|
|
20
|
+
const sessionFields = {
|
|
21
|
+
id: z.string(),
|
|
22
|
+
object: z.literal('checkout_session'),
|
|
23
|
+
livemode,
|
|
24
|
+
mode: z.enum(CHECKOUT_SESSION_MODES),
|
|
25
|
+
status: z.enum(CHECKOUT_SESSION_STATUSES),
|
|
26
|
+
payment_status: z.enum(CHECKOUT_PAYMENT_STATUSES),
|
|
27
|
+
ui_mode: z.enum(CHECKOUT_UI_MODES),
|
|
28
|
+
locale: z
|
|
29
|
+
.enum(CHECKOUT_LOCALES)
|
|
30
|
+
.nullable()
|
|
31
|
+
.describe("The language checkout renders in; `null` follows the payer's browser."),
|
|
32
|
+
submit_type: z.enum(CHECKOUT_SUBMIT_TYPES),
|
|
33
|
+
currency,
|
|
34
|
+
rail: railSchema,
|
|
35
|
+
network: network.nullable().describe('FairCoin rail only; `null` on a card session.'),
|
|
36
|
+
amount_subtotal: amount,
|
|
37
|
+
amount_total: amount,
|
|
38
|
+
total_details: checkoutTotalDetailsSchema,
|
|
39
|
+
allow_promotion_codes: z.boolean(),
|
|
40
|
+
automatic_tax: checkoutAutomaticTaxSchema,
|
|
41
|
+
...collectionResponseFields,
|
|
42
|
+
shipping_details: checkoutShippingDetailsSchema.nullable(),
|
|
43
|
+
consent: checkoutConsentSchema.nullable(),
|
|
44
|
+
expires_at: unixSeconds,
|
|
45
|
+
};
|
|
46
|
+
/** The merchant/SDK-facing session — Stripe's Checkout Session. */
|
|
47
|
+
export const checkoutSessionSchema = defineObject('checkout_session', 'CheckoutSession', z
|
|
48
|
+
.object({
|
|
49
|
+
...sessionFields,
|
|
50
|
+
payment_method_types: z.array(railSchema),
|
|
51
|
+
discounts: z.array(checkoutDiscountSchema),
|
|
52
|
+
customer: expandable('customer', '`cus_…` (expandable) — given on create, or created at completion.').nullable(),
|
|
53
|
+
customer_email: z.string().nullable(),
|
|
54
|
+
customer_creation: z.enum(CHECKOUT_CUSTOMER_CREATIONS),
|
|
55
|
+
customer_details: checkoutCustomerDetailsSchema.nullable(),
|
|
56
|
+
payment_intent: expandable('payment_intent', 'The payment this session created (`pi_…`, expandable) once the payer confirmed; `null` before, and always in `setup` mode.').nullable(),
|
|
57
|
+
setup_intent: expandable('setup_intent', '`setup` mode: the SetupIntent (`seti_…`, expandable) once confirmed.').nullable(),
|
|
58
|
+
connected_account: expandable('connected_account', 'The seller an on-behalf payment pays (`ca_…`, expandable).').nullable(),
|
|
59
|
+
payment_link: z
|
|
60
|
+
.string()
|
|
61
|
+
.nullable()
|
|
62
|
+
.describe('The payment link this session was created from (`link_…`), if any.'),
|
|
63
|
+
client_reference_id: z.string().nullable(),
|
|
64
|
+
metadata,
|
|
65
|
+
success_url: z
|
|
66
|
+
.string()
|
|
67
|
+
.nullable()
|
|
68
|
+
.describe('With `{CHECKOUT_SESSION_ID}` as given; checkout substitutes it.'),
|
|
69
|
+
cancel_url: z.string().nullable(),
|
|
70
|
+
url: z
|
|
71
|
+
.string()
|
|
72
|
+
.nullable()
|
|
73
|
+
.describe('Hosted mode: the URL to send the payer to. `null` in embedded mode.'),
|
|
74
|
+
client_secret: z
|
|
75
|
+
.string()
|
|
76
|
+
.nullable()
|
|
77
|
+
.describe('Embedded mode: what `PeableCheckout.mountCheckout` takes. `null` in hosted mode.'),
|
|
78
|
+
created: unixSeconds,
|
|
79
|
+
})
|
|
80
|
+
.strict(), {
|
|
81
|
+
examples: [
|
|
82
|
+
{
|
|
83
|
+
id: 'cs_0193b8f2c1a87d3e9f4a',
|
|
84
|
+
object: 'checkout_session',
|
|
85
|
+
livemode: false,
|
|
86
|
+
mode: 'payment',
|
|
87
|
+
status: 'open',
|
|
88
|
+
payment_status: 'unpaid',
|
|
89
|
+
ui_mode: 'hosted',
|
|
90
|
+
locale: null,
|
|
91
|
+
submit_type: 'auto',
|
|
92
|
+
currency: 'EUR',
|
|
93
|
+
rail: 'card',
|
|
94
|
+
network: null,
|
|
95
|
+
payment_method_types: ['card'],
|
|
96
|
+
amount_subtotal: '1999',
|
|
97
|
+
amount_total: '1999',
|
|
98
|
+
total_details: { amount_discount: '0', amount_tax: '0', amount_shipping: '0' },
|
|
99
|
+
discounts: [],
|
|
100
|
+
allow_promotion_codes: false,
|
|
101
|
+
automatic_tax: { enabled: false, status: null },
|
|
102
|
+
customer: null,
|
|
103
|
+
customer_email: 'jenny@example.com',
|
|
104
|
+
customer_creation: 'if_required',
|
|
105
|
+
customer_details: null,
|
|
106
|
+
billing_address_collection: 'auto',
|
|
107
|
+
shipping_address_collection: null,
|
|
108
|
+
shipping_details: null,
|
|
109
|
+
phone_number_collection: { enabled: false },
|
|
110
|
+
tax_id_collection: { enabled: false },
|
|
111
|
+
custom_fields: [],
|
|
112
|
+
consent_collection: null,
|
|
113
|
+
consent: null,
|
|
114
|
+
payment_intent: null,
|
|
115
|
+
setup_intent: null,
|
|
116
|
+
connected_account: null,
|
|
117
|
+
payment_link: null,
|
|
118
|
+
client_reference_id: null,
|
|
119
|
+
metadata: {},
|
|
120
|
+
success_url: 'https://example.com/thanks?session={CHECKOUT_SESSION_ID}',
|
|
121
|
+
cancel_url: null,
|
|
122
|
+
url: 'https://checkout.peable.to/c/cs_0193b8f2c1a87d3e9f4a#cs=cs_0193b8f2c1a87d3e9f4a_secret_x',
|
|
123
|
+
client_secret: null,
|
|
124
|
+
expires_at: 1793836800,
|
|
125
|
+
created: 1793750400,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* What the hosted/embedded checkout loads, authorized by the session's
|
|
131
|
+
* `client_secret` (or, for a session wrapping a payment, that payment's). No
|
|
132
|
+
* metadata, no client reference, no internal ids.
|
|
133
|
+
*/
|
|
134
|
+
export const checkoutSessionPublicSchema = defineComponent('CheckoutSessionPublic', z
|
|
135
|
+
.object({
|
|
136
|
+
...sessionFields,
|
|
137
|
+
line_items: z.array(checkoutLineItemSchema),
|
|
138
|
+
discount: z
|
|
139
|
+
.object({
|
|
140
|
+
promotion_code: z.string().nullable().describe('The code the payer typed.'),
|
|
141
|
+
coupon_name: z.string().nullable(),
|
|
142
|
+
amount_off: amount.nullable(),
|
|
143
|
+
percent_off: z.number().nullable(),
|
|
144
|
+
})
|
|
145
|
+
.strict()
|
|
146
|
+
.nullable()
|
|
147
|
+
.describe('The discount applied, as the payer sees it.'),
|
|
148
|
+
customer_details: checkoutCustomerDetailsSchema.describe('Prefilled from `customer_email` / the customer; then what the payer entered.'),
|
|
149
|
+
customer_email_locked: z
|
|
150
|
+
.boolean()
|
|
151
|
+
.describe('Whether the email is fixed by the merchant (a `customer` or `customer_email`).'),
|
|
152
|
+
terms_of_service_url: z
|
|
153
|
+
.string()
|
|
154
|
+
.nullable()
|
|
155
|
+
.describe("The merchant's terms URL when `consent_collection.terms_of_service` is required."),
|
|
156
|
+
payment_intent: embedded('payment_intent')
|
|
157
|
+
.nullable()
|
|
158
|
+
.describe("The payment the payer confirmed — with its `client_secret`, the payer's capability."),
|
|
159
|
+
setup_intent: z
|
|
160
|
+
.object({
|
|
161
|
+
id: z.string(),
|
|
162
|
+
client_secret: z.string(),
|
|
163
|
+
status: z.enum(SETUP_INTENT_STATUSES),
|
|
164
|
+
})
|
|
165
|
+
.strict()
|
|
166
|
+
.nullable()
|
|
167
|
+
.describe('`setup` mode: the SetupIntent id and client secret, once confirmed.'),
|
|
168
|
+
success_url: z
|
|
169
|
+
.string()
|
|
170
|
+
.nullable()
|
|
171
|
+
.describe('`success_url` with `{CHECKOUT_SESSION_ID}` substituted; only once `complete`.'),
|
|
172
|
+
cancel_url: z.string().nullable().describe('Shown as "Back to <merchant>" before payment.'),
|
|
173
|
+
confirmation_message: z
|
|
174
|
+
.string()
|
|
175
|
+
.nullable()
|
|
176
|
+
.describe("A payment link's hosted confirmation, shown once `complete`."),
|
|
177
|
+
merchant: merchantDisplaySchema,
|
|
178
|
+
branding: checkoutBrandingSchema,
|
|
179
|
+
publishable_key: z
|
|
180
|
+
.string()
|
|
181
|
+
.nullable()
|
|
182
|
+
.describe("The card provider's PUBLIC key for this session's mode, so the payment fields can mount before the payment exists. `null` on FairCoin."),
|
|
183
|
+
billing_quote: billingFaircoinFxQuoteSchema
|
|
184
|
+
.optional()
|
|
185
|
+
.describe('FairCoin billing invoices: the frozen USD price and FAIR settlement quote.'),
|
|
186
|
+
})
|
|
187
|
+
.strict());
|
|
188
|
+
// ---- Merchant create/update ---------------------------------------------------
|
|
189
|
+
const productDataParams = z
|
|
190
|
+
.object({
|
|
191
|
+
name: z.string().trim().min(1).max(CATALOG_LIMITS.productNameMax),
|
|
192
|
+
description: z.string().min(1).max(CATALOG_LIMITS.productDescriptionMax).optional(),
|
|
193
|
+
images: z
|
|
194
|
+
.array(z
|
|
195
|
+
.string()
|
|
196
|
+
.max(CATALOG_LIMITS.urlMax)
|
|
197
|
+
.regex(/^https:\/\/\S+$/, 'must be an https URL'))
|
|
198
|
+
.max(8)
|
|
199
|
+
.optional(),
|
|
200
|
+
tax_code: z
|
|
201
|
+
.string()
|
|
202
|
+
.regex(/^txcd_[0-9]{8}$/, 'is not a Peable Tax code (GET /v1/tax/codes lists them)')
|
|
203
|
+
.optional()
|
|
204
|
+
.describe('A Peable Tax code (`GET /v1/tax/codes`).'),
|
|
205
|
+
})
|
|
206
|
+
.strict();
|
|
207
|
+
const priceDataParams = z
|
|
208
|
+
.object({
|
|
209
|
+
currency,
|
|
210
|
+
unit_amount: amountParam,
|
|
211
|
+
product: checkoutIdParam.optional(),
|
|
212
|
+
product_data: productDataParams.optional(),
|
|
213
|
+
recurring: z
|
|
214
|
+
.object({
|
|
215
|
+
interval: z.enum(RECURRING_INTERVALS),
|
|
216
|
+
interval_count: z.number().int().min(1).max(1095).optional(),
|
|
217
|
+
})
|
|
218
|
+
.strict()
|
|
219
|
+
.optional(),
|
|
220
|
+
tax_behavior: z.enum(PRICE_TAX_BEHAVIORS).optional(),
|
|
221
|
+
})
|
|
222
|
+
.strict()
|
|
223
|
+
.superRefine((data, ctx) => {
|
|
224
|
+
if ((data.product === undefined) === (data.product_data === undefined)) {
|
|
225
|
+
ctx.addIssue({
|
|
226
|
+
code: 'custom',
|
|
227
|
+
path: ['product'],
|
|
228
|
+
message: 'exactly one of product and product_data',
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
/** One `line_items[]` entry of a session: exactly one of `price` and `price_data`. */
|
|
233
|
+
export const sessionLineItemParams = z
|
|
234
|
+
.object({
|
|
235
|
+
price: checkoutIdParam.optional(),
|
|
236
|
+
price_data: priceDataParams.optional(),
|
|
237
|
+
quantity: quantityParam,
|
|
238
|
+
adjustable_quantity: adjustableQuantityParam.optional(),
|
|
239
|
+
})
|
|
240
|
+
.strict()
|
|
241
|
+
.superRefine((line, ctx) => {
|
|
242
|
+
if ((line.price === undefined) === (line.price_data === undefined)) {
|
|
243
|
+
ctx.addIssue({
|
|
244
|
+
code: 'custom',
|
|
245
|
+
path: ['price'],
|
|
246
|
+
message: 'exactly one of price and price_data',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
adjustableIssues(line.quantity, line.adjustable_quantity, ctx);
|
|
250
|
+
});
|
|
251
|
+
const discountParam = z.union([
|
|
252
|
+
z.object({ coupon: checkoutIdParam }).strict(),
|
|
253
|
+
z.object({ promotion_code: checkoutIdParam }).strict(),
|
|
254
|
+
]);
|
|
255
|
+
export const createCheckoutSessionParams = z
|
|
256
|
+
.object({
|
|
257
|
+
mode: z.enum(CHECKOUT_SESSION_MODES).optional().describe('Default `payment`.'),
|
|
258
|
+
line_items: z
|
|
259
|
+
.array(sessionLineItemParams)
|
|
260
|
+
.min(1)
|
|
261
|
+
.max(CHECKOUT_LIMITS.lineItemsMax)
|
|
262
|
+
.optional()
|
|
263
|
+
.describe('Required in `payment` and `subscription` mode; refused in `setup` mode.'),
|
|
264
|
+
currency: currency
|
|
265
|
+
.optional()
|
|
266
|
+
.describe('`setup` mode: the currency of the method being saved (card rail only).'),
|
|
267
|
+
discounts: z
|
|
268
|
+
.array(discountParam)
|
|
269
|
+
.max(1)
|
|
270
|
+
.optional()
|
|
271
|
+
.describe('At most one; mutually exclusive with `allow_promotion_codes`.'),
|
|
272
|
+
allow_promotion_codes: z.boolean().optional(),
|
|
273
|
+
customer: checkoutIdParam
|
|
274
|
+
.optional()
|
|
275
|
+
.describe('`cus_…`; mutually exclusive with `customer_email`.'),
|
|
276
|
+
customer_email: checkoutEmailParam.optional(),
|
|
277
|
+
customer_creation: z
|
|
278
|
+
.enum(CHECKOUT_CUSTOMER_CREATIONS)
|
|
279
|
+
.optional()
|
|
280
|
+
.describe('Default `if_required` (a customer is created only when something needs one).'),
|
|
281
|
+
...collectionParams,
|
|
282
|
+
automatic_tax: z.object({ enabled: z.boolean() }).strict().optional(),
|
|
283
|
+
payment_method_types: z
|
|
284
|
+
.array(z.enum(['card', 'faircoin']))
|
|
285
|
+
.min(1)
|
|
286
|
+
.max(1)
|
|
287
|
+
.optional()
|
|
288
|
+
.describe("`['card']` or `['faircoin']` — the rail the line items' currency allows."),
|
|
289
|
+
locale: localeParam.optional(),
|
|
290
|
+
ui_mode: z.enum(CHECKOUT_UI_MODES).optional(),
|
|
291
|
+
success_url: redirectUrlParam
|
|
292
|
+
.optional()
|
|
293
|
+
.describe('Required in hosted mode; may carry `{CHECKOUT_SESSION_ID}`.'),
|
|
294
|
+
cancel_url: redirectUrlParam
|
|
295
|
+
.optional()
|
|
296
|
+
.describe('Hosted mode only: the "Back to merchant" link.'),
|
|
297
|
+
expires_at: z
|
|
298
|
+
.number()
|
|
299
|
+
.int()
|
|
300
|
+
.positive()
|
|
301
|
+
.optional()
|
|
302
|
+
.describe('Unix seconds, 30 minutes to 24 hours from now. Default 24 hours.'),
|
|
303
|
+
client_reference_id: z.string().min(1).max(CHECKOUT_LIMITS.clientReferenceIdMax).optional(),
|
|
304
|
+
metadata: metadataCreateParam.optional(),
|
|
305
|
+
submit_type: z.enum(CHECKOUT_SUBMIT_TYPES).optional(),
|
|
306
|
+
connected_account: checkoutIdParam
|
|
307
|
+
.optional()
|
|
308
|
+
.describe('Pay this seller (`ca_…`) rather than the merchant (ADR 0012); FairCoin only.'),
|
|
309
|
+
expand: expandParam.optional(),
|
|
310
|
+
})
|
|
311
|
+
.strict()
|
|
312
|
+
.superRefine((body, ctx) => {
|
|
313
|
+
const issue = (path, message) => ctx.addIssue({ code: 'custom', path: [path], message });
|
|
314
|
+
const mode = body.mode ?? 'payment';
|
|
315
|
+
if (mode === 'setup') {
|
|
316
|
+
if (body.line_items)
|
|
317
|
+
issue('line_items', 'a setup session has no line items');
|
|
318
|
+
if (body.discounts || body.allow_promotion_codes) {
|
|
319
|
+
issue('discounts', 'a setup session takes no discounts');
|
|
320
|
+
}
|
|
321
|
+
if (body.automatic_tax?.enabled)
|
|
322
|
+
issue('automatic_tax', 'a setup session has no tax');
|
|
323
|
+
if (!body.currency)
|
|
324
|
+
issue('currency', 'a setup session needs a currency');
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
if (!body.line_items)
|
|
328
|
+
issue('line_items', `line_items is required in ${mode} mode`);
|
|
329
|
+
if (body.currency !== undefined) {
|
|
330
|
+
issue('currency', 'the currency of a priced session is its line items’');
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (body.customer !== undefined && body.customer_email !== undefined) {
|
|
334
|
+
issue('customer_email', 'customer and customer_email are mutually exclusive');
|
|
335
|
+
}
|
|
336
|
+
if (body.discounts && body.allow_promotion_codes) {
|
|
337
|
+
issue('allow_promotion_codes', 'discounts and allow_promotion_codes are mutually exclusive');
|
|
338
|
+
}
|
|
339
|
+
const ui = body.ui_mode ?? 'hosted';
|
|
340
|
+
if (ui === 'hosted' && body.success_url === undefined) {
|
|
341
|
+
issue('success_url', 'success_url is required in hosted mode');
|
|
342
|
+
}
|
|
343
|
+
if (ui === 'embedded' && body.cancel_url !== undefined) {
|
|
344
|
+
issue('cancel_url', 'an embedded session has no cancel_url; the page around it is yours');
|
|
345
|
+
}
|
|
346
|
+
if (body.submit_type !== undefined && mode !== 'payment') {
|
|
347
|
+
issue('submit_type', 'submit_type is for payment mode');
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
/** `POST /v1/checkout_sessions/{id}` — the merchant's `metadata`, as a patch. */
|
|
351
|
+
export const updateCheckoutSessionParams = z
|
|
352
|
+
.object({ metadata: metadataUpdateParam.optional(), expand: expandParam.optional() })
|
|
353
|
+
.strict();
|
|
354
|
+
export const expireCheckoutSessionParams = z.object({ expand: expandParam.optional() }).strict();
|
|
355
|
+
export const listCheckoutSessionsQuery = listQuery({
|
|
356
|
+
payment_intent: checkoutIdParam.optional().describe('Sessions that created this payment.'),
|
|
357
|
+
payment_link: checkoutIdParam.optional().describe('Sessions started from this link.'),
|
|
358
|
+
customer: checkoutIdParam.optional(),
|
|
359
|
+
status: z.enum(CHECKOUT_SESSION_STATUSES).optional(),
|
|
360
|
+
});
|
|
361
|
+
/** A session's lines, in their order; `created` does not apply to them. */
|
|
362
|
+
export const listCheckoutSessionLineItemsQuery = listQuery({});
|
|
363
|
+
// ---- Payer side ------------------------------------------------------------------
|
|
364
|
+
const payerAddressParams = z
|
|
365
|
+
.object({
|
|
366
|
+
line1: z.string().trim().min(1).max(200).optional(),
|
|
367
|
+
line2: z.string().trim().min(1).max(200).optional(),
|
|
368
|
+
city: z.string().trim().min(1).max(200).optional(),
|
|
369
|
+
state: z.string().trim().min(1).max(100).optional(),
|
|
370
|
+
postal_code: z.string().trim().min(1).max(20).optional(),
|
|
371
|
+
country: countryCodeParam.optional(),
|
|
372
|
+
})
|
|
373
|
+
.strict();
|
|
374
|
+
/** `POST /v1/checkout_sessions/{id}/public` — what the payer changes before confirming. */
|
|
375
|
+
export const updateCheckoutSessionPublicParams = z
|
|
376
|
+
.object({
|
|
377
|
+
line_items: z
|
|
378
|
+
.array(z
|
|
379
|
+
.object({
|
|
380
|
+
id: checkoutIdParam,
|
|
381
|
+
quantity: z.number().int().min(0).max(CHECKOUT_LIMITS.quantityMax),
|
|
382
|
+
})
|
|
383
|
+
.strict())
|
|
384
|
+
.max(CHECKOUT_LIMITS.lineItemsMax)
|
|
385
|
+
.optional()
|
|
386
|
+
.describe("Adjust a line's quantity, within its `adjustable_quantity` bounds."),
|
|
387
|
+
promotion_code: z
|
|
388
|
+
.union([z.literal(''), z.string().trim().min(1).max(CATALOG_LIMITS.promotionCodeMax)])
|
|
389
|
+
.optional()
|
|
390
|
+
.describe('A code to redeem (`allow_promotion_codes`), or `""` to remove the one applied.'),
|
|
391
|
+
customer_details: z
|
|
392
|
+
.object({
|
|
393
|
+
email: checkoutEmailParam.optional(),
|
|
394
|
+
name: z.string().trim().min(1).max(200).optional(),
|
|
395
|
+
phone: z
|
|
396
|
+
.string()
|
|
397
|
+
.trim()
|
|
398
|
+
.regex(/^\+?[0-9 ()-]{5,25}$/, 'must be a phone number')
|
|
399
|
+
.optional(),
|
|
400
|
+
address: payerAddressParams.optional(),
|
|
401
|
+
tax_ids: z
|
|
402
|
+
.array(z
|
|
403
|
+
.object({
|
|
404
|
+
type: z.enum(CHECKOUT_TAX_ID_TYPES),
|
|
405
|
+
value: z
|
|
406
|
+
.string()
|
|
407
|
+
.trim()
|
|
408
|
+
.regex(/^[A-Za-z0-9 .-]{2,30}$/, 'must be a tax id'),
|
|
409
|
+
})
|
|
410
|
+
.strict())
|
|
411
|
+
.max(1)
|
|
412
|
+
.optional(),
|
|
413
|
+
})
|
|
414
|
+
.strict()
|
|
415
|
+
.optional(),
|
|
416
|
+
shipping_details: z
|
|
417
|
+
.object({ name: z.string().trim().min(1).max(200), address: payerAddressParams })
|
|
418
|
+
.strict()
|
|
419
|
+
.nullable()
|
|
420
|
+
.optional(),
|
|
421
|
+
custom_fields: z
|
|
422
|
+
.array(z.object({ key: z.string().min(1).max(200), value: z.string().max(255) }).strict())
|
|
423
|
+
.max(CHECKOUT_LIMITS.customFieldsMax)
|
|
424
|
+
.optional()
|
|
425
|
+
.describe("By `key`: the payer's value for each custom field."),
|
|
426
|
+
consent: z
|
|
427
|
+
.object({ terms_of_service: z.literal('accepted').optional() })
|
|
428
|
+
.strict()
|
|
429
|
+
.optional(),
|
|
430
|
+
})
|
|
431
|
+
.strict();
|
|
432
|
+
/** `POST /v1/checkout_sessions/{id}/public/confirm` takes nothing: the order is the session's. */
|
|
433
|
+
export const confirmCheckoutSessionPublicParams = z.object({}).strict();
|
|
434
|
+
/** `POST /v1/test_helpers/checkout_sessions/{id}/expire` takes nothing. */
|
|
435
|
+
export const expireCheckoutSessionTestHelperParams = z.object({}).strict();
|
|
436
|
+
const sessionId = { id: 'The Checkout Session (`cs_…`).' };
|
|
437
|
+
const payerAuth = "Authorized by the session's `client_secret` (or, for a session wrapping a payment, that payment's) in the `X-Peable-Client-Secret` header — never a URL. Unauthenticated and rate-limited; the answer is `Cache-Control: no-store`.";
|
|
438
|
+
export const checkoutSessionRoutes = [
|
|
439
|
+
defineRoute({
|
|
440
|
+
operationId: 'createCheckoutSession',
|
|
441
|
+
method: 'post',
|
|
442
|
+
path: '/v1/checkout_sessions',
|
|
443
|
+
tag: 'Checkout Sessions',
|
|
444
|
+
summary: 'Create a Checkout Session',
|
|
445
|
+
auth: 'service',
|
|
446
|
+
scope: 'payments:write',
|
|
447
|
+
idempotent: true,
|
|
448
|
+
body: createCheckoutSessionParams,
|
|
449
|
+
response: checkoutSessionSchema,
|
|
450
|
+
status: 201,
|
|
451
|
+
sdk: 'checkout.sessions.create',
|
|
452
|
+
expandable: 'checkout_session',
|
|
453
|
+
}),
|
|
454
|
+
defineRoute({
|
|
455
|
+
operationId: 'listCheckoutSessions',
|
|
456
|
+
method: 'get',
|
|
457
|
+
path: '/v1/checkout_sessions',
|
|
458
|
+
tag: 'Checkout Sessions',
|
|
459
|
+
summary: 'List Checkout Sessions',
|
|
460
|
+
auth: 'service',
|
|
461
|
+
scope: 'payments:read',
|
|
462
|
+
query: listCheckoutSessionsQuery,
|
|
463
|
+
response: listOf(checkoutSessionSchema),
|
|
464
|
+
sdk: 'checkout.sessions.list',
|
|
465
|
+
expandable: 'checkout_session',
|
|
466
|
+
}),
|
|
467
|
+
defineRoute({
|
|
468
|
+
operationId: 'retrieveCheckoutSession',
|
|
469
|
+
method: 'get',
|
|
470
|
+
path: '/v1/checkout_sessions/{id}',
|
|
471
|
+
tag: 'Checkout Sessions',
|
|
472
|
+
summary: 'Retrieve a Checkout Session',
|
|
473
|
+
auth: 'service',
|
|
474
|
+
scope: 'payments:read',
|
|
475
|
+
params: sessionId,
|
|
476
|
+
query: expandOnlyQuery,
|
|
477
|
+
response: checkoutSessionSchema,
|
|
478
|
+
sdk: 'checkout.sessions.retrieve',
|
|
479
|
+
expandable: 'checkout_session',
|
|
480
|
+
}),
|
|
481
|
+
defineRoute({
|
|
482
|
+
operationId: 'updateCheckoutSession',
|
|
483
|
+
method: 'post',
|
|
484
|
+
path: '/v1/checkout_sessions/{id}',
|
|
485
|
+
tag: 'Checkout Sessions',
|
|
486
|
+
summary: 'Update a Checkout Session',
|
|
487
|
+
description: '`metadata` only, as a patch.',
|
|
488
|
+
auth: 'service',
|
|
489
|
+
scope: 'payments:write',
|
|
490
|
+
idempotent: true,
|
|
491
|
+
params: sessionId,
|
|
492
|
+
body: updateCheckoutSessionParams,
|
|
493
|
+
response: checkoutSessionSchema,
|
|
494
|
+
sdk: 'checkout.sessions.update',
|
|
495
|
+
expandable: 'checkout_session',
|
|
496
|
+
}),
|
|
497
|
+
defineRoute({
|
|
498
|
+
operationId: 'expireCheckoutSession',
|
|
499
|
+
method: 'post',
|
|
500
|
+
path: '/v1/checkout_sessions/{id}/expire',
|
|
501
|
+
tag: 'Checkout Sessions',
|
|
502
|
+
summary: 'Expire a Checkout Session',
|
|
503
|
+
description: 'An `open` session the payer has not confirmed; it can no longer be completed.',
|
|
504
|
+
auth: 'service',
|
|
505
|
+
scope: 'payments:write',
|
|
506
|
+
idempotent: true,
|
|
507
|
+
params: sessionId,
|
|
508
|
+
body: expireCheckoutSessionParams,
|
|
509
|
+
response: checkoutSessionSchema,
|
|
510
|
+
sdk: 'checkout.sessions.expire',
|
|
511
|
+
expandable: 'checkout_session',
|
|
512
|
+
}),
|
|
513
|
+
defineRoute({
|
|
514
|
+
operationId: 'listCheckoutSessionLineItems',
|
|
515
|
+
method: 'get',
|
|
516
|
+
path: '/v1/checkout_sessions/{id}/line_items',
|
|
517
|
+
tag: 'Checkout Sessions',
|
|
518
|
+
summary: "List a Checkout Session's line items",
|
|
519
|
+
description: "In their order (at most twenty); the cursor is a line's own `li_…`.",
|
|
520
|
+
auth: 'service',
|
|
521
|
+
scope: 'payments:read',
|
|
522
|
+
params: sessionId,
|
|
523
|
+
query: listCheckoutSessionLineItemsQuery,
|
|
524
|
+
response: listOf(checkoutLineItemSchema),
|
|
525
|
+
sdk: 'checkout.sessions.listLineItems',
|
|
526
|
+
expandable: 'item',
|
|
527
|
+
}),
|
|
528
|
+
defineRoute({
|
|
529
|
+
operationId: 'retrieveCheckoutSessionPublic',
|
|
530
|
+
method: 'get',
|
|
531
|
+
path: '/v1/checkout_sessions/{id}/public',
|
|
532
|
+
tag: 'Checkout Sessions',
|
|
533
|
+
summary: 'Retrieve a Checkout Session as its payer',
|
|
534
|
+
description: payerAuth,
|
|
535
|
+
auth: 'public',
|
|
536
|
+
params: sessionId,
|
|
537
|
+
response: checkoutSessionPublicSchema,
|
|
538
|
+
}),
|
|
539
|
+
defineRoute({
|
|
540
|
+
operationId: 'updateCheckoutSessionPublic',
|
|
541
|
+
method: 'post',
|
|
542
|
+
path: '/v1/checkout_sessions/{id}/public',
|
|
543
|
+
tag: 'Checkout Sessions',
|
|
544
|
+
summary: 'Update a Checkout Session as its payer',
|
|
545
|
+
description: `Quantities, promotion code, the payer's details. ${payerAuth}`,
|
|
546
|
+
auth: 'public',
|
|
547
|
+
params: sessionId,
|
|
548
|
+
body: updateCheckoutSessionPublicParams,
|
|
549
|
+
response: checkoutSessionPublicSchema,
|
|
550
|
+
}),
|
|
551
|
+
defineRoute({
|
|
552
|
+
operationId: 'confirmCheckoutSessionPublic',
|
|
553
|
+
method: 'post',
|
|
554
|
+
path: '/v1/checkout_sessions/{id}/public/confirm',
|
|
555
|
+
tag: 'Checkout Sessions',
|
|
556
|
+
summary: 'Confirm a Checkout Session as its payer',
|
|
557
|
+
description: `Locks the order and creates its payment (or setup): the answer carries \`payment_intent\` / \`setup_intent\`. Resolving is not completion — \`complete\` is only ever what the gateway says. ${payerAuth}`,
|
|
558
|
+
auth: 'public',
|
|
559
|
+
params: sessionId,
|
|
560
|
+
body: confirmCheckoutSessionPublicParams,
|
|
561
|
+
response: checkoutSessionPublicSchema,
|
|
562
|
+
}),
|
|
563
|
+
defineRoute({
|
|
564
|
+
operationId: 'expireCheckoutSessionTestHelper',
|
|
565
|
+
method: 'post',
|
|
566
|
+
path: '/v1/test_helpers/checkout_sessions/{id}/expire',
|
|
567
|
+
tag: 'Test helpers',
|
|
568
|
+
summary: 'Expire a test-mode Checkout Session now',
|
|
569
|
+
description: 'A session nobody confirmed expires on its own deadline; one around a payment expires with that payment, in the same transition.',
|
|
570
|
+
auth: 'service',
|
|
571
|
+
scope: 'payments:write',
|
|
572
|
+
idempotent: true,
|
|
573
|
+
testModeOnly: true,
|
|
574
|
+
params: sessionId,
|
|
575
|
+
body: expireCheckoutSessionTestHelperParams,
|
|
576
|
+
response: checkoutSessionSchema,
|
|
577
|
+
sdk: 'testHelpers.checkoutSessions.expire',
|
|
578
|
+
}),
|
|
579
|
+
];
|