feat: 🎸 sdks, docs for schedule and getCustomer and creditnotes

This commit is contained in:
amianthus
2026-05-06 12:00:59 +01:00
parent 33ac5a942d
commit a6c00c1882
109 changed files with 15314 additions and 2497 deletions

View File

@@ -0,0 +1,8 @@
---
title: "Create Schedule"
openapi: "openapi POST /v1/billing.create_schedule"
---
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";

View File

@@ -324,6 +324,10 @@ This is useful for attaching custom metadata to the Stripe subscription created
When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
</DynamicParamField>
<DynamicParamField body="starts_at" type="integer">
Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
</DynamicParamField>
<DynamicParamField body="checkout_session_params" type="object">
Additional parameters to pass into the creation of the Stripe checkout session.
</DynamicParamField>

View File

@@ -0,0 +1,352 @@
---
title: "Create Schedule"
openapi: "openapi POST /v1/billing.create_schedule"
---
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
### Body Parameters
<DynamicParamField body="customer_id" type="string" required>
The ID of the customer to create the schedule for.
</DynamicParamField>
<DynamicParamField body="entity_id" type="string">
Optional entity ID for an entity-scoped schedule.
</DynamicParamField>
<DynamicParamField body="invoice_mode" type="object">
Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase.
<Expandable title="properties">
<DynamicParamField body="enabled" type="boolean" required>
When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.
</DynamicParamField>
<DynamicParamField body="enable_plan_immediately" type="boolean">
If true, enables the plan immediately even though the invoice is not paid yet.
</DynamicParamField>
<DynamicParamField body="finalize" type="boolean">
If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="success_url" type="string">
URL to redirect to after successful checkout.
</DynamicParamField>
<DynamicParamField body="checkout_session_params" type="object">
Additional parameters to pass into the creation of the Stripe checkout session.
</DynamicParamField>
<DynamicParamField body="redirect_mode" type="'always' | 'if_required' | 'never'">
Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects.
</DynamicParamField>
<DynamicParamField body="billing_behavior" type="'prorate_immediately' | 'none'">
Whether to prorate the immediate phase. 'none' skips proration charges and credits.
</DynamicParamField>
<DynamicParamField body="billing_cycle_anchor" type="any">
Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time.
</DynamicParamField>
<DynamicParamField body="enable_plan_immediately" type="boolean">
If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed.
</DynamicParamField>
<DynamicParamField body="phases" type="object[]" required>
Ordered phase definitions for the schedule.
<Expandable title="properties">
<DynamicParamField body="starts_at" type="number" required>
When this phase should start, in epoch milliseconds.
</DynamicParamField>
<DynamicParamField body="plans" type="object[]" required>
Plans to materialize for this phase.
<Expandable title="properties">
<DynamicParamField body="plan_id" type="string" required>
The ID of the plan to schedule in this phase.
</DynamicParamField>
<DynamicParamField body="feature_quantities" type="object[]">
Optional prepaid feature quantities for this phase's plan.
<Expandable title="properties">
<DynamicParamField body="feature_id" type="string" required>
The ID of the feature to set quantity for.
</DynamicParamField>
<DynamicParamField body="quantity" type="number">
The quantity of the feature.
</DynamicParamField>
<DynamicParamField body="adjustable" type="boolean">
Whether the customer can adjust the quantity.
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="version" type="number">
Optional explicit plan version to schedule.
</DynamicParamField>
<DynamicParamField body="customize" type="object">
Customize the plan to schedule. Can override the price, items, or both.
<Expandable title="properties">
<DynamicParamField body="price" type="object | null">
Base price configuration for a plan.
<Expandable title="properties">
<DynamicParamField body="amount" type="number" required>
Base price amount for the plan.
</DynamicParamField>
<DynamicParamField body="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'" required>
Billing interval (e.g. 'month', 'year').
</DynamicParamField>
<DynamicParamField body="interval_count" type="number">
Number of intervals per billing cycle. Defaults to 1.
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="items" type="object[]">
Override the items in the plan.
<Expandable title="properties">
<DynamicParamField body="feature_id" type="string" required>
The ID of the feature to configure.
</DynamicParamField>
<DynamicParamField body="included" type="number">
Number of free units included. Balance resets to this each interval for consumable features.
</DynamicParamField>
<DynamicParamField body="unlimited" type="boolean">
If true, customer has unlimited access to this feature.
</DynamicParamField>
<DynamicParamField body="reset" type="object">
Reset configuration for consumable features. Omit for non-consumable features like seats.
<Expandable title="properties">
<DynamicParamField body="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'" required>
Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
</DynamicParamField>
<DynamicParamField body="interval_count" type="number">
Number of intervals between resets. Defaults to 1.
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="price" type="object">
Pricing for usage beyond included units. Omit for free features.
<Expandable title="properties">
<DynamicParamField body="amount" type="number">
Price per billing_units after included usage. Either 'amount' or 'tiers' is required.
</DynamicParamField>
<DynamicParamField body="tiers" type="object[]">
Tiered pricing. Either 'amount' or 'tiers' is required.
<Expandable title="properties">
<DynamicParamField body="to" type="any" />
<DynamicParamField body="amount" type="any" />
<DynamicParamField body="flat_amount" type="any" />
</Expandable>
</DynamicParamField>
<DynamicParamField body="tier_behavior" type="'graduated' | 'volume'" />
<DynamicParamField body="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'" required>
Billing interval. For consumable features, should match reset.interval.
</DynamicParamField>
<DynamicParamField body="interval_count" type="number">
Number of intervals per billing cycle. Defaults to 1.
</DynamicParamField>
<DynamicParamField body="billing_units" type="number">
Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).
</DynamicParamField>
<DynamicParamField body="billing_method" type="'prepaid' | 'usage_based'" required>
'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
</DynamicParamField>
<DynamicParamField body="max_purchase" type="number">
Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="proration" type="object">
Proration settings for prepaid features. Controls mid-cycle quantity change billing.
<Expandable title="properties">
<DynamicParamField body="on_increase" type="'bill_immediately' | 'prorate_immediately' | 'prorate_next_cycle' | 'bill_next_cycle'" required>
Billing behavior when quantity increases mid-cycle.
</DynamicParamField>
<DynamicParamField body="on_decrease" type="'prorate' | 'prorate_immediately' | 'prorate_next_cycle' | 'none' | 'no_prorations'" required>
Credit behavior when quantity decreases mid-cycle.
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="rollover" type="object">
Rollover config for unused units. If set, unused included units carry over.
<Expandable title="properties">
<DynamicParamField body="max" type="number">
Max rollover units. Omit for unlimited rollover.
</DynamicParamField>
<DynamicParamField body="max_percentage" type="number">
Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
</DynamicParamField>
<DynamicParamField body="expiry_duration_type" type="'month' | 'forever'" required>
When rolled over units expire.
</DynamicParamField>
<DynamicParamField body="expiry_duration_length" type="number">
Number of periods before expiry.
</DynamicParamField>
</Expandable>
</DynamicParamField>
</Expandable>
</DynamicParamField>
</Expandable>
</DynamicParamField>
<DynamicParamField body="subscription_id" type="string">
Unsupported for create_schedule today. Requests that include this field will be rejected.
</DynamicParamField>
</Expandable>
</DynamicParamField>
</Expandable>
</DynamicParamField>
### Response
<DynamicResponseField name="customer_id" type="string">
The ID of the customer.
</DynamicResponseField>
<DynamicResponseField name="entity_id" type="string | null">
The entity ID for the schedule, or null when customer-level.
</DynamicResponseField>
<DynamicResponseField name="status" type="'created' | 'pending_payment'">
Whether the schedule is fully created or waiting for payment or confirmation to complete.
</DynamicResponseField>
<DynamicResponseField name="schedule_id" type="string | null">
The ID of the created schedule. Null when the schedule is waiting on Autumn checkout confirmation.
</DynamicResponseField>
<DynamicResponseField name="phases" type="object[]">
Persisted phases in ascending starts_at order. Empty when waiting on Autumn checkout confirmation.
<Expandable title="properties">
<DynamicResponseField name="phase_id" type="string">
The ID of the persisted phase row.
</DynamicResponseField>
<DynamicResponseField name="starts_at" type="number">
When this phase starts, in epoch milliseconds.
</DynamicResponseField>
<DynamicResponseField name="customer_product_ids" type="string[]">
Customer products materialized for this phase.
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<DynamicResponseField name="invoice" type="object">
Invoice details if an invoice was created. Only present when a charge was made.
<Expandable title="properties">
<DynamicResponseField name="status" type="string | null">
The status of the invoice (e.g., 'paid', 'open', 'draft').
</DynamicResponseField>
<DynamicResponseField name="stripe_id" type="string">
The Stripe invoice ID.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The total amount of the invoice in cents.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
The three-letter ISO currency code (e.g., 'usd').
</DynamicResponseField>
<DynamicResponseField name="hosted_invoice_url" type="string | null">
URL to the hosted invoice page where the customer can view and pay the invoice.
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<DynamicResponseField name="payment_url" type="string | null">
URL to redirect the customer to complete payment. Null if no payment action is required.
</DynamicResponseField>
<DynamicResponseField name="required_action" type="object">
<Expandable title="properties">
<DynamicResponseField name="code" type="'3ds_required' | 'payment_method_required' | 'payment_failed'">
The type of action required to complete the payment.
</DynamicResponseField>
<DynamicResponseField name="reason" type="string">
A human-readable explanation of why this action is required.
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<ResponseExample>
```json 200
{
"customer_id": "cus_123",
"entity_id": null,
"status": "created",
"schedule_id": "sch_1234",
"phases": [
{
"phase_id": "sphs_1111",
"starts_at": 1735689600000,
"customer_product_ids": [
"cus_prod_1111"
]
},
{
"phase_id": "sphs_2222",
"starts_at": 1736899200000,
"customer_product_ids": [
"cus_prod_2222"
]
}
],
"invoice": null,
"payment_url": null
}
```
</ResponseExample>

View File

@@ -257,6 +257,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
</DynamicParamField>
<DynamicParamField body="starts_at" type="integer">
Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
</DynamicParamField>
<DynamicParamField body="checkout_session_params" type="object">
Additional parameters to pass into the creation of the Stripe checkout session.
</DynamicParamField>
@@ -337,11 +341,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The amount in cents before discounts for this line item.
The amount in cents before discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for this line item.
The final amount in cents after discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="discounts" type="object[]">
@@ -388,11 +392,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The total amount in cents before discounts for the current billing period.
The total amount in cents before discounts and tax for the current billing period.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for the current billing period.
The final amount in cents after discounts and tax for the current billing period.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
@@ -407,11 +411,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The total amount in cents before discounts for the next cycle.
The total amount in cents before discounts and tax for the next cycle.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for the next cycle.
The final amount in cents after discounts and tax for the next cycle.
</DynamicResponseField>
<DynamicResponseField name="line_items" type="object[]">
@@ -426,11 +430,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The amount in cents before discounts for this line item.
The amount in cents before discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for this line item.
The final amount in cents after discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="discounts" type="object[]">
@@ -1199,6 +1203,20 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</Expandable>
</DynamicResponseField>
<DynamicResponseField name="invoice_credits" type="object">
Stripe customer invoice credits preview.
<Expandable title="properties">
<DynamicResponseField name="balance" type="number">
Stripe customer credit balance available, expressed as a positive number in major currency units.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
Three-letter currency code.
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<ResponseExample>
```json 200

View File

@@ -510,11 +510,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The amount in cents before discounts for this line item.
The amount in cents before discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for this line item.
The final amount in cents after discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="discounts" type="object[]">
@@ -561,11 +561,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The total amount in cents before discounts for the current billing period.
The total amount in cents before discounts and tax for the current billing period.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for the current billing period.
The final amount in cents after discounts and tax for the current billing period.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
@@ -580,11 +580,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The total amount in cents before discounts for the next cycle.
The total amount in cents before discounts and tax for the next cycle.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for the next cycle.
The final amount in cents after discounts and tax for the next cycle.
</DynamicResponseField>
<DynamicResponseField name="line_items" type="object[]">
@@ -599,11 +599,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The amount in cents before discounts for this line item.
The amount in cents before discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for this line item.
The final amount in cents after discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="discounts" type="object[]">
@@ -1372,6 +1372,20 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</Expandable>
</DynamicResponseField>
<DynamicResponseField name="invoice_credits" type="object">
Stripe customer invoice credits preview.
<Expandable title="properties">
<DynamicResponseField name="balance" type="number">
Stripe customer credit balance available, expressed as a positive number in major currency units.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
Three-letter currency code.
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<ResponseExample>
```json 200

View File

@@ -282,11 +282,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The amount in cents before discounts for this line item.
The amount in cents before discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for this line item.
The final amount in cents after discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="discounts" type="object[]">
@@ -333,11 +333,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The total amount in cents before discounts for the current billing period.
The total amount in cents before discounts and tax for the current billing period.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for the current billing period.
The final amount in cents after discounts and tax for the current billing period.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
@@ -352,11 +352,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The total amount in cents before discounts for the next cycle.
The total amount in cents before discounts and tax for the next cycle.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for the next cycle.
The final amount in cents after discounts and tax for the next cycle.
</DynamicResponseField>
<DynamicResponseField name="line_items" type="object[]">
@@ -371,11 +371,11 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</DynamicResponseField>
<DynamicResponseField name="subtotal" type="number">
The amount in cents before discounts for this line item.
The amount in cents before discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="total" type="number">
The final amount in cents after discounts for this line item.
The final amount in cents after discounts and tax for this line item.
</DynamicResponseField>
<DynamicResponseField name="discounts" type="object[]">
@@ -1112,6 +1112,46 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
<DynamicResponseField name="intent" type="'update_plan' | 'update_quantity' | 'cancel_immediately' | 'cancel_end_of_cycle' | 'uncancel' | 'none'" />
<DynamicResponseField name="tax" type="object">
Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location.
<Expandable title="properties">
<DynamicResponseField name="total" type="number">
Total tax amount in major currency units.
</DynamicResponseField>
<DynamicResponseField name="amount_inclusive" type="number">
Tax included in line item subtotals.
</DynamicResponseField>
<DynamicResponseField name="amount_exclusive" type="number">
Tax added on top of subtotals.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
Three-letter currency code.
</DynamicResponseField>
<DynamicResponseField name="status" type="'complete' | 'incomplete'">
Calculation status ('complete' when Stripe Tax succeeds or 'incomplete' when Stripe Tax returned 0 or errored).
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<DynamicResponseField name="invoice_credits" type="object">
Stripe customer invoice credits preview.
<Expandable title="properties">
<DynamicResponseField name="balance" type="number">
Stripe customer credit balance available, expressed as a positive number in major currency units.
</DynamicResponseField>
<DynamicResponseField name="currency" type="string">
Three-letter currency code.
</DynamicResponseField>
</Expandable>
</DynamicResponseField>
<ResponseExample>
```json 200

View File

@@ -227,6 +227,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
Reset the billing cycle anchor immediately with 'now'.
</DynamicParamField>
<DynamicParamField body="starts_at" type="integer">
Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
</DynamicParamField>
<DynamicParamField body="checkout_session_params" type="object">
Additional parameters to pass into the creation of the Stripe checkout session.
</DynamicParamField>

File diff suppressed because it is too large Load Diff

View File

@@ -167,7 +167,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
</Expandable>
</DynamicParamField>
<DynamicParamField body="expand" type="string[]">
<DynamicParamField body="expand" type="('invoices' | 'trials_used' | 'rewards' | 'entities' | 'referrals' | 'payment_method' | 'subscriptions.plan' | 'purchases.plan' | 'balances.feature' | 'flags.feature' | 'billing_controls.auto_topups.purchase_limit')[]">
Fields to expand in the returned customer response, such as subscriptions.plan, purchases.plan, balances.feature, or flags.feature.
</DynamicParamField>

View File

@@ -26,7 +26,7 @@ openapi: "api/openapi.yml webhook billing.auto_topup_succeeded"
</ParamField>
<ParamField body="invoice_mode" type="boolean" required>
Whether the auto top-up created a `send_invoice` invoice instead of auto-charging the saved payment method.
Whether the auto top-up created a send_invoice invoice instead of auto-charging.
</ParamField>
<ParamField body="invoice" type="object" required>
@@ -36,19 +36,19 @@ openapi: "api/openapi.yml webhook billing.auto_topup_succeeded"
The Stripe invoice ID. Use this as a stable dedupe key.
</ParamField>
<ParamField body="status" type="string">
The status of the invoice. `"paid"` for auto-charged top-ups; `"open"` for `invoice_mode` top-ups where credits were granted but the invoice has not yet been paid.
<ParamField body="status" type="string | null">
The status of the invoice. "paid" for auto-charged top-ups; "open" for invoice-mode top-ups where credits were granted but the invoice has not yet been paid.
</ParamField>
<ParamField body="total" type="number" required>
The total amount of the invoice in the smallest currency unit (e.g. cents for USD), matching Stripe's `invoice.total`.
The total amount of the invoice in the smallest currency unit (e.g. cents for USD), matching Stripe's invoice.total.
</ParamField>
<ParamField body="currency" type="string" required>
The ISO currency code for the invoice.
</ParamField>
<ParamField body="hosted_invoice_url" type="string">
<ParamField body="hosted_invoice_url" type="string | null">
URL to the hosted invoice page, if available.
</ParamField>

File diff suppressed because it is too large Load Diff

View File

@@ -196,7 +196,8 @@
"api-reference/billing/openCustomerPortal",
"api-reference/billing/setupPayment",
"api-reference/billing/previewMultiAttach",
"api-reference/billing/multiAttach"
"api-reference/billing/multiAttach",
"api-reference/billing/createSchedule"
]
},
{
@@ -214,6 +215,7 @@
"group": "Customers",
"pages": [
"api-reference/customers/getOrCreateCustomer",
"api-reference/customers/getCustomer",
"api-reference/customers/listCustomers",
"api-reference/customers/updateCustomer",
"api-reference/customers/deleteCustomer"

View File

@@ -129,6 +129,41 @@ actions:
res = autumn.billing.attach(customer_id="cus_123", plan_id="pro_plan", redirect_mode="if_required")
# Handle response
print(res)
- target: $["paths"]["/v1/billing.create_schedule"]["post"]
update:
x-codeSamples:
- lang: python
label: Python (SDK)
source: |-
from autumn_sdk import Autumn
with Autumn(
x_api_version="2.2.0",
secret_key="<YOUR_BEARER_TOKEN_HERE>",
) as autumn:
res = autumn.billing.create_schedule(customer_id="cus_123", phases=[
{
"starts_at": 1735689600000,
"plans": [
{
"plan_id": "trial_plan",
},
],
},
{
"starts_at": 1736899200000,
"plans": [
{
"plan_id": "pro_plan",
},
],
},
], redirect_mode="if_required")
# Handle response
print(res)
- target: $["paths"]["/v1/billing.multi_attach"]["post"]
@@ -309,6 +344,24 @@ actions:
res = autumn.customers.delete(customer_id="cus_123", delete_in_stripe=False)
# Handle response
print(res)
- target: $["paths"]["/v1/customers.get"]["post"]
update:
x-codeSamples:
- lang: python
label: Python (SDK)
source: |-
from autumn_sdk import Autumn
with Autumn(
x_api_version="2.2.0",
secret_key="<YOUR_BEARER_TOKEN_HERE>",
) as autumn:
res = autumn.customers.get(customer_id="cus_123")
# Handle response
print(res)
- target: $["paths"]["/v1/customers.get_or_create"]["post"]

View File

@@ -1,27 +1,27 @@
lockVersion: 2.0.0
id: 05940b80-1ef8-40f4-9878-822fb2792070
management:
docChecksum: c3041f34caeb0201b430dc54df97140a
docChecksum: 2be6fa7029e73c164d08ac857cee81d8
docVersion: 2.2.0
speakeasyVersion: 1.759.3
generationVersion: 2.869.25
speakeasyVersion: 1.762.0
generationVersion: 2.882.0
releaseVersion: 0.4.18
configChecksum: 2263d20254e354a1792248274002f650
persistentEdits:
generation_id: ac308b52-4d2e-4fea-ab5d-e30db6928b77
pristine_commit_hash: f3f5abc6e8464cd4f79fbbde244beeec88d8c9c8
pristine_tree_hash: 5095e5af1cae4de332e9904cc98369c764d4d6f5
generation_id: 247eded1-f32c-47f7-b689-85bf7db685e1
pristine_commit_hash: ccca90330d8eb7741574907e8ec31c8e37d6fe22
pristine_tree_hash: de736fd8d79b3a4ecf3bcd4500ebb8a4cf4ae4c1
features:
python:
additionalDependencies: 1.0.0
constsAndDefaults: 1.0.7
core: 6.0.20
core: 6.0.21
defaultEnabledRetries: 0.2.0
enumUnions: 0.1.1
envVarSecurityUsage: 0.3.2
flatRequests: 1.0.1
flattening: 3.1.1
globalSecurity: 3.0.5
globalSecurity: 3.0.7
globalSecurityCallbacks: 1.0.0
globalSecurityFlattening: 1.0.0
globalServerURLs: 3.2.1
@@ -31,9 +31,9 @@ features:
nameOverrides: 3.0.3
nullables: 1.0.2
responseFormat: 1.1.0
retries: 3.0.4
retries: 3.0.5
sdkHooks: 1.2.1
unions: 3.1.4
unions: 3.1.5
trackedFiles:
.gitattributes:
id: 24139dae6567
@@ -149,8 +149,8 @@ trackedFiles:
pristine_git_object: 4b75b3d142ea7237687dd5d3dd6a0e463186bbcf
docs/models/attachparams.md:
id: cc19aeb7efcc
last_write_checksum: sha1:f72ede8df8c9f8a9aa6d0660b5bf7313b1c4becd
pristine_git_object: 4d381d0ae92f0e0662338892afc3f30f967d6084
last_write_checksum: sha1:106cb7ed074719c755469762b057923b413038a4
pristine_git_object: 30a2a0beb351d75725688c8f7e0c8163b424acab
docs/models/attachplanitem.md:
id: 5012fb5dd668
last_write_checksum: sha1:d99041abdc1966381f9c3be442d82ae8894e35d8
@@ -255,6 +255,10 @@ trackedFiles:
id: 75c2cae544fe
last_write_checksum: sha1:09514e05b48bd58bd5f6a2bd6f33ba3f0b0ad957
pristine_git_object: 15b56e6a26511479ac90168ff02e708073684ad4
docs/models/billingbehavior.md:
id: 9c13c728c39d
last_write_checksum: sha1:5f00dce737f1449f727ee694ea6895d4822a73d0
pristine_git_object: a2ebd1872c9a3b0c612afde2a7f6a8ced7bc76cf
docs/models/billingupdateattachdiscount.md:
id: 930b614fa546
last_write_checksum: sha1:cbccdfd5a14918a58a9925805caa344d50a2a5f5
@@ -855,6 +859,114 @@ trackedFiles:
id: b746d21856be
last_write_checksum: sha1:ef75b823c030983dfafcf82298a1ab67e8482682
pristine_git_object: cef67b1f14cedbdbac9b0af23e05bd4fc0856294
docs/models/createschedulebaseprice2.md:
id: 085a5cb811d8
last_write_checksum: sha1:9f79c1efa249af5fabf138941328be472984ea59
pristine_git_object: fe0effdb8f0bd0655e56dc020c1b56df82fb51d2
docs/models/createschedulebillingmethod2.md:
id: 6c9fcbc61773
last_write_checksum: sha1:ab53f8749b49ad95e6817f1103f67b5f978b531a
pristine_git_object: 5b0bd7d4cc75dec2402751cb541fd2a6c23c24c7
docs/models/createschedulecode.md:
id: ae8797299cb3
last_write_checksum: sha1:5e22eb9e2ef88e6b4d0956b452f000add08ca68b
pristine_git_object: de1afe7be3a3b8e8f31d8ef15bde78b740a6935a
docs/models/createschedulecustomize2.md:
id: 2d3dbf831687
last_write_checksum: sha1:9d31363e61674e6d0727605ab055a31663cc9bac
pristine_git_object: 9f5ffcc21a8906d6f4be3d95edab7a15a72ae09d
docs/models/createscheduleexpirydurationtype2.md:
id: 8a8f29337d99
last_write_checksum: sha1:fb8a90e1f143399de72c3acea42946e6fb6fc927
pristine_git_object: 90be270664a6b47f777d426bb52e79c8f597d6b3
docs/models/createschedulefeaturequantity2.md:
id: c9c29754b283
last_write_checksum: sha1:f8cbdc97b69096b9b7b4a634272786832d2d1d0f
pristine_git_object: ee3ff47c76d27907df4ed4a407cf49434a299972
docs/models/createscheduleglobals.md:
id: aadf183113ab
last_write_checksum: sha1:cc812b72171a296101e97908a1fd1fdad2454f73
pristine_git_object: c5a13b0eb194df2c570215f65ea1921f40c0db39
docs/models/createscheduleinvoice.md:
id: 99aa33eadf9e
last_write_checksum: sha1:5266f93eec86e7cc62a4fd7611e01f10f416edc4
pristine_git_object: e4e05d7d0028e2fcc7b966a4189cdab19594580a
docs/models/createscheduleinvoicemode.md:
id: 465bb2d9aab1
last_write_checksum: sha1:c2000694d3810a81b5f78c421fb2538158050de2
pristine_git_object: d06a9a5e99f1cea5b898110f135dacc74f284e79
docs/models/createscheduleitempriceinterval2.md:
id: 068bd5764bce
last_write_checksum: sha1:498275d15b787de04c157bb6dcf6a2cd399033f9
pristine_git_object: 1a9461f947a1aa3b2599ad4e7ad91cca4ee1f394
docs/models/createscheduleondecrease2.md:
id: bd82733c0bb1
last_write_checksum: sha1:fad188df5c98ea8afc2ee9469a394879f055737a
pristine_git_object: da48d2b573ea532b8f07a8c9bbecbb15a823e95b
docs/models/createscheduleonincrease2.md:
id: 7252ffa2a2fe
last_write_checksum: sha1:7b260df00d9c23045efc66d4ceb069ca62ef751c
pristine_git_object: 99a759e41bbd512fd12a044916b8fc02e60b0adb
docs/models/createscheduleparams.md:
id: 20f486e2b183
last_write_checksum: sha1:d2e0ad724b2752f8f7101c24e4b909c92d50bb35
pristine_git_object: 3a9b5798a5848bfb4cbf75c92a3234c301cb5d97
docs/models/createscheduleplan2.md:
id: a42f3ea41a0a
last_write_checksum: sha1:fa1ffa93aafc361c573b1d7034aa758b3feb67be
pristine_git_object: ea9618f8d96b5aa434a1e65c9eacc720b77f58a0
docs/models/createscheduleplanitem2.md:
id: 2b3cb09fa813
last_write_checksum: sha1:325361086fef8d0559cbc55813d544f092dad046
pristine_git_object: f4f8afd797436d069fd88e7bfa9bb5e2327480c3
docs/models/createscheduleprice2.md:
id: c3801269efeb
last_write_checksum: sha1:3da569cfaa8e3daf6fc3b3f20bd60e18a5dfe70a
pristine_git_object: f9a6c037b55c579d00768c368c3e68884a96f33c
docs/models/createschedulepriceinterval2.md:
id: 00765df9eaab
last_write_checksum: sha1:a8d8aeca47a077667826af06949a237fd457bb6a
pristine_git_object: 1e05140406e5b892611a0e99e19efe47887bdf90
docs/models/createscheduleproration2.md:
id: 3ff576b2a1fb
last_write_checksum: sha1:5b5493c003ee0a9f4a96e681503cc3f8f9b9418c
pristine_git_object: 7069a2cd634ef1ada2e9669e36583afa9c4165f8
docs/models/createscheduleredirectmode.md:
id: 689f929f921e
last_write_checksum: sha1:296328336c7c1fa4a16a231d7792df5075c2bdce
pristine_git_object: 76bdc019e78ef6d41470299d7f4b923568029179
docs/models/createschedulerequiredaction.md:
id: 82018e476b97
last_write_checksum: sha1:03cd49c5ebebb116ccc00cd949cd7fab1940e803
pristine_git_object: 86831cbdde9c6deae049ff0db7eba5e67d48bd32
docs/models/createschedulereset2.md:
id: feebf22e6c64
last_write_checksum: sha1:96b444f09c86df862137199b39ae1633d1c101b6
pristine_git_object: 1e6a10b7d31deec21969c70880e535150556df1e
docs/models/createscheduleresetinterval2.md:
id: c3721a746f30
last_write_checksum: sha1:9d588520fefe2ec12b7b35ad15d83e26036338dd
pristine_git_object: 6da5164cfa7558527971676876aabe0f11eb8689
docs/models/createscheduleresponse.md:
id: e5e52edbfe1d
last_write_checksum: sha1:be9c666a5ef0aaaeafcc7a7e8f29c7b2ba401e71
pristine_git_object: 0177ef63c5cd5429e3326167b7140b661a965674
docs/models/createschedulerollover2.md:
id: c2c1ecc33a23
last_write_checksum: sha1:43f8381ad8fe4a598bc8f8795da4ac3cfea34775
pristine_git_object: 3552c73a61af83c128ea03e8ce807d5cbabcfb54
docs/models/createschedulestatus.md:
id: d4a23c68e243
last_write_checksum: sha1:b43589609c09d5b663feb75d0001a661ff39c5c2
pristine_git_object: 41df0965e5b139b6ee229d253f76557bb20d0145
docs/models/createscheduletier2.md:
id: f7e60c0166fa
last_write_checksum: sha1:1283ec490092867f51d1408c49df3b5f5819dc3f
pristine_git_object: 4f6eea8a86d6497c6c535ecd45293f267131301c
docs/models/createscheduletierbehavior2.md:
id: 3c8ef0ecb3a4
last_write_checksum: sha1:3681feeca4a0ac6ac0ad5cce1edc00814d71251c
pristine_git_object: d65d6bb2aa379ebcec5024ca959208b84ad15a96
docs/models/customer.md:
id: 42ac97d31359
last_write_checksum: sha1:fbc5841d7dd476de0707c884a0b0c4a5694f5625
@@ -927,10 +1039,18 @@ trackedFiles:
id: 6ad6cc047223
last_write_checksum: sha1:d51b278d8dfaf98858914d99e41aa1f8274c3e31
pristine_git_object: 3eab0b39b6e3bd249c42919a34d53518f03c8afe
docs/models/customerentityenv.md:
id: b5ddcff01e58
last_write_checksum: sha1:ad67aa47cd4181829af9f67386798ee58d0e36c5
pristine_git_object: 37ab8f301accc7585b7121e28ed6e64ea2e1fd74
docs/models/customerenv.md:
id: 714d5f271769
last_write_checksum: sha1:baf1fd8c3368fd3602ef5feb2f97714e40a6ec00
pristine_git_object: 795d79e59aeae504a77a2d3ca10217be880e23e3
docs/models/customerexpand.md:
id: e85805d3c1d6
last_write_checksum: sha1:b7dcc8cf6d21eeb1be591bf60241fb4185853dc5
pristine_git_object: e93c4a0ddb2a284860c84aa39ef1a2d9a29fe919
docs/models/customerfeature.md:
id: e11a0acefe5f
last_write_checksum: sha1:581d157d60440eb1422d1aeb94d8fb184be5982d
@@ -963,6 +1083,10 @@ trackedFiles:
id: 5837b4eecc48
last_write_checksum: sha1:9076028a239394ba7499d5fd27ee5ded1d0fc0cf
pristine_git_object: b4dd64ef1bcb0479f3d913745227beecf985e2fe
docs/models/customerrewardstype.md:
id: 04ea9db50070
last_write_checksum: sha1:cd9cc8bcf265dc690c1f186fa1efc0d0eb66c70e
pristine_git_object: deccaa9d544f8b58e4ba2886ae35892ee0c37f5a
docs/models/customerspendlimit.md:
id: 2a196d02af9c
last_write_checksum: sha1:96d28d1d8047ec91fb7df11574c65d165f10a52e
@@ -1045,16 +1169,12 @@ trackedFiles:
pristine_git_object: 613f5798f6c2590b44c3920b508ca00e5517585a
docs/models/discount.md:
id: 003b28f6c8a6
last_write_checksum: sha1:b9dae9fc7bc9cfb592d5d6679d65739d15b65fb5
pristine_git_object: 73273a9dc0cc58d0d6ff61fba0bdc32754d1e264
last_write_checksum: sha1:eb0472fff7f22cd14dab19ffd555e4709f3a3c67
pristine_git_object: 8a89358d990e3cfc0c1fbd1d474292b885e9468f
docs/models/entity.md:
id: 903c73579a5c
last_write_checksum: sha1:f42fb74bddb6b3af0f5585dbae42b46ed11aaf6c
pristine_git_object: 13571b91f635c237d1c0e67aa3a39f2b0542b9d9
docs/models/entityenv.md:
id: 5c026cde1184
last_write_checksum: sha1:18b6be25de69c48ced637a6f6af1c220c472f8ef
pristine_git_object: 3c6a8b29b6df7ff5445d964e3fcb32bd7fbce60e
last_write_checksum: sha1:d2cdd42eb9f255a103ade4912597ddf4d1eb79e2
pristine_git_object: 9a894a91de1b51161413d5f753a33a8e5b286b03
docs/models/eventsaggregateparams.md:
id: d82804f4b722
last_write_checksum: sha1:58914d347f689d5effc7e3b8221b040068a15e56
@@ -1139,6 +1259,142 @@ trackedFiles:
id: b3ecac09ef21
last_write_checksum: sha1:169d32a309bd509f208a93cbd32c494a5fb86040
pristine_git_object: 043bcd6a83e917e5245a2490db35ecf15c75e697
docs/models/getcustomerautotopup.md:
id: ade338a15c9a
last_write_checksum: sha1:25b6176fdb670909be930c475bdf623851dbfabe
pristine_git_object: ac83d4f67f9a541afdd71ccbaea921b0f68efeda
docs/models/getcustomerbillingcontrols.md:
id: 4afe50b8296f
last_write_checksum: sha1:03863f795c3cda6dbf07a228887a0ad5162cf2cd
pristine_git_object: a2c563234e3f2b41b9f0245772d476d647987405
docs/models/getcustomerconfig.md:
id: a784973f50c5
last_write_checksum: sha1:dbe019e96f0b8ae4108e9e95406aa9d9feac942f
pristine_git_object: 03da7ccb3aa3f4bfead4386f75c6144de306d010
docs/models/getcustomercreditschema.md:
id: addabed378ab
last_write_checksum: sha1:967ec92ea7e5442692e27a6f19ffcc515f96077d
pristine_git_object: 1b34f66aeaa1bc081b55429d6da1d6f8b2dd208e
docs/models/getcustomercustomer.md:
id: 3381323c87ac
last_write_checksum: sha1:cfc14496997c0e02ddc0a7f795869173602ecadb
pristine_git_object: d45f309647d8fb5e4ee472df111a724d18cf7b88
docs/models/getcustomerdiscount.md:
id: 68b9fbc4b51f
last_write_checksum: sha1:bc0ce7bc88f109f5b9ba1f8c822709ce0d6dcdb4
pristine_git_object: 315cf694e594c969aa213e4eb8f0d112e9ee433e
docs/models/getcustomerdisplay.md:
id: 3e4ef9f1de2d
last_write_checksum: sha1:214233d727c082bc72a19af0b0b0c78c551aa661
pristine_git_object: 725545076b30c338199d24955a6766e780a4d7bd
docs/models/getcustomerdurationtype.md:
id: 68d5be8f6fc0
last_write_checksum: sha1:5970ac9b6d798616edf56242abeb62e17a1d3a43
pristine_git_object: cb1a7378bd5903e08e6580a5aa6036cc55a519d8
docs/models/getcustomerentity.md:
id: 057e99e52926
last_write_checksum: sha1:9546685ddeff57b9796a303236358bb0c3338aed
pristine_git_object: 009a03c05d5a13b827aee96e96252c5849717366
docs/models/getcustomerentityenv.md:
id: b9e9dee9b436
last_write_checksum: sha1:32ed7b24b598bbd2a4b644cc2122a1c90b425648
pristine_git_object: 997853ad6bd50464b5fbcdb1110cadf3888e33c8
docs/models/getcustomerenv.md:
id: 028f4194d8e6
last_write_checksum: sha1:de29bef1fbc6e21305a3197c507b80cd67c1c22b
pristine_git_object: 4a6dd933a23733b06a3ab2eaf2028e6e5ce45431
docs/models/getcustomerfeature.md:
id: 65ee3d4b86ff
last_write_checksum: sha1:bdd92269ae4fc21f47f13f7ee19e81e3ae195a1a
pristine_git_object: 476f398f0265abc0fc6cfd776187a87921cb5cdd
docs/models/getcustomerflags.md:
id: 11d29a5797da
last_write_checksum: sha1:2c8af11617993ce97ec09c72367420c5732ff5fb
pristine_git_object: 51fd116f5e5e20b806d5dd9410b058e36b83d522
docs/models/getcustomerflagstype.md:
id: 847cbac1db8c
last_write_checksum: sha1:ded81b58d01b3d1e41fe1451c31a38a4a3deeab4
pristine_git_object: 4f402030b27fe7c9084e9032f75de14838de9d6f
docs/models/getcustomerglobals.md:
id: f4a52f28b640
last_write_checksum: sha1:fa7383045189c32179cdf592e4ca52971a341cad
pristine_git_object: 53823d0c1690be6be38ddce2f79c01972eaf24c3
docs/models/getcustomerinterval1.md:
id: a1e0fd24e0d2
last_write_checksum: sha1:682eba663e9bdf5e1fc2f3a456d93f75eec32311
pristine_git_object: f00807f1efa4f3bd2911d3ec2655eaec028c2740
docs/models/getcustomerinterval2.md:
id: "580448509254"
last_write_checksum: sha1:d89eaea629c957780abf1e8f4cb0bdc3ed6cc10c
pristine_git_object: 97610c69cb1ebc60470ec28d322c0fa83d93e76e
docs/models/getcustomerinvoice.md:
id: ff655e902b31
last_write_checksum: sha1:86eaff0467759cad2c3109439ad98fc6f86e83e1
pristine_git_object: 6c14afe0b29ec2dcda131caf1e698f095e07e927
docs/models/getcustomeroverageallowed.md:
id: 3d70170f0375
last_write_checksum: sha1:fb5aed6477e6177f1d069b947ee4c2d84b7d9a51
pristine_git_object: 7c2ac28b975c0b123a651083a82f3dba6fcccdd1
docs/models/getcustomerparams.md:
id: a9661c3c593c
last_write_checksum: sha1:5e6cd28bbb784995e31a70835320db297c466304
pristine_git_object: 5499b2488e61edef7c6f843f7620f034e1fad3b1
docs/models/getcustomerpurchase.md:
id: dfc2dae14e5a
last_write_checksum: sha1:e7b1db20da144422a1bec4bce64dd8441f2611f3
pristine_git_object: 392fd6750d99caf847539903b3e2a33f07a04ae9
docs/models/getcustomerpurchaselimit1.md:
id: 3982347562fb
last_write_checksum: sha1:cbf9a6c0097feb98a12d9bb3e8481acf016d80eb
pristine_git_object: 6eea17968da744fc172442533f2e7be81915285b
docs/models/getcustomerpurchaselimit2.md:
id: 2cfcfedf4421
last_write_checksum: sha1:68651dc614b4331fb5b48d8a18a12ac1fb4dc1cc
pristine_git_object: 0746019ad24837a77cecf63d44173b80bed83d0c
docs/models/getcustomerpurchaselimitunion.md:
id: bf8fb7e9287a
last_write_checksum: sha1:70f84883dc4562fa59565a47f86c7ec7adde866e
pristine_git_object: 3a2c51a95c477524bfa81581380590ea79e2c5e0
docs/models/getcustomerreferral.md:
id: f8e268de02f3
last_write_checksum: sha1:1eeb2fa974ff878651dcf340888ec2282edf6a21
pristine_git_object: 65839d3a5894f83a2c7b09c757d5b3da89b37597
docs/models/getcustomerresponse.md:
id: 1e613f025ef4
last_write_checksum: sha1:3e88dcac99d3168c68c1990499d450792de5909d
pristine_git_object: fd69151f9db5ff075364f32962d3cc3b74dc979c
docs/models/getcustomerrewards.md:
id: a1c0ad20f7d4
last_write_checksum: sha1:ed9bdc734a4b35823d30800a6bae69f3ef64b01f
pristine_git_object: cd9ef36ef08e2bbf0cbd848644c3ec40bf1cec74
docs/models/getcustomerrewardstype.md:
id: bca9891b2379
last_write_checksum: sha1:14f7882416d5285f94a1bae557b5bf64d7c482b4
pristine_git_object: a29c0bde788a5bafbe6f4b4077ac7b15598aa918
docs/models/getcustomerspendlimit.md:
id: b3d857db2f03
last_write_checksum: sha1:b402cd2018674b2ba798b2939a74b0d3f64f46ff
pristine_git_object: d40a46edbdb5509b4ea35ff597fbefb59931d850
docs/models/getcustomerstatus.md:
id: 27440cdebfdc
last_write_checksum: sha1:5430fb28af45acc07edd65e040c26257f913fae2
pristine_git_object: 65a6462793854fa6327117dcae1a49420cffff3e
docs/models/getcustomersubscription.md:
id: f35631fd7369
last_write_checksum: sha1:3e19bdddd52616c0e2ec8dcef489410bb5189d15
pristine_git_object: 88d543ef3d6fb67b3046a667d0dd1b8c7d1d3c48
docs/models/getcustomerthresholdtype.md:
id: 268aa4c50a1d
last_write_checksum: sha1:1a6dc5c8ba05fbda230d8a54a465fcdbe206e4a3
pristine_git_object: 1c21dbc9e8b2167a2a225aa55217607d8ec26ab5
docs/models/getcustomertrialsused.md:
id: 93711806b84e
last_write_checksum: sha1:8c2e57f3fd8641cf93e7bd330fecbc5ea7d45afe
pristine_git_object: 8eadb299111af0799f4fc5f4c014aea6918be329
docs/models/getcustomerusagealert.md:
id: 066db12640db
last_write_checksum: sha1:de1bc769abe3dc473fbe8907adadb3d0cb819c2f
pristine_git_object: b176834bc9ebd1ed112bc5cdd4fa4bfc6e357a3c
docs/models/getentitybillingcontrols.md:
id: 4a2d7e54760e
last_write_checksum: sha1:88399eaa62e5941f3f8a977d5d3244d63104d237
@@ -1261,8 +1517,8 @@ trackedFiles:
pristine_git_object: 294a00014f3a4732fa11f18169f9fc773c3f349b
docs/models/getorcreatecustomerparams.md:
id: 6bb57e046821
last_write_checksum: sha1:1bdea0e10613b79e9048d99e08f384599e0cfe85
pristine_git_object: 6e523613eb3c2bd4c9ac9550ad13629280f76253
last_write_checksum: sha1:78b718a6456170ac503c8073487a7c859645b72b
pristine_git_object: b1e3a1afec1781e4b17ebd4f648f08094153d2f2
docs/models/getorcreatecustomerpurchaselimit.md:
id: "425587326514"
last_write_checksum: sha1:04491bbc8604a1e1f93b1553c37ee571b27cff66
@@ -1835,6 +2091,18 @@ trackedFiles:
id: 4e485c687a41
last_write_checksum: sha1:b595ed400b0d689a292682908868d544474520e3
pristine_git_object: e837aa4e197e0d89a5af163eb58863349124e4de
docs/models/phase.md:
id: a2d01dc13e35
last_write_checksum: sha1:5375256edca7f898e086ff52a2b545ded10cdacf
pristine_git_object: 598eca4b734d209dc7646c642436a5766ca92e01
docs/models/phaserequest2.md:
id: 3e6acc701ac6
last_write_checksum: sha1:96325de185ccaa64348cfb468d44e89c7f961f82
pristine_git_object: d2df09fc245df74fc8b3a946b6bd4fa9b5b18270
docs/models/phaseresponse.md:
id: 9e5cff411fa0
last_write_checksum: sha1:606e9ce8826f60948590a5c0e6b5d1a648cf5f01
pristine_git_object: 6e82f013a774d896d3611f444cfe70f252d0b1dd
docs/models/plan.md:
id: 900c4149ef4b
last_write_checksum: sha1:7748f60aa0c9b0420a08de7b5eafaa4ccb10a5d2
@@ -1987,6 +2255,10 @@ trackedFiles:
id: 6cac4cb0ca48
last_write_checksum: sha1:697fd3000cdf5febf7a78846223b52fa115714aa
pristine_git_object: 27a8771eb5b6152b0bba9da9427a1f94104db92f
docs/models/previewattachinvoicecredits.md:
id: c34e1807d639
last_write_checksum: sha1:4e69690127bd3a31bfaddb83d282d5ca33dda35f
pristine_git_object: 349244232c15839b67bec01f899a4696175a1cc9
docs/models/previewattachinvoicemode.md:
id: 78a526159f9b
last_write_checksum: sha1:83d57ed29d6c74b8f7c0e9a379700a98046fc5a8
@@ -1997,24 +2269,24 @@ trackedFiles:
pristine_git_object: 4d34aab005e0e16a8f9a250e0a76011bc679afe4
docs/models/previewattachlineitem.md:
id: 3411ba3438a0
last_write_checksum: sha1:7c2df8dabcaa3fc464ccda62846c7dbc36820be7
pristine_git_object: 12daaccfca0d55c4069e58b656faa27362abbaf4
last_write_checksum: sha1:9af26052a4ff815b4d6e68d316e9dab739bdb011
pristine_git_object: 31624ce2175790d48dcaceeee34281d78a045bd5
docs/models/previewattachlineitemperiod.md:
id: c16d43d27c69
last_write_checksum: sha1:4b830925cad5177b8abc0ec2f914bc0243b3dd5a
pristine_git_object: 01b8b734d7c4a6c666fcf3032be87ee68e5d1621
docs/models/previewattachnextcycle.md:
id: 3cc2f99c2ce3
last_write_checksum: sha1:31b7e80c5ea1dd61ace8b23156b594cca5c8953e
pristine_git_object: d79ae0588300bfb744d966cd9be12c5244651a20
last_write_checksum: sha1:8f1ab97209c48ace4723ce9479005cab6e9556fa
pristine_git_object: 3d3ea615d564a1ffd46ed98261f56785be32c015
docs/models/previewattachnextcyclediscount.md:
id: a9c4372319db
last_write_checksum: sha1:0a0cc515b79291c72b1e4353101ef71ec0b9442a
pristine_git_object: 5d4d3b41e8b05647b222f01117d0a9ebace7401e
docs/models/previewattachnextcyclelineitem.md:
id: 8a98d1d954b8
last_write_checksum: sha1:45ac06c00909be65ceaa9749e4bf503b031e7243
pristine_git_object: 7c43af6c0a714a44f1598d9f0694cea3a456b9a3
last_write_checksum: sha1:3fd03b5ad81e22376b67afc4de5d1eff05aa3672
pristine_git_object: bfb3608159293fa3fbc8a63d5c3ea11d4990f6ba
docs/models/previewattachnextcyclelineitemperiod.md:
id: a369aacdd0f8
last_write_checksum: sha1:03d2958349be3237236d7d0610d5fafcf1d81e6d
@@ -2037,8 +2309,8 @@ trackedFiles:
pristine_git_object: 7ec5834b5a153e688ba7faab51dfd5a65fe868d7
docs/models/previewattachparams.md:
id: 3ba40d589e3d
last_write_checksum: sha1:6d2003b673b074e9e310ee2c1eb3c38e249ee407
pristine_git_object: f24e1be9d27e351af650f126719136e83981e2da
last_write_checksum: sha1:fcc366143b1f6a4fdb3dd01848f492a44461c514
pristine_git_object: f742ebb9e40ff6df944d6e0fb752ca1d3f775c34
docs/models/previewattachplanitem.md:
id: db3480cfb03c
last_write_checksum: sha1:f53174ffd7c56ee9e3b7c06a1c17b30ed8fd362e
@@ -2077,8 +2349,8 @@ trackedFiles:
pristine_git_object: f93e84304174b521a52bca93cb58a1adef492b4f
docs/models/previewattachresponse.md:
id: a678e8dbf94c
last_write_checksum: sha1:291e418e5712cd1ddc5f85d77f4c98601a9bf342
pristine_git_object: 424ec1a78e691e8e3fc2be7a3f1aaf114a881b1c
last_write_checksum: sha1:a996de487bc35e975c8ae33a1849250fac820397
pristine_git_object: e022b4d0d70d3adbc44f1f0ad6dfbb9700011004
docs/models/previewattachrollover.md:
id: 8ef3a1be0fed
last_write_checksum: sha1:e9fe12ecb69ab2bb4dbc4c288943b7263ba0dd50
@@ -2167,6 +2439,10 @@ trackedFiles:
id: 0d1c8af25b06
last_write_checksum: sha1:ba7e32dc427387e3bdcb87f7b417c23bec9fa484
pristine_git_object: a86e3e5da0d6d7592800e9078d3c826f8c93f24f
docs/models/previewmultiattachinvoicecredits.md:
id: eeb8e3551ef6
last_write_checksum: sha1:223f54fc2e2eab6c5b517cd8bf779effb91986e9
pristine_git_object: 0eabc09a8013ecf8ef5571178b35b8b3b1b8ce5a
docs/models/previewmultiattachinvoicemode.md:
id: 54ae12af9cfe
last_write_checksum: sha1:bc0d0e512c3643cfb05d0ee952fc4f10a06e02f8
@@ -2177,24 +2453,24 @@ trackedFiles:
pristine_git_object: 0d85a18353ad4537cda3cfd68537f0b8cd96a1a3
docs/models/previewmultiattachlineitem.md:
id: 372c4f319256
last_write_checksum: sha1:16a0c4e95728c97567e80479d6fec964b275c6c4
pristine_git_object: 3a1b8f7c904c21b55115272cc9b68edc6149f148
last_write_checksum: sha1:12eb82c8995899afb19f7d5e261fa0fa4fc022d5
pristine_git_object: 18717c75222f25974221c6e97f179f9bab4ac9f7
docs/models/previewmultiattachlineitemperiod.md:
id: 12d371b159d5
last_write_checksum: sha1:75d89898e642e5aee5503f78ac8ffbbf125fde3f
pristine_git_object: eeb4631827a736cab1851efd805b8bdfae50e348
docs/models/previewmultiattachnextcycle.md:
id: 5e370fab1e3c
last_write_checksum: sha1:ffcf2080b300a03d6f2137826e8b893486f949c1
pristine_git_object: 1cdcecfa912b0e772edd44d25f543c4c0d126630
last_write_checksum: sha1:58ee038660016e33690497d14f8782394a9633b2
pristine_git_object: 1bbec658b41d4448b98b650c082663ae6ed7ccd3
docs/models/previewmultiattachnextcyclediscount.md:
id: bf613a658258
last_write_checksum: sha1:8d5a13d074ae87044b7cd9d5c8da3c3a95c0c1e9
pristine_git_object: b650b075bf5d41bba0436df6a0a1eea1bd77cb3c
docs/models/previewmultiattachnextcyclelineitem.md:
id: 3932422ac0ba
last_write_checksum: sha1:a6342419a5e7e3199b6e643175c5ffdebe441735
pristine_git_object: 586f7005f5d75a65c8c48230949f5cc180e39fbf
last_write_checksum: sha1:c7ed2aa1794b4283181a2fc2c055b76ce142030c
pristine_git_object: 1edd723831033645e21f5575f3cc8ac23b24c1dc
docs/models/previewmultiattachnextcyclelineitemperiod.md:
id: 1b4111e5cd5b
last_write_checksum: sha1:6c3de24a98dfa088e9f85f8cc42dd13dc2306e63
@@ -2261,8 +2537,8 @@ trackedFiles:
pristine_git_object: 1848a0347c3b21aede196a3e3f4edeec7a25fc3f
docs/models/previewmultiattachresponse.md:
id: 122c343c9098
last_write_checksum: sha1:80169ea505ec4cf0d7ac588d9db9ba416817edd8
pristine_git_object: 17588f74ce636682aa6da8ec113ef5562e9e7f08
last_write_checksum: sha1:66cc662d2b4f91e6d2d9806ff70ec384074e48c4
pristine_git_object: e6e37a6a7e35e8f7cb6118a43e44a44401479454
docs/models/previewmultiattachrollover.md:
id: 156269f00e06
last_write_checksum: sha1:f02d0f635ab72e901ca4cefbb247feaeb1dc7271
@@ -2359,6 +2635,10 @@ trackedFiles:
id: 76ae479acaa8
last_write_checksum: sha1:ac92bcc9ccc296703d0c839fd5c68bc59c00bd12
pristine_git_object: aaee40ab3b3c15a4bda2ebb4c611518c41395bbf
docs/models/previewupdateinvoicecredits.md:
id: 7288053510ca
last_write_checksum: sha1:2209f3adfa5de7934fa8e96d0cce8d402e49d469
pristine_git_object: 8d455493b186d8088852a906a3778b8bb3a4b017
docs/models/previewupdateinvoicemode.md:
id: 171401d06f36
last_write_checksum: sha1:b83b7ac6d353171470a200d0bbdc349eef937f72
@@ -2369,24 +2649,24 @@ trackedFiles:
pristine_git_object: 7542efb89bf43f3561ffa9ceba43149394ba2b2c
docs/models/previewupdatelineitem.md:
id: 74e43e80addb
last_write_checksum: sha1:e5b6dfc60e56592fa18122d3407a3885d2eeb40a
pristine_git_object: 016ca63f3fb2e82ace837699d235e5ef730f0d2b
last_write_checksum: sha1:3ab1a304fe64b0bff207ae111aa20a407b3a85a0
pristine_git_object: 13327a13e4641f3aeceb0ecc90e682aba2047415
docs/models/previewupdatelineitemperiod.md:
id: f1561a3c1e8b
last_write_checksum: sha1:b6d01fb90796fa7eeff964a72f55b4915fa2c9f9
pristine_git_object: 025fd8b55864c967221f691de5b6234d57f88adc
docs/models/previewupdatenextcycle.md:
id: df4d92d3f9ed
last_write_checksum: sha1:99f5a779e1077e8cbd208002c4b6330ba13b8636
pristine_git_object: 838beb20b20bf73b4c7782bc7fd4fbcf7b6f27ca
last_write_checksum: sha1:59e0d10fe52652a43d8164a7c23b9d962cc76239
pristine_git_object: d999351c47a51945f429fd28b99c6fac8aa9132e
docs/models/previewupdatenextcyclediscount.md:
id: ca72534e9b17
last_write_checksum: sha1:35bf01e553c788d46c46b02a547aa9a29001ba3e
pristine_git_object: db252304d9edb5f68e7dffade2b1a5103b420136
docs/models/previewupdatenextcyclelineitem.md:
id: 23ad2cdda7c2
last_write_checksum: sha1:05e276c3b74d76d6b2192d383a1f42cdd4a1c069
pristine_git_object: 6dd3118602a41a88098e56a3aa777652f6a24ff2
last_write_checksum: sha1:4ceb7debe95bef31961d3cea7cd695d3a47f4039
pristine_git_object: 4108ef960580f175ee8d9ea000a2ef1bbee6a0b3
docs/models/previewupdatenextcyclelineitemperiod.md:
id: f181f7c650d4
last_write_checksum: sha1:1abee1e0a3c30b70b76520ca51067b2cb5751086
@@ -2449,12 +2729,20 @@ trackedFiles:
pristine_git_object: df69f8a61b19667d538abe303032542b39d111f5
docs/models/previewupdateresponse.md:
id: 4a657c603c51
last_write_checksum: sha1:852ed327e9ff9a651f734d797a66089dca3f078f
pristine_git_object: 768b3d26143140c7687ab7d282077c3cedd0b1bc
last_write_checksum: sha1:c523ef42c895e2c84c460599a19e66c7963273f0
pristine_git_object: 94843185dd85f6033f3059cd1edcabe1975328e8
docs/models/previewupdaterollover.md:
id: 269e4cea4344
last_write_checksum: sha1:883adbc48dc1e7a94fc885947d4b1b9e439cf38c
pristine_git_object: fd345876744ec5463429a536733b112ed5a64868
docs/models/previewupdatestatus.md:
id: 5a1275e9265f
last_write_checksum: sha1:8fef0127e32ad57f6a2b78c0b5634679de7f5286
pristine_git_object: d7b9cb2654146d899cace1a87ddad900e9c3e865
docs/models/previewupdatetax.md:
id: c4d8ac245477
last_write_checksum: sha1:fcd29be7c7d44b8e969d5032da741a5ed7fb7364
pristine_git_object: 47d2085263761cac3d2a66fee40a491de8829dac
docs/models/previewupdatetier.md:
id: bf6c0c1ebd66
last_write_checksum: sha1:2c4b39116f7e8bb7262b5ce5e0239da6f563e970
@@ -2551,10 +2839,6 @@ trackedFiles:
id: 4551c882db3e
last_write_checksum: sha1:49d41902a34cb66859df2528ed2fe8597e8eae84
pristine_git_object: fcbd3790d73d6a7157b9665d8221be09af8822bf
docs/models/rewardstype.md:
id: 338992fe95d5
last_write_checksum: sha1:224b80dbd92ef68bd770b3a80bf937ac43733556
pristine_git_object: 8b34bbb0cd357bcc79eb45b0e7f4ce9b6399f846
docs/models/scenario1.md:
id: 46a671d6aaa0
last_write_checksum: sha1:b12d6dabe5eb22a82e63c72f97b268a6f9516e8f
@@ -2629,8 +2913,8 @@ trackedFiles:
pristine_git_object: 546483389b2445ebcd164757c3fc24f07b48a40a
docs/models/setuppaymentparams.md:
id: d71f82dde273
last_write_checksum: sha1:fb06817eadfc940e29592748af2d9c2940fd4b2a
pristine_git_object: 0b90b2448cf017afa92fc51c791967a8e4bccb42
last_write_checksum: sha1:ba15ba8dfcfb54a0ee5cd83c1450a0ad9dfc251a
pristine_git_object: afc1a0d0ac200f2031db7ac8cdd1988a90b64db0
docs/models/setuppaymentplanitem.md:
id: b79b706606a1
last_write_checksum: sha1:557beeeacbd10fa2e774d2b9e19f870cd0932d01
@@ -3205,12 +3489,12 @@ trackedFiles:
pristine_git_object: db2b13c3ee155b8d0740c164c952f2adb7413138
docs/sdks/billing/README.md:
id: dc915331dd9d
last_write_checksum: sha1:a2b88f6b3cbe7d9884a64fed0353f11e18f1c530
pristine_git_object: 98bb69d7c6cc7e8f370882f72d793efd4f6e2ffa
last_write_checksum: sha1:b3531dd3871ebbae5ecad5181d526459f4cb40bb
pristine_git_object: 2ba261ec11bb96c57d57107020da1495ce183d7b
docs/sdks/customers/README.md:
id: 9332759cffc2
last_write_checksum: sha1:7891da6f1020caabab95d15af5ffa2e9a873f3a8
pristine_git_object: 916c13dcc71c4b8c09632210c346c738a71cfade
last_write_checksum: sha1:a242d24e05645c1d7e193a2de6b05cd0d75ec1ec
pristine_git_object: 629f6540f827518a16bdb4b97ce334ec4ceed8cb
docs/sdks/entities/README.md:
id: a140ac5181b9
last_write_checksum: sha1:b87840c9b3eb4c37b2473810395837a0b08b71fd
@@ -3265,28 +3549,28 @@ trackedFiles:
pristine_git_object: 3e604651c1eae73d815b276806e73b2f1334bb79
src/autumn_sdk/_version.py:
id: a98babfdf4fc
last_write_checksum: sha1:96ba5f0841933afd5576b1a6fb80c1b374b33a0b
pristine_git_object: 0628b046b07d0182a12d174657e7cd10b0afbee1
last_write_checksum: sha1:48d80ec79d1e2d4c26194db9db1ac7886acd76f1
pristine_git_object: 6fd40e5912793561523e90b1595f3300d62bf238
src/autumn_sdk/balances.py:
id: 0a15be654dad
last_write_checksum: sha1:a80cd6dff1eb264c51674962c6d459cf7d692211
pristine_git_object: 930c70fbcf914339d9357542673c070deb45655c
last_write_checksum: sha1:51d725f62f14d78037909fd4399d77a1291df149
pristine_git_object: e03f676bfe86690f4c87d78f0b205764f46d1def
src/autumn_sdk/basesdk.py:
id: 8c9c35fe744d
last_write_checksum: sha1:f0ea7a4f9bd2261c88a1a5e20e7e734eb2e2e289
pristine_git_object: b0056b29f4185cce9f09aad5b284a0bf8754266e
last_write_checksum: sha1:7fefc93ebfec063a4ffcb8ab6f4ed5675e7f50dd
pristine_git_object: 4db96641966f6337a1a1613ea731050ed25a1fb9
src/autumn_sdk/billing.py:
id: e6cffdbf2221
last_write_checksum: sha1:0d7ba2be5305b4ca9e2f759195eccefdebb57769
pristine_git_object: d0a2fbb962c24524f073efd08a5429af85264300
last_write_checksum: sha1:82544aabeb0212e6b8bc1144fe449f93e0ef90e8
pristine_git_object: 7dd9de5f8157177f4380da441424c560f30de256
src/autumn_sdk/customers.py:
id: 5c5a0a07a433
last_write_checksum: sha1:be3161cc86a2caaf27766a076d0bf3508ad8dd27
pristine_git_object: 541876f05fb57a80abdb15db90b16114db8c0b80
last_write_checksum: sha1:9e122b366aaf67db8fbc4866c6173f0f57362cbb
pristine_git_object: 0f6c4580e9aeacd2441b8bc7bf8602f7e2451a70
src/autumn_sdk/entities.py:
id: 32ba2aa0874c
last_write_checksum: sha1:7c67de3a65d1a6607f2323d0bf172c590b1ce66b
pristine_git_object: f6b57b6c0194f874f0ba24d8f2c0175669189983
last_write_checksum: sha1:be7aa90605672cf8a553dbb78cd4346dcd0725e9
pristine_git_object: 42bc814e517197ee68a2973d51c063b63897ebd2
src/autumn_sdk/errors/__init__.py:
id: 242853123cf2
last_write_checksum: sha1:1c4f4e0181a6598b531c2621340548b003df6e2a
@@ -3309,28 +3593,28 @@ trackedFiles:
pristine_git_object: 1efa993593b78b8f93587adf8a12ce2efbb11002
src/autumn_sdk/events.py:
id: 3421eef7bbd5
last_write_checksum: sha1:f6b0890b6a1ff394cf123ce8018a8bc40f7eba51
pristine_git_object: 8dcca8ecb35a369b3f2ca87e27a335bd4d890cbe
last_write_checksum: sha1:dc57a9f8662d281a159066f80e773e92a7b29d2f
pristine_git_object: a8258a4afadbe8293f68d7cfd2c6426ba9ba6593
src/autumn_sdk/features.py:
id: 79d780190f74
last_write_checksum: sha1:047e1aeb66bc28e3c9441f0b28a14e9512a33c52
pristine_git_object: 06f742281f8d2088c4092fdbf5da7622bbd55c17
last_write_checksum: sha1:24f5dcce8bc1f0afc6f2dc0af6e2bc71ca1c1d8d
pristine_git_object: 788d299f5f08153678bc710821d8b9e8d2406c15
src/autumn_sdk/httpclient.py:
id: d09fa60cf82e
last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7
pristine_git_object: 89560b566073785535643e694c112bedbd3db13d
src/autumn_sdk/models/__init__.py:
id: bcf3802243ff
last_write_checksum: sha1:8c7ff7a7e2bc9841235636f8b0bf6c432fe28917
pristine_git_object: d6a13a41de9044ecbd74ee26f9e4708c8f3c31af
last_write_checksum: sha1:65cf13840d000a5911553b24e7e05a34e066c83f
pristine_git_object: e5fb57d8aa348e4654f6917ed10b48bdc5eca2c1
src/autumn_sdk/models/aggregateeventsop.py:
id: 01321099f2a5
last_write_checksum: sha1:b3f1de2b9cf9a0365863f0e6cf9c10e793f52a42
pristine_git_object: 007a1684b50ba952329ca2deb2c3f021faeb8a37
src/autumn_sdk/models/attachop.py:
id: ebb59e06476c
last_write_checksum: sha1:ff57171700dc6caa0ac616f00027b827c4e13173
pristine_git_object: 5d767efc67954fff2923134abdddc17e9f3c6483
last_write_checksum: sha1:0c05b1ef6b0212574839c2f24ce1aec8874bdeaa
pristine_git_object: 8ef2fcb36df4af70c0098253abc32d93d4d79ea0
src/autumn_sdk/models/balance.py:
id: a6354d7c4b97
last_write_checksum: sha1:dde97ce288519d7caba988d09f419bb0a79719f9
@@ -3363,14 +3647,22 @@ trackedFiles:
id: 2f5f7b136c39
last_write_checksum: sha1:aee36f911153fc0dab9fd096dbb82d1083a61d28
pristine_git_object: cd3ad48900dab5fd4b07db41d62388e68a1818b2
src/autumn_sdk/models/createscheduleop.py:
id: afb0cf1cf7f2
last_write_checksum: sha1:744a9122973e62b5e9e91e8d14d1a1c4919f8541
pristine_git_object: 18e657fac1bdc9308ae12f86fd0a0fd0c3c6defd
src/autumn_sdk/models/customer.py:
id: 8ed0174f7272
last_write_checksum: sha1:6a6ce799d216fbd7e394758d50d04aaaa3163d44
pristine_git_object: 5090af3b886e5f4cf2e38618e1a224fdbdfd256e
last_write_checksum: sha1:db716e636f7d2c982cacc68dba4f453fd9b93463
pristine_git_object: 26d3963839c3156fee3a97d77112614b08588d7e
src/autumn_sdk/models/customerdata.py:
id: 9d88118f2123
last_write_checksum: sha1:3342d09cf62cc51d935fecf1edfac126bcc203de
pristine_git_object: ca4927b2e00f1ec39cbd9f56f22f7d83bf84499c
src/autumn_sdk/models/customerexpand.py:
id: 9d337d480baa
last_write_checksum: sha1:ea31eb539b3854d917a7d8fe5685f730b8577a1f
pristine_git_object: 6d020a0f8da88109f10c72fd81248a4d5194a31e
src/autumn_sdk/models/deletebalanceop.py:
id: 97d06f64852a
last_write_checksum: sha1:ba767e7c2cfe20f213abff1235768b6e789ef11b
@@ -3395,6 +3687,10 @@ trackedFiles:
id: 8ae2484b0916
last_write_checksum: sha1:50898394734e6e9a366363ef64dd6ac917d61ad2
pristine_git_object: d7744bc3f223baddeed24f3e14315d9f6da0b84d
src/autumn_sdk/models/getcustomerop.py:
id: 266e08dde55d
last_write_checksum: sha1:1701abd577986b7c7e516e398732e1ab78e00c89
pristine_git_object: 612a2ee2e740f2af22fd981b30cd08b5aa576be9
src/autumn_sdk/models/getentityop.py:
id: 6a624594b41f
last_write_checksum: sha1:2cc7bfc4ad25eb82d3563ee469e08f336e0af982
@@ -3405,8 +3701,8 @@ trackedFiles:
pristine_git_object: 63aec0714ea5d7f98ffdb2d7125d0b9db6fe8537
src/autumn_sdk/models/getorcreatecustomerop.py:
id: acfac0d7be14
last_write_checksum: sha1:8ed5706880216c93b5aae8559dc1ddfcee782387
pristine_git_object: 94a67732b0583b0df4e48ff6a4e3a28965ecfcd5
last_write_checksum: sha1:9e7565db7d134b1c5925e4e4d18e26695b74e4f1
pristine_git_object: c929128d66a9269897320872bf8eefb7b64bd9e1
src/autumn_sdk/models/getplanop.py:
id: 590fb77ac88d
last_write_checksum: sha1:383238b15583a631ec9331155c42fb334c40be27
@@ -3449,16 +3745,16 @@ trackedFiles:
pristine_git_object: d8fe9290927c4d94e23fc4311f72e94b90e4e296
src/autumn_sdk/models/previewattachop.py:
id: 2b361be4bfa8
last_write_checksum: sha1:ae14390b01e51016a64d0b34e10e25def283e10a
pristine_git_object: e4a141b6961912860d6b236425b31e8a64f4d94c
last_write_checksum: sha1:35fa1884a90b563e664db074d5b56d69d8f28452
pristine_git_object: 244f34443708a05f620b12e8d6a1ea676b297529
src/autumn_sdk/models/previewmultiattachop.py:
id: 963ffcd646a4
last_write_checksum: sha1:bb14745f46d14bbf3a0cd79dcfa3490f5673095a
pristine_git_object: 6e7551def1123a8eb9014dca3b42a59266393c82
last_write_checksum: sha1:78649eba8cb3ddf5deb5050f68750010ece2dccc
pristine_git_object: 3f576330c827cf3599ee700ef4c0a818c51ee018
src/autumn_sdk/models/previewupdateop.py:
id: 081d5f08508d
last_write_checksum: sha1:39e62a4214fb2d6d3169b5fbaeeefd25324ea27f
pristine_git_object: baa2910994ee0c0e21ee37e39ecfa9b83163f618
last_write_checksum: sha1:73ef8c4caa27e35fd298f1e46414d74741cd88ac
pristine_git_object: 7d274e181499c925079d486ecafadeeef7eb2383
src/autumn_sdk/models/redeemreferralcodeop.py:
id: 0abd7bfae718
last_write_checksum: sha1:df1248aa8876e069c8094cba0541acc4911db620
@@ -3469,8 +3765,8 @@ trackedFiles:
pristine_git_object: aa686dd6f85ae1e27450392fcfe02527adfe8e61
src/autumn_sdk/models/setuppaymentop.py:
id: 603339ee67e3
last_write_checksum: sha1:67cbdb5f2eced8c64e75154844e9c9546fa8a820
pristine_git_object: 8b8c6c364ce8421f512f0b779c1a31316f86dceb
last_write_checksum: sha1:cf4f0ab08eeb2efa4f0d71576e7674f027b0b8be
pristine_git_object: 00fa6082bf86b9f59352af6cbd886bf11cc1db14
src/autumn_sdk/models/trackop.py:
id: 2a744315e781
last_write_checksum: sha1:14a3673c9d5840cc222309d54e398e31929dcbca
@@ -3497,20 +3793,20 @@ trackedFiles:
pristine_git_object: 7afbc58a0709f37570f94ad4ee2831f3e99b6750
src/autumn_sdk/plans.py:
id: cf1ebabb687c
last_write_checksum: sha1:1baa525a65489921c371dede0cd70a3dd5fda07e
pristine_git_object: 5942adc74d36e37c8fe69cd47a66ff05b9f3eb1a
last_write_checksum: sha1:bd85dfb5c6e239419f2205379ba6aa03eeb82bba
pristine_git_object: 2edf107a213060aaad7b3de90f071cfe3b4b479d
src/autumn_sdk/py.typed:
id: 9b75cee1c007
last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60
pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544
src/autumn_sdk/referrals.py:
id: fb7e9ff59ffd
last_write_checksum: sha1:7f93c868f3c5f38fdf8f11439397ff530a3ef37f
pristine_git_object: 4fde94822b61d8a600b721fcbda99116c0e7a6ad
last_write_checksum: sha1:c1b1d5b3da720d41ba417596b5e38825096825ec
pristine_git_object: 479586dfa3c7c2bb380283ad7099f02beec3e155
src/autumn_sdk/sdk.py:
id: 9e733b372628
last_write_checksum: sha1:539d7a68e17d782aaa17185c27d43322f572d4d2
pristine_git_object: d1078f8612cc9f9a0dbb25eed621ba8974a22a7a
last_write_checksum: sha1:3eaf831867918f13b43b50ee0686f104d423c26c
pristine_git_object: f77537463d65a420116dccc1f94491111396e87b
src/autumn_sdk/sdkconfiguration.py:
id: e65df2e44fc0
last_write_checksum: sha1:233b710dff940202f00e389e0c8fa6a33f6ae7b4
@@ -3561,8 +3857,8 @@ trackedFiles:
pristine_git_object: b661aff65d38b77d035149699aea09b2785d2fc6
src/autumn_sdk/utils/metadata.py:
id: cfa061783b06
last_write_checksum: sha1:c6a560bd0c63ab158582f34dadb69433ea73b3d4
pristine_git_object: 173b3e5ce658675c2f504222a56b3daaaa68107d
last_write_checksum: sha1:e703e5cbb5255144aacf86898d1420529afaaff8
pristine_git_object: 5abddd588837ac297050ca3b543627faadb350a9
src/autumn_sdk/utils/queryparams.py:
id: 04a0435c55f9
last_write_checksum: sha1:b94c3f314fd3da0d1d215afc2731f48748e2aa59
@@ -3577,12 +3873,12 @@ trackedFiles:
pristine_git_object: af07d4e941007af4213c5ec9047ef8a2fca04e5e
src/autumn_sdk/utils/security.py:
id: 205e1b4aa7c9
last_write_checksum: sha1:435dd8b180cefcd733e635b9fa45512da091d9c0
pristine_git_object: 17996bd54b8624009802fbbdf30bcb4225b8dfed
last_write_checksum: sha1:c11eef495b6aaa249178c24c796940cc540b7a00
pristine_git_object: 42d8d78e9981eed7507670014d99588e27ab325a
src/autumn_sdk/utils/serializers.py:
id: 7e3c1b25377d
last_write_checksum: sha1:ce1d8d7f500a9ccba0aeca5057cee9c271f4dfd7
pristine_git_object: 14321eb479de81d0d9580ec8291e0ff91bf29e57
last_write_checksum: sha1:61009f2e4ef6613a1a5af813fe020373dae5a492
pristine_git_object: d2149f8b909cb96628db140ac3cddb1b1e981367
src/autumn_sdk/utils/unmarshal_json_response.py:
id: b73873b9076e
last_write_checksum: sha1:b68339d259e2184158d7c760d28eb48d367fcc61
@@ -4138,4 +4434,24 @@ examples:
responses:
"200":
application/json: {"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"id": "<id>", "plan_id": "pro_plan", "auto_enable": true, "add_on": false, "status": "active", "past_due": false, "canceled_at": null, "expires_at": null, "trial_ends_at": null, "started_at": 1771431921437, "current_period_start": 1771431921437, "current_period_end": 1771999921437, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}}, "flags": {"key": {"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "expires_at": null, "feature_id": "dashboard"}}, "invoices": []}
getCustomer:
speakeasy-default-get-customer:
parameters:
header:
x-api-version: "2.2.0"
requestBody:
application/json: {"customer_id": "cus_123"}
responses:
"200":
application/json: {"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 1555.93, "fingerprint": null, "stripe_id": "<id>", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "billing_controls": {}, "subscriptions": [{"id": "<id>", "plan_id": "<id>", "auto_enable": true, "add_on": false, "status": "active", "past_due": false, "canceled_at": 6241.27, "expires_at": 6335.21, "trial_ends_at": 3224.34, "started_at": 8234.53, "current_period_start": 1986.12, "current_period_end": 8143.9, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "<id>", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": true, "max_purchase": 8544.34, "next_reset_at": 4875.58, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "<id>", "included_grant": 8826.95, "prepaid_grant": 3799.11, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 8927.45}, "price": null, "expires_at": 3678.26}]}}, "flags": {"advanced_workflows": {"id": "cus_ent_abc123", "plan_id": "pro_plan", "expires_at": null, "feature_id": "advanced_workflows"}}, "config": {"disable_pooled_balance": false}}
createSchedule:
speakeasy-default-create-schedule:
parameters:
header:
x-api-version: "2.2.0"
requestBody:
application/json: {"customer_id": "cus_123", "redirect_mode": "if_required", "billing_cycle_anchor": "now", "phases": [{"starts_at": 1735689600000, "plans": [{"plan_id": "trial_plan"}]}, {"starts_at": 1736899200000, "plans": [{"plan_id": "pro_plan"}]}]}
responses:
"200":
application/json: {"customer_id": "cus_123", "entity_id": null, "status": "created", "schedule_id": "sch_1234", "phases": [{"phase_id": "sphs_1111", "starts_at": 1735689600000, "customer_product_ids": ["cus_prod_1111"]}, {"phase_id": "sphs_2222", "starts_at": 1736899200000, "customer_product_ids": ["cus_prod_2222"]}], "invoice": {"status": "<value>", "stripe_id": "<id>", "total": 6782.1, "currency": "Iranian Rial", "hosted_invoice_url": "https://partial-unibody.org/"}, "payment_url": null}
examplesVersion: 1.0.2

View File

@@ -213,6 +213,9 @@ Use this after an action happens to decrement usage, or send a negative value to
* [attach](docs/sdks/billing/README.md#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades.
Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product.
* [create_schedule](docs/sdks/billing/README.md#create_schedule) - Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
* [multi_attach](docs/sdks/billing/README.md#multi_attach) - Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated.
Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products.
@@ -236,6 +239,9 @@ Use this endpoint to show customers prorated charges or refunds before confirmin
* [get_or_create](docs/sdks/customers/README.md#get_or_create) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID.
Use this as the primary entrypoint before billing operations so the customer record is always present and up to date.
* [get](docs/sdks/customers/README.md#get) - Fetches a customer by ID, optionally expanding related data such as invoices or entities.
Use this when you know the customer exists or assert they exist without creating them.
* [list](docs/sdks/customers/README.md#list) - Lists customers with pagination and optional filters.
* [update](docs/sdks/customers/README.md#update) - Updates an existing customer by ID.
* [delete](docs/sdks/customers/README.md#delete) - Deletes a customer by ID.

View File

@@ -5,8 +5,8 @@ import importlib.metadata
__title__: str = "autumn-sdk"
__version__: str = "0.4.18"
__openapi_doc_version__: str = "2.2.0"
__gen_version__: str = "2.869.25"
__user_agent__: str = "speakeasy-sdk/python 0.4.18 2.869.25 2.2.0 autumn-sdk"
__gen_version__: str = "2.882.0"
__user_agent__: str = "speakeasy-sdk/python 0.4.18 2.882.0 2.2.0 autumn-sdk"
try:
if __package__ is not None:

View File

@@ -110,7 +110,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -230,7 +230,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -347,7 +347,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -464,7 +464,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -569,7 +569,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -674,7 +674,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -773,7 +773,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -874,7 +874,7 @@ class Balances(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -6,6 +6,7 @@ from autumn_sdk._hooks import (
AfterErrorContext,
AfterSuccessContext,
BeforeRequestContext,
HookContext,
)
from autumn_sdk.utils import (
RetryConfig,
@@ -66,6 +67,7 @@ class BaseSDK:
url_override: Optional[str] = None,
http_headers: Optional[Mapping[str, str]] = None,
allow_empty_value: Optional[List[str]] = None,
allowed_fields: Optional[List[str]] = None,
) -> httpx.Request:
client = self.sdk_configuration.async_client
return self._build_request_with_client(
@@ -87,6 +89,7 @@ class BaseSDK:
url_override,
http_headers,
allow_empty_value,
allowed_fields,
)
def _build_request(
@@ -110,6 +113,7 @@ class BaseSDK:
url_override: Optional[str] = None,
http_headers: Optional[Mapping[str, str]] = None,
allow_empty_value: Optional[List[str]] = None,
allowed_fields: Optional[List[str]] = None,
) -> httpx.Request:
client = self.sdk_configuration.client
return self._build_request_with_client(
@@ -131,6 +135,7 @@ class BaseSDK:
url_override,
http_headers,
allow_empty_value,
allowed_fields,
)
def _build_request_with_client(
@@ -155,6 +160,7 @@ class BaseSDK:
url_override: Optional[str] = None,
http_headers: Optional[Mapping[str, str]] = None,
allow_empty_value: Optional[List[str]] = None,
allowed_fields: Optional[List[str]] = None,
) -> httpx.Request:
query_params = {}
@@ -188,7 +194,9 @@ class BaseSDK:
security = security()
if security is not None:
security_headers, security_query_params = utils.get_security(security)
security_headers, security_query_params = utils.get_security(
security, allowed_fields
)
headers = {**headers, **security_headers}
query_params = {**query_params, **security_query_params}
@@ -230,10 +238,10 @@ class BaseSDK:
def do_request(
self,
hook_ctx,
request,
error_status_codes,
stream=False,
hook_ctx: HookContext,
request: httpx.Request,
is_error_status_code: Callable[[int], bool],
stream: bool = False,
retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
) -> httpx.Response:
client = self.sdk_configuration.client
@@ -277,21 +285,6 @@ class BaseSDK:
"<streaming response>" if stream else http_res.text,
)
if utils.match_status_codes(error_status_codes, http_res.status_code):
result, err = hooks.after_error(
AfterErrorContext(hook_ctx), http_res, None
)
if err is not None:
logger.debug("Request Exception", exc_info=True)
raise err
if result is not None:
http_res = result
else:
logger.debug("Raising unexpected SDK error")
raise errors.AutumnDefaultError(
"Unexpected error occurred", http_res
)
return http_res
if retry_config is not None:
@@ -299,17 +292,27 @@ class BaseSDK:
else:
http_res = do()
if not utils.match_status_codes(error_status_codes, http_res.status_code):
if is_error_status_code(http_res.status_code):
result, err = hooks.after_error(AfterErrorContext(hook_ctx), http_res, None)
if err is not None:
logger.debug("Request Exception", exc_info=True)
raise err
if result is not None:
http_res = result
else:
logger.debug("Raising unexpected SDK error")
raise errors.AutumnDefaultError("Unexpected error occurred", http_res)
else:
http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
return http_res
async def do_request_async(
self,
hook_ctx,
request,
error_status_codes,
stream=False,
hook_ctx: HookContext,
request: httpx.Request,
is_error_status_code: Callable[[int], bool],
stream: bool = False,
retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
) -> httpx.Response:
client = self.sdk_configuration.async_client
@@ -359,22 +362,6 @@ class BaseSDK:
"<streaming response>" if stream else http_res.text,
)
if utils.match_status_codes(error_status_codes, http_res.status_code):
result, err = await run_sync_in_thread(
hooks.after_error, AfterErrorContext(hook_ctx), http_res, None
)
if err is not None:
logger.debug("Request Exception", exc_info=True)
raise err
if result is not None:
http_res = result
else:
logger.debug("Raising unexpected SDK error")
raise errors.AutumnDefaultError(
"Unexpected error occurred", http_res
)
return http_res
if retry_config is not None:
@@ -384,7 +371,20 @@ class BaseSDK:
else:
http_res = await do()
if not utils.match_status_codes(error_status_codes, http_res.status_code):
if is_error_status_code(http_res.status_code):
result, err = await run_sync_in_thread(
hooks.after_error, AfterErrorContext(hook_ctx), http_res, None
)
if err is not None:
logger.debug("Request Exception", exc_info=True)
raise err
if result is not None:
http_res = result
else:
logger.debug("Raising unexpected SDK error")
raise errors.AutumnDefaultError("Unexpected error occurred", http_res)
else:
http_res = await run_sync_in_thread(
hooks.after_success, AfterSuccessContext(hook_ctx), http_res
)

View File

@@ -40,6 +40,7 @@ class Billing(BaseSDK):
success_url: Optional[str] = None,
new_billing_subscription: Optional[bool] = None,
plan_schedule: Optional[models.AttachPlanSchedule] = None,
starts_at: Optional[int] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
custom_line_items: Optional[
Union[
@@ -82,6 +83,7 @@ class Billing(BaseSDK):
:param success_url: URL to redirect to after successful checkout.
:param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.
:param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
:param starts_at: Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param custom_line_items: Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).
:param processor_subscription_id: The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.
@@ -128,6 +130,7 @@ class Billing(BaseSDK):
success_url=success_url,
new_billing_subscription=new_billing_subscription,
plan_schedule=plan_schedule,
starts_at=starts_at,
checkout_session_params=checkout_session_params,
custom_line_items=utils.get_pydantic_model(
custom_line_items, Optional[List[models.AttachCustomLineItem]]
@@ -184,7 +187,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -234,6 +237,7 @@ class Billing(BaseSDK):
success_url: Optional[str] = None,
new_billing_subscription: Optional[bool] = None,
plan_schedule: Optional[models.AttachPlanSchedule] = None,
starts_at: Optional[int] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
custom_line_items: Optional[
Union[
@@ -276,6 +280,7 @@ class Billing(BaseSDK):
:param success_url: URL to redirect to after successful checkout.
:param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.
:param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
:param starts_at: Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param custom_line_items: Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).
:param processor_subscription_id: The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.
@@ -322,6 +327,7 @@ class Billing(BaseSDK):
success_url=success_url,
new_billing_subscription=new_billing_subscription,
plan_schedule=plan_schedule,
starts_at=starts_at,
checkout_session_params=checkout_session_params,
custom_line_items=utils.get_pydantic_model(
custom_line_items, Optional[List[models.AttachCustomLineItem]]
@@ -378,7 +384,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -397,6 +403,252 @@ class Billing(BaseSDK):
raise errors.AutumnDefaultError("Unexpected response received", http_res)
def create_schedule(
self,
*,
customer_id: str,
phases: Union[List[models.Phase], List[models.PhaseTypedDict]],
entity_id: Optional[str] = None,
invoice_mode: Optional[
Union[
models.CreateScheduleInvoiceMode,
models.CreateScheduleInvoiceModeTypedDict,
]
] = None,
success_url: Optional[str] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
redirect_mode: Optional[models.CreateScheduleRedirectMode] = "if_required",
billing_behavior: Optional[models.BillingBehavior] = None,
enable_plan_immediately: Optional[bool] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> models.CreateScheduleResponse:
r"""Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
:param customer_id: The ID of the customer to create the schedule for.
:param phases: Ordered phase definitions for the schedule.
:param entity_id: Optional entity ID for an entity-scoped schedule.
:param invoice_mode: Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase.
:param success_url: URL to redirect to after successful checkout.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param redirect_mode: Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects.
:param billing_behavior: Whether to prorate the immediate phase. 'none' skips proration charges and credits.
:param enable_plan_immediately: If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = models.CreateScheduleParams(
customer_id=customer_id,
entity_id=entity_id,
invoice_mode=utils.get_pydantic_model(
invoice_mode, Optional[models.CreateScheduleInvoiceMode]
),
success_url=success_url,
checkout_session_params=checkout_session_params,
redirect_mode=redirect_mode,
billing_behavior=billing_behavior,
enable_plan_immediately=enable_plan_immediately,
phases=utils.get_pydantic_model(phases, List[models.Phase]),
)
req = self._build_request(
method="POST",
path="/v1/billing.create_schedule",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=True,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=models.CreateScheduleGlobals(
x_api_version=self.sdk_configuration.globals.x_api_version,
),
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
request, False, False, "json", models.CreateScheduleParams
),
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createSchedule",
oauth2_scopes=None,
security_source=self.sdk_configuration.security,
),
request=req,
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(models.CreateScheduleResponse, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.AutumnDefaultError("Unexpected response received", http_res)
async def create_schedule_async(
self,
*,
customer_id: str,
phases: Union[List[models.Phase], List[models.PhaseTypedDict]],
entity_id: Optional[str] = None,
invoice_mode: Optional[
Union[
models.CreateScheduleInvoiceMode,
models.CreateScheduleInvoiceModeTypedDict,
]
] = None,
success_url: Optional[str] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
redirect_mode: Optional[models.CreateScheduleRedirectMode] = "if_required",
billing_behavior: Optional[models.BillingBehavior] = None,
enable_plan_immediately: Optional[bool] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> models.CreateScheduleResponse:
r"""Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
:param customer_id: The ID of the customer to create the schedule for.
:param phases: Ordered phase definitions for the schedule.
:param entity_id: Optional entity ID for an entity-scoped schedule.
:param invoice_mode: Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase.
:param success_url: URL to redirect to after successful checkout.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param redirect_mode: Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects.
:param billing_behavior: Whether to prorate the immediate phase. 'none' skips proration charges and credits.
:param enable_plan_immediately: If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = models.CreateScheduleParams(
customer_id=customer_id,
entity_id=entity_id,
invoice_mode=utils.get_pydantic_model(
invoice_mode, Optional[models.CreateScheduleInvoiceMode]
),
success_url=success_url,
checkout_session_params=checkout_session_params,
redirect_mode=redirect_mode,
billing_behavior=billing_behavior,
enable_plan_immediately=enable_plan_immediately,
phases=utils.get_pydantic_model(phases, List[models.Phase]),
)
req = self._build_request_async(
method="POST",
path="/v1/billing.create_schedule",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=True,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=models.CreateScheduleGlobals(
x_api_version=self.sdk_configuration.globals.x_api_version,
),
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
request, False, False, "json", models.CreateScheduleParams
),
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createSchedule",
oauth2_scopes=None,
security_source=self.sdk_configuration.security,
),
request=req,
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(models.CreateScheduleResponse, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.AutumnDefaultError("Unexpected response received", http_res)
def multi_attach(
self,
*,
@@ -534,7 +786,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -690,7 +942,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -743,6 +995,7 @@ class Billing(BaseSDK):
success_url: Optional[str] = None,
new_billing_subscription: Optional[bool] = None,
plan_schedule: Optional[models.PreviewAttachPlanSchedule] = None,
starts_at: Optional[int] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
custom_line_items: Optional[
Union[
@@ -789,6 +1042,7 @@ class Billing(BaseSDK):
:param success_url: URL to redirect to after successful checkout.
:param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.
:param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
:param starts_at: Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param custom_line_items: Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).
:param processor_subscription_id: The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.
@@ -836,6 +1090,7 @@ class Billing(BaseSDK):
success_url=success_url,
new_billing_subscription=new_billing_subscription,
plan_schedule=plan_schedule,
starts_at=starts_at,
checkout_session_params=checkout_session_params,
custom_line_items=utils.get_pydantic_model(
custom_line_items, Optional[List[models.PreviewAttachCustomLineItem]]
@@ -892,7 +1147,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -945,6 +1200,7 @@ class Billing(BaseSDK):
success_url: Optional[str] = None,
new_billing_subscription: Optional[bool] = None,
plan_schedule: Optional[models.PreviewAttachPlanSchedule] = None,
starts_at: Optional[int] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
custom_line_items: Optional[
Union[
@@ -991,6 +1247,7 @@ class Billing(BaseSDK):
:param success_url: URL to redirect to after successful checkout.
:param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.
:param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
:param starts_at: Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param custom_line_items: Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).
:param processor_subscription_id: The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.
@@ -1038,6 +1295,7 @@ class Billing(BaseSDK):
success_url=success_url,
new_billing_subscription=new_billing_subscription,
plan_schedule=plan_schedule,
starts_at=starts_at,
checkout_session_params=checkout_session_params,
custom_line_items=utils.get_pydantic_model(
custom_line_items, Optional[List[models.PreviewAttachCustomLineItem]]
@@ -1094,7 +1352,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1257,7 +1515,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1420,7 +1678,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1583,7 +1841,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1746,7 +2004,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1910,7 +2168,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -2074,7 +2332,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -2170,7 +2428,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -2266,7 +2524,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -2310,6 +2568,7 @@ class Billing(BaseSDK):
]
] = None,
success_url: Optional[str] = None,
starts_at: Optional[int] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
custom_line_items: Optional[
Union[
@@ -2350,6 +2609,7 @@ class Billing(BaseSDK):
:param subscription_id: A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan.
:param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.
:param success_url: URL to redirect to after successful checkout.
:param starts_at: Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param custom_line_items: Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).
:param processor_subscription_id: The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.
@@ -2390,6 +2650,7 @@ class Billing(BaseSDK):
discounts, Optional[List[models.SetupPaymentAttachDiscount]]
),
success_url=success_url,
starts_at=starts_at,
checkout_session_params=checkout_session_params,
custom_line_items=utils.get_pydantic_model(
custom_line_items, Optional[List[models.SetupPaymentCustomLineItem]]
@@ -2446,7 +2707,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -2490,6 +2751,7 @@ class Billing(BaseSDK):
]
] = None,
success_url: Optional[str] = None,
starts_at: Optional[int] = None,
checkout_session_params: Optional[Dict[str, Any]] = None,
custom_line_items: Optional[
Union[
@@ -2530,6 +2792,7 @@ class Billing(BaseSDK):
:param subscription_id: A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan.
:param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.
:param success_url: URL to redirect to after successful checkout.
:param starts_at: Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
:param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session.
:param custom_line_items: Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).
:param processor_subscription_id: The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.
@@ -2570,6 +2833,7 @@ class Billing(BaseSDK):
discounts, Optional[List[models.SetupPaymentAttachDiscount]]
),
success_url=success_url,
starts_at=starts_at,
checkout_session_params=checkout_session_params,
custom_line_items=utils.get_pydantic_model(
custom_line_items, Optional[List[models.SetupPaymentCustomLineItem]]
@@ -2626,7 +2890,7 @@ class Billing(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -33,7 +33,7 @@ class Customers(BaseSDK):
models.GetOrCreateCustomerConfigTypedDict,
]
] = None,
expand: Optional[List[str]] = None,
expand: Optional[List[models.CustomerExpand]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -129,7 +129,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -172,7 +172,7 @@ class Customers(BaseSDK):
models.GetOrCreateCustomerConfigTypedDict,
]
] = None,
expand: Optional[List[str]] = None,
expand: Optional[List[models.CustomerExpand]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -268,7 +268,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -287,6 +287,196 @@ class Customers(BaseSDK):
raise errors.AutumnDefaultError("Unexpected response received", http_res)
def get(
self,
*,
customer_id: str,
expand: Optional[List[models.CustomerExpand]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> models.GetCustomerResponse:
r"""Fetches a customer by ID, optionally expanding related data such as invoices or entities.
Use this when you know the customer exists or assert they exist without creating them.
:param customer_id: ID of the customer to fetch
:param expand: Expand related customer data like invoices or entities, or expand nested objects like balances.feature, flags.feature, subscriptions.plan, and purchases.plan.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = models.GetCustomerParams(
customer_id=customer_id,
expand=expand,
)
req = self._build_request(
method="POST",
path="/v1/customers.get",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=True,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=models.GetCustomerGlobals(
x_api_version=self.sdk_configuration.globals.x_api_version,
),
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
request, False, False, "json", models.GetCustomerParams
),
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getCustomer",
oauth2_scopes=None,
security_source=self.sdk_configuration.security,
),
request=req,
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(models.GetCustomerResponse, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.AutumnDefaultError("Unexpected response received", http_res)
async def get_async(
self,
*,
customer_id: str,
expand: Optional[List[models.CustomerExpand]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> models.GetCustomerResponse:
r"""Fetches a customer by ID, optionally expanding related data such as invoices or entities.
Use this when you know the customer exists or assert they exist without creating them.
:param customer_id: ID of the customer to fetch
:param expand: Expand related customer data like invoices or entities, or expand nested objects like balances.feature, flags.feature, subscriptions.plan, and purchases.plan.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = models.GetCustomerParams(
customer_id=customer_id,
expand=expand,
)
req = self._build_request_async(
method="POST",
path="/v1/customers.get",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=True,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=models.GetCustomerGlobals(
x_api_version=self.sdk_configuration.globals.x_api_version,
),
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
request, False, False, "json", models.GetCustomerParams
),
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getCustomer",
oauth2_scopes=None,
security_source=self.sdk_configuration.security,
),
request=req,
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(models.GetCustomerResponse, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.AutumnDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.AutumnDefaultError("Unexpected response received", http_res)
def list(
self,
*,
@@ -360,7 +550,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -452,7 +642,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -583,7 +773,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -714,7 +904,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -807,7 +997,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -900,7 +1090,7 @@ class Customers(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -108,7 +108,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -226,7 +226,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -321,7 +321,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -416,7 +416,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -521,7 +521,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -626,7 +626,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -721,7 +721,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -816,7 +816,7 @@ class Entities(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -101,7 +101,7 @@ class Events(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -212,7 +212,7 @@ class Events(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -335,7 +335,7 @@ class Events(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -458,7 +458,7 @@ class Events(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -114,7 +114,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -238,7 +238,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -330,7 +330,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -422,7 +422,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -513,7 +513,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -604,7 +604,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -734,7 +734,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -864,7 +864,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -956,7 +956,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1048,7 +1048,7 @@ class Features(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -406,6 +406,58 @@ if TYPE_CHECKING:
CreateReferralCodeResponse,
CreateReferralCodeResponseTypedDict,
)
from .createscheduleop import (
BillingBehavior,
CreateScheduleBasePrice2,
CreateScheduleBasePrice2TypedDict,
CreateScheduleBillingMethod2,
CreateScheduleCode,
CreateScheduleCustomize2,
CreateScheduleCustomize2TypedDict,
CreateScheduleExpiryDurationType2,
CreateScheduleFeatureQuantity2,
CreateScheduleFeatureQuantity2TypedDict,
CreateScheduleGlobals,
CreateScheduleGlobalsTypedDict,
CreateScheduleInvoice,
CreateScheduleInvoiceMode,
CreateScheduleInvoiceModeTypedDict,
CreateScheduleInvoiceTypedDict,
CreateScheduleItemPriceInterval2,
CreateScheduleOnDecrease2,
CreateScheduleOnIncrease2,
CreateScheduleParams,
CreateScheduleParamsTypedDict,
CreateSchedulePlan2,
CreateSchedulePlan2TypedDict,
CreateSchedulePlanItem2,
CreateSchedulePlanItem2TypedDict,
CreateSchedulePrice2,
CreateSchedulePrice2TypedDict,
CreateSchedulePriceInterval2,
CreateScheduleProration2,
CreateScheduleProration2TypedDict,
CreateScheduleRedirectMode,
CreateScheduleRequiredAction,
CreateScheduleRequiredActionTypedDict,
CreateScheduleReset2,
CreateScheduleReset2TypedDict,
CreateScheduleResetInterval2,
CreateScheduleResponse,
CreateScheduleResponseTypedDict,
CreateScheduleRollover2,
CreateScheduleRollover2TypedDict,
CreateScheduleStatus,
CreateScheduleTier2,
CreateScheduleTier2TypedDict,
CreateScheduleTierBehavior2,
Phase,
PhaseRequest2,
PhaseRequest2TypedDict,
PhaseResponse,
PhaseResponseTypedDict,
PhaseTypedDict,
)
from .customer import (
Customer,
CustomerAutoTopup,
@@ -419,6 +471,7 @@ if TYPE_CHECKING:
CustomerDisplay,
CustomerDisplayTypedDict,
CustomerDurationType,
CustomerEntityEnv,
CustomerEnv,
CustomerFeature,
CustomerFeatureTypedDict,
@@ -433,6 +486,7 @@ if TYPE_CHECKING:
CustomerPurchaseLimit2TypedDict,
CustomerPurchaseLimitUnion,
CustomerPurchaseLimitUnionTypedDict,
CustomerRewardsType,
CustomerSpendLimit,
CustomerSpendLimitTypedDict,
CustomerStatus,
@@ -443,7 +497,6 @@ if TYPE_CHECKING:
Discount,
DiscountTypedDict,
Entity,
EntityEnv,
EntityTypedDict,
Flags,
FlagsTypedDict,
@@ -456,7 +509,6 @@ if TYPE_CHECKING:
ReferralCustomerTypedDict,
ReferralTypedDict,
Rewards,
RewardsType,
RewardsTypedDict,
Subscription,
SubscriptionTypedDict,
@@ -483,6 +535,7 @@ if TYPE_CHECKING:
CustomerDataUsageAlert,
CustomerDataUsageAlertTypedDict,
)
from .customerexpand import CustomerExpand
from .deletebalanceop import (
DeleteBalanceGlobals,
DeleteBalanceGlobalsTypedDict,
@@ -537,6 +590,67 @@ if TYPE_CHECKING:
FinalizeLockResponseBody2TypedDict,
FinalizeLockResponseTypedDict,
)
from .getcustomerop import (
GetCustomerAutoTopup,
GetCustomerAutoTopupTypedDict,
GetCustomerBillingControls,
GetCustomerBillingControlsTypedDict,
GetCustomerConfig,
GetCustomerConfigTypedDict,
GetCustomerCreditSchema,
GetCustomerCreditSchemaTypedDict,
GetCustomerCustomer,
GetCustomerCustomerTypedDict,
GetCustomerDiscount,
GetCustomerDiscountTypedDict,
GetCustomerDisplay,
GetCustomerDisplayTypedDict,
GetCustomerDurationType,
GetCustomerEntity,
GetCustomerEntityEnv,
GetCustomerEntityTypedDict,
GetCustomerEnv,
GetCustomerFeature,
GetCustomerFeatureTypedDict,
GetCustomerFlags,
GetCustomerFlagsType,
GetCustomerFlagsTypedDict,
GetCustomerGlobals,
GetCustomerGlobalsTypedDict,
GetCustomerInterval1,
GetCustomerInterval2,
GetCustomerInvoice,
GetCustomerInvoiceTypedDict,
GetCustomerOverageAllowed,
GetCustomerOverageAllowedTypedDict,
GetCustomerParams,
GetCustomerParamsTypedDict,
GetCustomerPurchase,
GetCustomerPurchaseLimit1,
GetCustomerPurchaseLimit1TypedDict,
GetCustomerPurchaseLimit2,
GetCustomerPurchaseLimit2TypedDict,
GetCustomerPurchaseLimitUnion,
GetCustomerPurchaseLimitUnionTypedDict,
GetCustomerPurchaseTypedDict,
GetCustomerReferral,
GetCustomerReferralTypedDict,
GetCustomerResponse,
GetCustomerResponseTypedDict,
GetCustomerRewards,
GetCustomerRewardsType,
GetCustomerRewardsTypedDict,
GetCustomerSpendLimit,
GetCustomerSpendLimitTypedDict,
GetCustomerStatus,
GetCustomerSubscription,
GetCustomerSubscriptionTypedDict,
GetCustomerThresholdType,
GetCustomerTrialsUsed,
GetCustomerTrialsUsedTypedDict,
GetCustomerUsageAlert,
GetCustomerUsageAlertTypedDict,
)
from .getentityop import (
GetEntityBillingControls,
GetEntityBillingControlsTypedDict,
@@ -917,6 +1031,8 @@ if TYPE_CHECKING:
PreviewAttachIncomingFeatureQuantity,
PreviewAttachIncomingFeatureQuantityTypedDict,
PreviewAttachIncomingTypedDict,
PreviewAttachInvoiceCredits,
PreviewAttachInvoiceCreditsTypedDict,
PreviewAttachInvoiceMode,
PreviewAttachInvoiceModeTypedDict,
PreviewAttachItemPriceInterval,
@@ -995,6 +1111,8 @@ if TYPE_CHECKING:
PreviewMultiAttachIncomingFeatureQuantity,
PreviewMultiAttachIncomingFeatureQuantityTypedDict,
PreviewMultiAttachIncomingTypedDict,
PreviewMultiAttachInvoiceCredits,
PreviewMultiAttachInvoiceCreditsTypedDict,
PreviewMultiAttachInvoiceMode,
PreviewMultiAttachInvoiceModeTypedDict,
PreviewMultiAttachItemPriceInterval,
@@ -1081,6 +1199,8 @@ if TYPE_CHECKING:
PreviewUpdateIncomingFeatureQuantity,
PreviewUpdateIncomingFeatureQuantityTypedDict,
PreviewUpdateIncomingTypedDict,
PreviewUpdateInvoiceCredits,
PreviewUpdateInvoiceCreditsTypedDict,
PreviewUpdateInvoiceMode,
PreviewUpdateInvoiceModeTypedDict,
PreviewUpdateItemPriceInterval,
@@ -1122,6 +1242,9 @@ if TYPE_CHECKING:
PreviewUpdateResponseTypedDict,
PreviewUpdateRollover,
PreviewUpdateRolloverTypedDict,
PreviewUpdateStatus,
PreviewUpdateTax,
PreviewUpdateTaxTypedDict,
PreviewUpdateTier,
PreviewUpdateTierBehavior,
PreviewUpdateTierTypedDict,
@@ -1495,6 +1618,7 @@ __all__ = [
"BalanceTierBehavior",
"BalanceType",
"BalanceTypedDict",
"BillingBehavior",
"BillingUpdateAttachDiscount",
"BillingUpdateAttachDiscountTypedDict",
"BillingUpdateBasePrice",
@@ -1740,6 +1864,49 @@ __all__ = [
"CreateReferralCodeParamsTypedDict",
"CreateReferralCodeResponse",
"CreateReferralCodeResponseTypedDict",
"CreateScheduleBasePrice2",
"CreateScheduleBasePrice2TypedDict",
"CreateScheduleBillingMethod2",
"CreateScheduleCode",
"CreateScheduleCustomize2",
"CreateScheduleCustomize2TypedDict",
"CreateScheduleExpiryDurationType2",
"CreateScheduleFeatureQuantity2",
"CreateScheduleFeatureQuantity2TypedDict",
"CreateScheduleGlobals",
"CreateScheduleGlobalsTypedDict",
"CreateScheduleInvoice",
"CreateScheduleInvoiceMode",
"CreateScheduleInvoiceModeTypedDict",
"CreateScheduleInvoiceTypedDict",
"CreateScheduleItemPriceInterval2",
"CreateScheduleOnDecrease2",
"CreateScheduleOnIncrease2",
"CreateScheduleParams",
"CreateScheduleParamsTypedDict",
"CreateSchedulePlan2",
"CreateSchedulePlan2TypedDict",
"CreateSchedulePlanItem2",
"CreateSchedulePlanItem2TypedDict",
"CreateSchedulePrice2",
"CreateSchedulePrice2TypedDict",
"CreateSchedulePriceInterval2",
"CreateScheduleProration2",
"CreateScheduleProration2TypedDict",
"CreateScheduleRedirectMode",
"CreateScheduleRequiredAction",
"CreateScheduleRequiredActionTypedDict",
"CreateScheduleReset2",
"CreateScheduleReset2TypedDict",
"CreateScheduleResetInterval2",
"CreateScheduleResponse",
"CreateScheduleResponseTypedDict",
"CreateScheduleRollover2",
"CreateScheduleRollover2TypedDict",
"CreateScheduleStatus",
"CreateScheduleTier2",
"CreateScheduleTier2TypedDict",
"CreateScheduleTierBehavior2",
"Customer",
"CustomerAutoTopup",
"CustomerAutoTopupTypedDict",
@@ -1772,7 +1939,9 @@ __all__ = [
"CustomerDurationType",
"CustomerEligibility",
"CustomerEligibilityTypedDict",
"CustomerEntityEnv",
"CustomerEnv",
"CustomerExpand",
"CustomerFeature",
"CustomerFeatureTypedDict",
"CustomerFlagsType",
@@ -1786,6 +1955,7 @@ __all__ = [
"CustomerPurchaseLimit2TypedDict",
"CustomerPurchaseLimitUnion",
"CustomerPurchaseLimitUnionTypedDict",
"CustomerRewardsType",
"CustomerSpendLimit",
"CustomerSpendLimitTypedDict",
"CustomerStatus",
@@ -1827,7 +1997,6 @@ __all__ = [
"Discount",
"DiscountTypedDict",
"Entity",
"EntityEnv",
"EntityTypedDict",
"EventsAggregateParams",
"EventsAggregateParamsTypedDict",
@@ -1864,6 +2033,65 @@ __all__ = [
"FreeTrialRequest",
"FreeTrialRequestTypedDict",
"FreeTrialTypedDict",
"GetCustomerAutoTopup",
"GetCustomerAutoTopupTypedDict",
"GetCustomerBillingControls",
"GetCustomerBillingControlsTypedDict",
"GetCustomerConfig",
"GetCustomerConfigTypedDict",
"GetCustomerCreditSchema",
"GetCustomerCreditSchemaTypedDict",
"GetCustomerCustomer",
"GetCustomerCustomerTypedDict",
"GetCustomerDiscount",
"GetCustomerDiscountTypedDict",
"GetCustomerDisplay",
"GetCustomerDisplayTypedDict",
"GetCustomerDurationType",
"GetCustomerEntity",
"GetCustomerEntityEnv",
"GetCustomerEntityTypedDict",
"GetCustomerEnv",
"GetCustomerFeature",
"GetCustomerFeatureTypedDict",
"GetCustomerFlags",
"GetCustomerFlagsType",
"GetCustomerFlagsTypedDict",
"GetCustomerGlobals",
"GetCustomerGlobalsTypedDict",
"GetCustomerInterval1",
"GetCustomerInterval2",
"GetCustomerInvoice",
"GetCustomerInvoiceTypedDict",
"GetCustomerOverageAllowed",
"GetCustomerOverageAllowedTypedDict",
"GetCustomerParams",
"GetCustomerParamsTypedDict",
"GetCustomerPurchase",
"GetCustomerPurchaseLimit1",
"GetCustomerPurchaseLimit1TypedDict",
"GetCustomerPurchaseLimit2",
"GetCustomerPurchaseLimit2TypedDict",
"GetCustomerPurchaseLimitUnion",
"GetCustomerPurchaseLimitUnionTypedDict",
"GetCustomerPurchaseTypedDict",
"GetCustomerReferral",
"GetCustomerReferralTypedDict",
"GetCustomerResponse",
"GetCustomerResponseTypedDict",
"GetCustomerRewards",
"GetCustomerRewardsType",
"GetCustomerRewardsTypedDict",
"GetCustomerSpendLimit",
"GetCustomerSpendLimitTypedDict",
"GetCustomerStatus",
"GetCustomerSubscription",
"GetCustomerSubscriptionTypedDict",
"GetCustomerThresholdType",
"GetCustomerTrialsUsed",
"GetCustomerTrialsUsedTypedDict",
"GetCustomerUsageAlert",
"GetCustomerUsageAlertTypedDict",
"GetEntityBillingControls",
"GetEntityBillingControlsTypedDict",
"GetEntityCreditSchema",
@@ -2161,6 +2389,12 @@ __all__ = [
"OpenCustomerPortalParamsTypedDict",
"OpenCustomerPortalResponse",
"OpenCustomerPortalResponseTypedDict",
"Phase",
"PhaseRequest2",
"PhaseRequest2TypedDict",
"PhaseResponse",
"PhaseResponseTypedDict",
"PhaseTypedDict",
"Plan",
"PlanBillingMethod",
"PlanConfig",
@@ -2224,6 +2458,8 @@ __all__ = [
"PreviewAttachIncomingFeatureQuantity",
"PreviewAttachIncomingFeatureQuantityTypedDict",
"PreviewAttachIncomingTypedDict",
"PreviewAttachInvoiceCredits",
"PreviewAttachInvoiceCreditsTypedDict",
"PreviewAttachInvoiceMode",
"PreviewAttachInvoiceModeTypedDict",
"PreviewAttachItemPriceInterval",
@@ -2300,6 +2536,8 @@ __all__ = [
"PreviewMultiAttachIncomingFeatureQuantity",
"PreviewMultiAttachIncomingFeatureQuantityTypedDict",
"PreviewMultiAttachIncomingTypedDict",
"PreviewMultiAttachInvoiceCredits",
"PreviewMultiAttachInvoiceCreditsTypedDict",
"PreviewMultiAttachInvoiceMode",
"PreviewMultiAttachInvoiceModeTypedDict",
"PreviewMultiAttachItemPriceInterval",
@@ -2383,6 +2621,8 @@ __all__ = [
"PreviewUpdateIncomingFeatureQuantity",
"PreviewUpdateIncomingFeatureQuantityTypedDict",
"PreviewUpdateIncomingTypedDict",
"PreviewUpdateInvoiceCredits",
"PreviewUpdateInvoiceCreditsTypedDict",
"PreviewUpdateInvoiceMode",
"PreviewUpdateInvoiceModeTypedDict",
"PreviewUpdateItemPriceInterval",
@@ -2424,6 +2664,9 @@ __all__ = [
"PreviewUpdateResponseTypedDict",
"PreviewUpdateRollover",
"PreviewUpdateRolloverTypedDict",
"PreviewUpdateStatus",
"PreviewUpdateTax",
"PreviewUpdateTaxTypedDict",
"PreviewUpdateTier",
"PreviewUpdateTierBehavior",
"PreviewUpdateTierTypedDict",
@@ -2464,7 +2707,6 @@ __all__ = [
"ReferralCustomerTypedDict",
"ReferralTypedDict",
"Rewards",
"RewardsType",
"RewardsTypedDict",
"Scenario1",
"Scenario2",
@@ -3117,6 +3359,56 @@ _dynamic_imports: dict[str, str] = {
"CreateReferralCodeParamsTypedDict": ".createreferralcodeop",
"CreateReferralCodeResponse": ".createreferralcodeop",
"CreateReferralCodeResponseTypedDict": ".createreferralcodeop",
"BillingBehavior": ".createscheduleop",
"CreateScheduleBasePrice2": ".createscheduleop",
"CreateScheduleBasePrice2TypedDict": ".createscheduleop",
"CreateScheduleBillingMethod2": ".createscheduleop",
"CreateScheduleCode": ".createscheduleop",
"CreateScheduleCustomize2": ".createscheduleop",
"CreateScheduleCustomize2TypedDict": ".createscheduleop",
"CreateScheduleExpiryDurationType2": ".createscheduleop",
"CreateScheduleFeatureQuantity2": ".createscheduleop",
"CreateScheduleFeatureQuantity2TypedDict": ".createscheduleop",
"CreateScheduleGlobals": ".createscheduleop",
"CreateScheduleGlobalsTypedDict": ".createscheduleop",
"CreateScheduleInvoice": ".createscheduleop",
"CreateScheduleInvoiceMode": ".createscheduleop",
"CreateScheduleInvoiceModeTypedDict": ".createscheduleop",
"CreateScheduleInvoiceTypedDict": ".createscheduleop",
"CreateScheduleItemPriceInterval2": ".createscheduleop",
"CreateScheduleOnDecrease2": ".createscheduleop",
"CreateScheduleOnIncrease2": ".createscheduleop",
"CreateScheduleParams": ".createscheduleop",
"CreateScheduleParamsTypedDict": ".createscheduleop",
"CreateSchedulePlan2": ".createscheduleop",
"CreateSchedulePlan2TypedDict": ".createscheduleop",
"CreateSchedulePlanItem2": ".createscheduleop",
"CreateSchedulePlanItem2TypedDict": ".createscheduleop",
"CreateSchedulePrice2": ".createscheduleop",
"CreateSchedulePrice2TypedDict": ".createscheduleop",
"CreateSchedulePriceInterval2": ".createscheduleop",
"CreateScheduleProration2": ".createscheduleop",
"CreateScheduleProration2TypedDict": ".createscheduleop",
"CreateScheduleRedirectMode": ".createscheduleop",
"CreateScheduleRequiredAction": ".createscheduleop",
"CreateScheduleRequiredActionTypedDict": ".createscheduleop",
"CreateScheduleReset2": ".createscheduleop",
"CreateScheduleReset2TypedDict": ".createscheduleop",
"CreateScheduleResetInterval2": ".createscheduleop",
"CreateScheduleResponse": ".createscheduleop",
"CreateScheduleResponseTypedDict": ".createscheduleop",
"CreateScheduleRollover2": ".createscheduleop",
"CreateScheduleRollover2TypedDict": ".createscheduleop",
"CreateScheduleStatus": ".createscheduleop",
"CreateScheduleTier2": ".createscheduleop",
"CreateScheduleTier2TypedDict": ".createscheduleop",
"CreateScheduleTierBehavior2": ".createscheduleop",
"Phase": ".createscheduleop",
"PhaseRequest2": ".createscheduleop",
"PhaseRequest2TypedDict": ".createscheduleop",
"PhaseResponse": ".createscheduleop",
"PhaseResponseTypedDict": ".createscheduleop",
"PhaseTypedDict": ".createscheduleop",
"Customer": ".customer",
"CustomerAutoTopup": ".customer",
"CustomerAutoTopupTypedDict": ".customer",
@@ -3129,6 +3421,7 @@ _dynamic_imports: dict[str, str] = {
"CustomerDisplay": ".customer",
"CustomerDisplayTypedDict": ".customer",
"CustomerDurationType": ".customer",
"CustomerEntityEnv": ".customer",
"CustomerEnv": ".customer",
"CustomerFeature": ".customer",
"CustomerFeatureTypedDict": ".customer",
@@ -3143,6 +3436,7 @@ _dynamic_imports: dict[str, str] = {
"CustomerPurchaseLimit2TypedDict": ".customer",
"CustomerPurchaseLimitUnion": ".customer",
"CustomerPurchaseLimitUnionTypedDict": ".customer",
"CustomerRewardsType": ".customer",
"CustomerSpendLimit": ".customer",
"CustomerSpendLimitTypedDict": ".customer",
"CustomerStatus": ".customer",
@@ -3153,7 +3447,6 @@ _dynamic_imports: dict[str, str] = {
"Discount": ".customer",
"DiscountTypedDict": ".customer",
"Entity": ".customer",
"EntityEnv": ".customer",
"EntityTypedDict": ".customer",
"Flags": ".customer",
"FlagsTypedDict": ".customer",
@@ -3166,7 +3459,6 @@ _dynamic_imports: dict[str, str] = {
"ReferralCustomerTypedDict": ".customer",
"ReferralTypedDict": ".customer",
"Rewards": ".customer",
"RewardsType": ".customer",
"RewardsTypedDict": ".customer",
"Subscription": ".customer",
"SubscriptionTypedDict": ".customer",
@@ -3190,6 +3482,7 @@ _dynamic_imports: dict[str, str] = {
"CustomerDataTypedDict": ".customerdata",
"CustomerDataUsageAlert": ".customerdata",
"CustomerDataUsageAlertTypedDict": ".customerdata",
"CustomerExpand": ".customerexpand",
"DeleteBalanceGlobals": ".deletebalanceop",
"DeleteBalanceGlobalsTypedDict": ".deletebalanceop",
"DeleteBalanceInterval": ".deletebalanceop",
@@ -3232,6 +3525,65 @@ _dynamic_imports: dict[str, str] = {
"FinalizeLockResponseBody2": ".finalizelockop",
"FinalizeLockResponseBody2TypedDict": ".finalizelockop",
"FinalizeLockResponseTypedDict": ".finalizelockop",
"GetCustomerAutoTopup": ".getcustomerop",
"GetCustomerAutoTopupTypedDict": ".getcustomerop",
"GetCustomerBillingControls": ".getcustomerop",
"GetCustomerBillingControlsTypedDict": ".getcustomerop",
"GetCustomerConfig": ".getcustomerop",
"GetCustomerConfigTypedDict": ".getcustomerop",
"GetCustomerCreditSchema": ".getcustomerop",
"GetCustomerCreditSchemaTypedDict": ".getcustomerop",
"GetCustomerCustomer": ".getcustomerop",
"GetCustomerCustomerTypedDict": ".getcustomerop",
"GetCustomerDiscount": ".getcustomerop",
"GetCustomerDiscountTypedDict": ".getcustomerop",
"GetCustomerDisplay": ".getcustomerop",
"GetCustomerDisplayTypedDict": ".getcustomerop",
"GetCustomerDurationType": ".getcustomerop",
"GetCustomerEntity": ".getcustomerop",
"GetCustomerEntityEnv": ".getcustomerop",
"GetCustomerEntityTypedDict": ".getcustomerop",
"GetCustomerEnv": ".getcustomerop",
"GetCustomerFeature": ".getcustomerop",
"GetCustomerFeatureTypedDict": ".getcustomerop",
"GetCustomerFlags": ".getcustomerop",
"GetCustomerFlagsType": ".getcustomerop",
"GetCustomerFlagsTypedDict": ".getcustomerop",
"GetCustomerGlobals": ".getcustomerop",
"GetCustomerGlobalsTypedDict": ".getcustomerop",
"GetCustomerInterval1": ".getcustomerop",
"GetCustomerInterval2": ".getcustomerop",
"GetCustomerInvoice": ".getcustomerop",
"GetCustomerInvoiceTypedDict": ".getcustomerop",
"GetCustomerOverageAllowed": ".getcustomerop",
"GetCustomerOverageAllowedTypedDict": ".getcustomerop",
"GetCustomerParams": ".getcustomerop",
"GetCustomerParamsTypedDict": ".getcustomerop",
"GetCustomerPurchase": ".getcustomerop",
"GetCustomerPurchaseLimit1": ".getcustomerop",
"GetCustomerPurchaseLimit1TypedDict": ".getcustomerop",
"GetCustomerPurchaseLimit2": ".getcustomerop",
"GetCustomerPurchaseLimit2TypedDict": ".getcustomerop",
"GetCustomerPurchaseLimitUnion": ".getcustomerop",
"GetCustomerPurchaseLimitUnionTypedDict": ".getcustomerop",
"GetCustomerPurchaseTypedDict": ".getcustomerop",
"GetCustomerReferral": ".getcustomerop",
"GetCustomerReferralTypedDict": ".getcustomerop",
"GetCustomerResponse": ".getcustomerop",
"GetCustomerResponseTypedDict": ".getcustomerop",
"GetCustomerRewards": ".getcustomerop",
"GetCustomerRewardsType": ".getcustomerop",
"GetCustomerRewardsTypedDict": ".getcustomerop",
"GetCustomerSpendLimit": ".getcustomerop",
"GetCustomerSpendLimitTypedDict": ".getcustomerop",
"GetCustomerStatus": ".getcustomerop",
"GetCustomerSubscription": ".getcustomerop",
"GetCustomerSubscriptionTypedDict": ".getcustomerop",
"GetCustomerThresholdType": ".getcustomerop",
"GetCustomerTrialsUsed": ".getcustomerop",
"GetCustomerTrialsUsedTypedDict": ".getcustomerop",
"GetCustomerUsageAlert": ".getcustomerop",
"GetCustomerUsageAlertTypedDict": ".getcustomerop",
"GetEntityBillingControls": ".getentityop",
"GetEntityBillingControlsTypedDict": ".getentityop",
"GetEntityCreditSchema": ".getentityop",
@@ -3589,6 +3941,8 @@ _dynamic_imports: dict[str, str] = {
"PreviewAttachIncomingFeatureQuantity": ".previewattachop",
"PreviewAttachIncomingFeatureQuantityTypedDict": ".previewattachop",
"PreviewAttachIncomingTypedDict": ".previewattachop",
"PreviewAttachInvoiceCredits": ".previewattachop",
"PreviewAttachInvoiceCreditsTypedDict": ".previewattachop",
"PreviewAttachInvoiceMode": ".previewattachop",
"PreviewAttachInvoiceModeTypedDict": ".previewattachop",
"PreviewAttachItemPriceInterval": ".previewattachop",
@@ -3665,6 +4019,8 @@ _dynamic_imports: dict[str, str] = {
"PreviewMultiAttachIncomingFeatureQuantity": ".previewmultiattachop",
"PreviewMultiAttachIncomingFeatureQuantityTypedDict": ".previewmultiattachop",
"PreviewMultiAttachIncomingTypedDict": ".previewmultiattachop",
"PreviewMultiAttachInvoiceCredits": ".previewmultiattachop",
"PreviewMultiAttachInvoiceCreditsTypedDict": ".previewmultiattachop",
"PreviewMultiAttachInvoiceMode": ".previewmultiattachop",
"PreviewMultiAttachInvoiceModeTypedDict": ".previewmultiattachop",
"PreviewMultiAttachItemPriceInterval": ".previewmultiattachop",
@@ -3749,6 +4105,8 @@ _dynamic_imports: dict[str, str] = {
"PreviewUpdateIncomingFeatureQuantity": ".previewupdateop",
"PreviewUpdateIncomingFeatureQuantityTypedDict": ".previewupdateop",
"PreviewUpdateIncomingTypedDict": ".previewupdateop",
"PreviewUpdateInvoiceCredits": ".previewupdateop",
"PreviewUpdateInvoiceCreditsTypedDict": ".previewupdateop",
"PreviewUpdateInvoiceMode": ".previewupdateop",
"PreviewUpdateInvoiceModeTypedDict": ".previewupdateop",
"PreviewUpdateItemPriceInterval": ".previewupdateop",
@@ -3790,6 +4148,9 @@ _dynamic_imports: dict[str, str] = {
"PreviewUpdateResponseTypedDict": ".previewupdateop",
"PreviewUpdateRollover": ".previewupdateop",
"PreviewUpdateRolloverTypedDict": ".previewupdateop",
"PreviewUpdateStatus": ".previewupdateop",
"PreviewUpdateTax": ".previewupdateop",
"PreviewUpdateTaxTypedDict": ".previewupdateop",
"PreviewUpdateTier": ".previewupdateop",
"PreviewUpdateTierBehavior": ".previewupdateop",
"PreviewUpdateTierTypedDict": ".previewupdateop",

View File

@@ -779,6 +779,8 @@ class AttachParamsTypedDict(TypedDict):
r"""Reset the billing cycle anchor immediately with 'now'."""
plan_schedule: NotRequired[AttachPlanSchedule]
r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled."""
starts_at: NotRequired[int]
r"""Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription."""
checkout_session_params: NotRequired[Dict[str, Any]]
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
custom_line_items: NotRequired[List[AttachCustomLineItemTypedDict]]
@@ -846,6 +848,9 @@ class AttachParams(BaseModel):
plan_schedule: Optional[AttachPlanSchedule] = None
r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled."""
starts_at: Optional[int] = None
r"""Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription."""
checkout_session_params: Optional[Dict[str, Any]] = None
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
@@ -887,6 +892,7 @@ class AttachParams(BaseModel):
"new_billing_subscription",
"billing_cycle_anchor",
"plan_schedule",
"starts_at",
"checkout_session_params",
"custom_line_items",
"processor_subscription_id",

View File

@@ -0,0 +1,898 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from autumn_sdk.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from autumn_sdk.utils import FieldMetadata, HeaderMetadata, validate_const
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class CreateScheduleGlobalsTypedDict(TypedDict):
x_api_version: NotRequired[str]
class CreateScheduleGlobals(BaseModel):
x_api_version: Annotated[
Optional[str],
pydantic.Field(alias="x-api-version"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = "2.2.0"
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["x-api-version"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class CreateScheduleInvoiceModeTypedDict(TypedDict):
r"""Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase."""
enabled: bool
r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method."""
enable_plan_immediately: NotRequired[bool]
r"""If true, enables the plan immediately even though the invoice is not paid yet."""
finalize: NotRequired[bool]
r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review."""
class CreateScheduleInvoiceMode(BaseModel):
r"""Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase."""
enabled: bool
r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method."""
enable_plan_immediately: Optional[bool] = False
r"""If true, enables the plan immediately even though the invoice is not paid yet."""
finalize: Optional[bool] = True
r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["enable_plan_immediately", "finalize"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
CreateScheduleRedirectMode = Literal[
"always",
"if_required",
"never",
]
r"""Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects."""
BillingBehavior = Literal[
"prorate_immediately",
"none",
]
r"""Whether to prorate the immediate phase. 'none' skips proration charges and credits."""
class CreateScheduleFeatureQuantity2TypedDict(TypedDict):
r"""Quantity configuration for a prepaid feature."""
feature_id: str
r"""The ID of the feature to set quantity for."""
quantity: NotRequired[float]
r"""The quantity of the feature."""
adjustable: NotRequired[bool]
r"""Whether the customer can adjust the quantity."""
class CreateScheduleFeatureQuantity2(BaseModel):
r"""Quantity configuration for a prepaid feature."""
feature_id: str
r"""The ID of the feature to set quantity for."""
quantity: Optional[float] = None
r"""The quantity of the feature."""
adjustable: Optional[bool] = None
r"""Whether the customer can adjust the quantity."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["quantity", "adjustable"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
CreateSchedulePriceInterval2 = Literal[
"one_off",
"week",
"month",
"quarter",
"semi_annual",
"year",
]
r"""Billing interval (e.g. 'month', 'year')."""
class CreateScheduleBasePrice2TypedDict(TypedDict):
r"""Base price configuration for a plan."""
amount: float
r"""Base price amount for the plan."""
interval: CreateSchedulePriceInterval2
r"""Billing interval (e.g. 'month', 'year')."""
interval_count: NotRequired[float]
r"""Number of intervals per billing cycle. Defaults to 1."""
class CreateScheduleBasePrice2(BaseModel):
r"""Base price configuration for a plan."""
amount: float
r"""Base price amount for the plan."""
interval: CreateSchedulePriceInterval2
r"""Billing interval (e.g. 'month', 'year')."""
interval_count: Optional[float] = None
r"""Number of intervals per billing cycle. Defaults to 1."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["interval_count"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
CreateScheduleResetInterval2 = Literal[
"one_off",
"minute",
"hour",
"day",
"week",
"month",
"quarter",
"semi_annual",
"year",
]
r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only."""
class CreateScheduleReset2TypedDict(TypedDict):
r"""Reset configuration for consumable features. Omit for non-consumable features like seats."""
interval: CreateScheduleResetInterval2
r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only."""
interval_count: NotRequired[float]
r"""Number of intervals between resets. Defaults to 1."""
class CreateScheduleReset2(BaseModel):
r"""Reset configuration for consumable features. Omit for non-consumable features like seats."""
interval: CreateScheduleResetInterval2
r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only."""
interval_count: Optional[float] = None
r"""Number of intervals between resets. Defaults to 1."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["interval_count"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class CreateScheduleTier2TypedDict(TypedDict):
to: NotRequired[Any]
amount: NotRequired[Any]
flat_amount: NotRequired[Any]
class CreateScheduleTier2(BaseModel):
to: Optional[Any] = None
amount: Optional[Any] = None
flat_amount: Optional[Any] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["to", "amount", "flat_amount"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
CreateScheduleTierBehavior2 = Literal[
"graduated",
"volume",
]
CreateScheduleItemPriceInterval2 = Literal[
"one_off",
"week",
"month",
"quarter",
"semi_annual",
"year",
]
r"""Billing interval. For consumable features, should match reset.interval."""
CreateScheduleBillingMethod2 = Literal[
"prepaid",
"usage_based",
]
r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go."""
class CreateSchedulePrice2TypedDict(TypedDict):
r"""Pricing for usage beyond included units. Omit for free features."""
interval: CreateScheduleItemPriceInterval2
r"""Billing interval. For consumable features, should match reset.interval."""
billing_method: CreateScheduleBillingMethod2
r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go."""
amount: NotRequired[float]
r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required."""
tiers: NotRequired[List[CreateScheduleTier2TypedDict]]
r"""Tiered pricing. Either 'amount' or 'tiers' is required."""
tier_behavior: NotRequired[CreateScheduleTierBehavior2]
interval_count: NotRequired[float]
r"""Number of intervals per billing cycle. Defaults to 1."""
billing_units: NotRequired[float]
r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200)."""
max_purchase: NotRequired[float]
r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total."""
class CreateSchedulePrice2(BaseModel):
r"""Pricing for usage beyond included units. Omit for free features."""
interval: CreateScheduleItemPriceInterval2
r"""Billing interval. For consumable features, should match reset.interval."""
billing_method: CreateScheduleBillingMethod2
r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go."""
amount: Optional[float] = None
r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required."""
tiers: Optional[List[CreateScheduleTier2]] = None
r"""Tiered pricing. Either 'amount' or 'tiers' is required."""
tier_behavior: Optional[CreateScheduleTierBehavior2] = None
interval_count: Optional[float] = 1
r"""Number of intervals per billing cycle. Defaults to 1."""
billing_units: Optional[float] = 1
r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200)."""
max_purchase: Optional[float] = None
r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
[
"amount",
"tiers",
"tier_behavior",
"interval_count",
"billing_units",
"max_purchase",
]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
CreateScheduleOnIncrease2 = Literal[
"bill_immediately",
"prorate_immediately",
"prorate_next_cycle",
"bill_next_cycle",
]
r"""Billing behavior when quantity increases mid-cycle."""
CreateScheduleOnDecrease2 = Literal[
"prorate",
"prorate_immediately",
"prorate_next_cycle",
"none",
"no_prorations",
]
r"""Credit behavior when quantity decreases mid-cycle."""
class CreateScheduleProration2TypedDict(TypedDict):
r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing."""
on_increase: CreateScheduleOnIncrease2
r"""Billing behavior when quantity increases mid-cycle."""
on_decrease: CreateScheduleOnDecrease2
r"""Credit behavior when quantity decreases mid-cycle."""
class CreateScheduleProration2(BaseModel):
r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing."""
on_increase: CreateScheduleOnIncrease2
r"""Billing behavior when quantity increases mid-cycle."""
on_decrease: CreateScheduleOnDecrease2
r"""Credit behavior when quantity decreases mid-cycle."""
CreateScheduleExpiryDurationType2 = Literal[
"month",
"forever",
]
r"""When rolled over units expire."""
class CreateScheduleRollover2TypedDict(TypedDict):
r"""Rollover config for unused units. If set, unused included units carry over."""
expiry_duration_type: CreateScheduleExpiryDurationType2
r"""When rolled over units expire."""
max: NotRequired[float]
r"""Max rollover units. Omit for unlimited rollover."""
max_percentage: NotRequired[float]
r"""Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max."""
expiry_duration_length: NotRequired[float]
r"""Number of periods before expiry."""
class CreateScheduleRollover2(BaseModel):
r"""Rollover config for unused units. If set, unused included units carry over."""
expiry_duration_type: CreateScheduleExpiryDurationType2
r"""When rolled over units expire."""
max: Optional[float] = None
r"""Max rollover units. Omit for unlimited rollover."""
max_percentage: Optional[float] = None
r"""Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max."""
expiry_duration_length: Optional[float] = None
r"""Number of periods before expiry."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["max", "max_percentage", "expiry_duration_length"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class CreateSchedulePlanItem2TypedDict(TypedDict):
r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings."""
feature_id: str
r"""The ID of the feature to configure."""
included: NotRequired[float]
r"""Number of free units included. Balance resets to this each interval for consumable features."""
unlimited: NotRequired[bool]
r"""If true, customer has unlimited access to this feature."""
reset: NotRequired[CreateScheduleReset2TypedDict]
r"""Reset configuration for consumable features. Omit for non-consumable features like seats."""
price: NotRequired[CreateSchedulePrice2TypedDict]
r"""Pricing for usage beyond included units. Omit for free features."""
proration: NotRequired[CreateScheduleProration2TypedDict]
r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing."""
rollover: NotRequired[CreateScheduleRollover2TypedDict]
r"""Rollover config for unused units. If set, unused included units carry over."""
class CreateSchedulePlanItem2(BaseModel):
r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings."""
feature_id: str
r"""The ID of the feature to configure."""
included: Optional[float] = None
r"""Number of free units included. Balance resets to this each interval for consumable features."""
unlimited: Optional[bool] = None
r"""If true, customer has unlimited access to this feature."""
reset: Optional[CreateScheduleReset2] = None
r"""Reset configuration for consumable features. Omit for non-consumable features like seats."""
price: Optional[CreateSchedulePrice2] = None
r"""Pricing for usage beyond included units. Omit for free features."""
proration: Optional[CreateScheduleProration2] = None
r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing."""
rollover: Optional[CreateScheduleRollover2] = None
r"""Rollover config for unused units. If set, unused included units carry over."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
["included", "unlimited", "reset", "price", "proration", "rollover"]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class CreateScheduleCustomize2TypedDict(TypedDict):
r"""Customize the plan to schedule. Can override the price, items, or both."""
price: NotRequired[Nullable[CreateScheduleBasePrice2TypedDict]]
r"""Override the base price of the plan. Pass null to remove the base price."""
items: NotRequired[List[CreateSchedulePlanItem2TypedDict]]
r"""Override the items in the plan."""
class CreateScheduleCustomize2(BaseModel):
r"""Customize the plan to schedule. Can override the price, items, or both."""
price: OptionalNullable[CreateScheduleBasePrice2] = UNSET
r"""Override the base price of the plan. Pass null to remove the base price."""
items: Optional[List[CreateSchedulePlanItem2]] = None
r"""Override the items in the plan."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["price", "items"])
nullable_fields = set(["price"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
is_nullable_and_explicitly_set = (
k in nullable_fields
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
)
if val != UNSET_SENTINEL:
if (
val is not None
or k not in optional_fields
or is_nullable_and_explicitly_set
):
m[k] = val
return m
class CreateSchedulePlan2TypedDict(TypedDict):
plan_id: str
r"""The ID of the plan to schedule in this phase."""
feature_quantities: NotRequired[List[CreateScheduleFeatureQuantity2TypedDict]]
r"""Optional prepaid feature quantities for this phase's plan."""
version: NotRequired[float]
r"""Optional explicit plan version to schedule."""
customize: NotRequired[CreateScheduleCustomize2TypedDict]
r"""Customize the plan to schedule. Can override the price, items, or both."""
subscription_id: NotRequired[str]
r"""Unsupported for create_schedule today. Requests that include this field will be rejected."""
class CreateSchedulePlan2(BaseModel):
plan_id: str
r"""The ID of the plan to schedule in this phase."""
feature_quantities: Optional[List[CreateScheduleFeatureQuantity2]] = None
r"""Optional prepaid feature quantities for this phase's plan."""
version: Optional[float] = None
r"""Optional explicit plan version to schedule."""
customize: Optional[CreateScheduleCustomize2] = None
r"""Customize the plan to schedule. Can override the price, items, or both."""
subscription_id: Optional[str] = None
r"""Unsupported for create_schedule today. Requests that include this field will be rejected."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
["feature_quantities", "version", "customize", "subscription_id"]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class PhaseRequest2TypedDict(TypedDict):
starts_at: float
r"""When this phase should start, in epoch milliseconds."""
plans: List[CreateSchedulePlan2TypedDict]
r"""Plans to materialize for this phase."""
class PhaseRequest2(BaseModel):
starts_at: float
r"""When this phase should start, in epoch milliseconds."""
plans: List[CreateSchedulePlan2]
r"""Plans to materialize for this phase."""
PhaseTypedDict = PhaseRequest2TypedDict
Phase = PhaseRequest2
class CreateScheduleParamsTypedDict(TypedDict):
customer_id: str
r"""The ID of the customer to create the schedule for."""
phases: List[PhaseTypedDict]
r"""Ordered phase definitions for the schedule."""
entity_id: NotRequired[str]
r"""Optional entity ID for an entity-scoped schedule."""
invoice_mode: NotRequired[CreateScheduleInvoiceModeTypedDict]
r"""Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase."""
success_url: NotRequired[str]
r"""URL to redirect to after successful checkout."""
checkout_session_params: NotRequired[Dict[str, Any]]
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
redirect_mode: NotRequired[CreateScheduleRedirectMode]
r"""Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects."""
billing_behavior: NotRequired[BillingBehavior]
r"""Whether to prorate the immediate phase. 'none' skips proration charges and credits."""
billing_cycle_anchor: Literal["now"]
r"""Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time."""
enable_plan_immediately: NotRequired[bool]
r"""If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed."""
class CreateScheduleParams(BaseModel):
customer_id: str
r"""The ID of the customer to create the schedule for."""
phases: List[Phase]
r"""Ordered phase definitions for the schedule."""
entity_id: Optional[str] = None
r"""Optional entity ID for an entity-scoped schedule."""
invoice_mode: Optional[CreateScheduleInvoiceMode] = None
r"""Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase."""
success_url: Optional[str] = None
r"""URL to redirect to after successful checkout."""
checkout_session_params: Optional[Dict[str, Any]] = None
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
redirect_mode: Optional[CreateScheduleRedirectMode] = "if_required"
r"""Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects."""
billing_behavior: Optional[BillingBehavior] = None
r"""Whether to prorate the immediate phase. 'none' skips proration charges and credits."""
billing_cycle_anchor: Annotated[
Annotated[Optional[Literal["now"]], AfterValidator(validate_const("now"))],
pydantic.Field(alias="billing_cycle_anchor"),
] = "now"
r"""Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time."""
enable_plan_immediately: Optional[bool] = None
r"""If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
[
"entity_id",
"invoice_mode",
"success_url",
"checkout_session_params",
"redirect_mode",
"billing_behavior",
"billing_cycle_anchor",
"enable_plan_immediately",
]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
CreateScheduleStatus = Union[
Literal[
"created",
"pending_payment",
],
UnrecognizedStr,
]
r"""Whether the schedule is fully created or waiting for payment or confirmation to complete."""
class PhaseResponseTypedDict(TypedDict):
phase_id: str
r"""The ID of the persisted phase row."""
starts_at: float
r"""When this phase starts, in epoch milliseconds."""
customer_product_ids: List[str]
r"""Customer products materialized for this phase."""
class PhaseResponse(BaseModel):
phase_id: str
r"""The ID of the persisted phase row."""
starts_at: float
r"""When this phase starts, in epoch milliseconds."""
customer_product_ids: List[str]
r"""Customer products materialized for this phase."""
class CreateScheduleInvoiceTypedDict(TypedDict):
r"""Invoice details if an invoice was created. Only present when a charge was made."""
status: Nullable[str]
r"""The status of the invoice (e.g., 'paid', 'open', 'draft')."""
stripe_id: str
r"""The Stripe invoice ID."""
total: float
r"""The total amount of the invoice in cents."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
hosted_invoice_url: Nullable[str]
r"""URL to the hosted invoice page where the customer can view and pay the invoice."""
class CreateScheduleInvoice(BaseModel):
r"""Invoice details if an invoice was created. Only present when a charge was made."""
status: Nullable[str]
r"""The status of the invoice (e.g., 'paid', 'open', 'draft')."""
stripe_id: str
r"""The Stripe invoice ID."""
total: float
r"""The total amount of the invoice in cents."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
hosted_invoice_url: Nullable[str]
r"""URL to the hosted invoice page where the customer can view and pay the invoice."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
m[k] = val
return m
CreateScheduleCode = Union[
Literal[
"3ds_required",
"payment_method_required",
"payment_failed",
],
UnrecognizedStr,
]
r"""The type of action required to complete the payment."""
class CreateScheduleRequiredActionTypedDict(TypedDict):
code: CreateScheduleCode
r"""The type of action required to complete the payment."""
reason: str
r"""A human-readable explanation of why this action is required."""
class CreateScheduleRequiredAction(BaseModel):
code: CreateScheduleCode
r"""The type of action required to complete the payment."""
reason: str
r"""A human-readable explanation of why this action is required."""
class CreateScheduleResponseTypedDict(TypedDict):
r"""OK"""
customer_id: str
r"""The ID of the customer."""
entity_id: Nullable[str]
r"""The entity ID for the schedule, or null when customer-level."""
status: CreateScheduleStatus
r"""Whether the schedule is fully created or waiting for payment or confirmation to complete."""
schedule_id: Nullable[str]
r"""The ID of the created schedule. Null when the schedule is waiting on Autumn checkout confirmation."""
phases: List[PhaseResponseTypedDict]
r"""Persisted phases in ascending starts_at order. Empty when waiting on Autumn checkout confirmation."""
payment_url: Nullable[str]
r"""URL to redirect the customer to complete payment. Null if no payment action is required."""
invoice: NotRequired[CreateScheduleInvoiceTypedDict]
r"""Invoice details if an invoice was created. Only present when a charge was made."""
required_action: NotRequired[CreateScheduleRequiredActionTypedDict]
class CreateScheduleResponse(BaseModel):
r"""OK"""
customer_id: str
r"""The ID of the customer."""
entity_id: Nullable[str]
r"""The entity ID for the schedule, or null when customer-level."""
status: CreateScheduleStatus
r"""Whether the schedule is fully created or waiting for payment or confirmation to complete."""
schedule_id: Nullable[str]
r"""The ID of the created schedule. Null when the schedule is waiting on Autumn checkout confirmation."""
phases: List[PhaseResponse]
r"""Persisted phases in ascending starts_at order. Empty when waiting on Autumn checkout confirmation."""
payment_url: Nullable[str]
r"""URL to redirect the customer to complete payment. Null if no payment action is required."""
invoice: Optional[CreateScheduleInvoice] = None
r"""Invoice details if an invoice was created. Only present when a charge was made."""
required_action: Optional[CreateScheduleRequiredAction] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["invoice", "required_action"])
nullable_fields = set(["entity_id", "schedule_id", "payment_url"])
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
is_nullable_and_explicitly_set = (
k in nullable_fields
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
)
if val != UNSET_SENTINEL:
if (
val is not None
or k not in optional_fields
or is_nullable_and_explicitly_set
):
m[k] = val
return m
try:
CreateScheduleParams.model_rebuild()
except NameError:
pass

View File

@@ -819,7 +819,7 @@ class Invoice(BaseModel):
return m
EntityEnv = Union[
CustomerEntityEnv = Union[
Literal[
"sandbox",
"live",
@@ -836,7 +836,7 @@ class EntityTypedDict(TypedDict):
r"""The name of the entity"""
created_at: float
r"""Unix timestamp when the entity was created"""
env: EntityEnv
env: CustomerEntityEnv
r"""The environment (sandbox/live)"""
customer_id: NotRequired[Nullable[str]]
r"""The customer ID this entity belongs to"""
@@ -854,7 +854,7 @@ class Entity(BaseModel):
created_at: float
r"""Unix timestamp when the entity was created"""
env: EntityEnv
env: CustomerEntityEnv
r"""The environment (sandbox/live)"""
customer_id: OptionalNullable[str] = UNSET
@@ -928,7 +928,7 @@ class TrialsUsed(BaseModel):
return m
RewardsType = Union[
CustomerRewardsType = Union[
Literal[
"percentage_discount",
"fixed_discount",
@@ -956,7 +956,7 @@ class DiscountTypedDict(TypedDict):
r"""The unique identifier for this discount"""
name: str
r"""The name of the discount or coupon"""
type: RewardsType
type: CustomerRewardsType
r"""The type of reward"""
discount_value: float
r"""The discount value (percentage or fixed amount)"""
@@ -983,7 +983,7 @@ class Discount(BaseModel):
name: str
r"""The name of the discount or coupon"""
type: RewardsType
type: CustomerRewardsType
r"""The type of reward"""
discount_value: float

View File

@@ -0,0 +1,19 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from typing import Literal
CustomerExpand = Literal[
"invoices",
"trials_used",
"rewards",
"entities",
"referrals",
"payment_method",
"subscriptions.plan",
"purchases.plan",
"balances.feature",
"flags.feature",
"billing_controls.auto_topups.purchase_limit",
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .customerexpand import CustomerExpand
from autumn_sdk.types import (
BaseModel,
Nullable,
@@ -364,7 +365,7 @@ class GetOrCreateCustomerParamsTypedDict(TypedDict):
r"""Billing controls for the customer (auto top-ups, etc.)"""
config: NotRequired[GetOrCreateCustomerConfigTypedDict]
r"""Miscellaneous configurations for the customer."""
expand: NotRequired[List[str]]
expand: NotRequired[List[CustomerExpand]]
r"""Fields to expand in the returned customer response, such as subscriptions.plan, purchases.plan, balances.feature, or flags.feature."""
@@ -401,7 +402,7 @@ class GetOrCreateCustomerParams(BaseModel):
config: Optional[GetOrCreateCustomerConfig] = None
r"""Miscellaneous configurations for the customer."""
expand: Optional[List[str]] = None
expand: Optional[List[CustomerExpand]] = None
r"""Fields to expand in the returned customer response, such as subscriptions.plan, purchases.plan, balances.feature, or flags.feature."""
@model_serializer(mode="wrap")

View File

@@ -780,6 +780,8 @@ class PreviewAttachParamsTypedDict(TypedDict):
r"""Reset the billing cycle anchor immediately with 'now'."""
plan_schedule: NotRequired[PreviewAttachPlanSchedule]
r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled."""
starts_at: NotRequired[int]
r"""Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription."""
checkout_session_params: NotRequired[Dict[str, Any]]
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
custom_line_items: NotRequired[List[PreviewAttachCustomLineItemTypedDict]]
@@ -847,6 +849,9 @@ class PreviewAttachParams(BaseModel):
plan_schedule: Optional[PreviewAttachPlanSchedule] = None
r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled."""
starts_at: Optional[int] = None
r"""Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription."""
checkout_session_params: Optional[Dict[str, Any]] = None
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
@@ -888,6 +893,7 @@ class PreviewAttachParams(BaseModel):
"new_billing_subscription",
"billing_cycle_anchor",
"plan_schedule",
"starts_at",
"checkout_session_params",
"custom_line_items",
"processor_subscription_id",
@@ -970,9 +976,9 @@ class PreviewAttachLineItemTypedDict(TypedDict):
description: str
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
feature_id: Nullable[str]
@@ -993,10 +999,10 @@ class PreviewAttachLineItem(BaseModel):
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
@@ -1097,9 +1103,9 @@ class PreviewAttachNextCycleLineItemTypedDict(TypedDict):
description: str
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
feature_id: Nullable[str]
@@ -1120,10 +1126,10 @@ class PreviewAttachNextCycleLineItem(BaseModel):
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
@@ -1241,9 +1247,9 @@ class PreviewAttachNextCycleTypedDict(TypedDict):
starts_at: float
r"""Unix timestamp (milliseconds) when the next billing cycle starts."""
subtotal: float
r"""The total amount in cents before discounts for the next cycle."""
r"""The total amount in cents before discounts and tax for the next cycle."""
total: float
r"""The final amount in cents after discounts for the next cycle."""
r"""The final amount in cents after discounts and tax for the next cycle."""
line_items: List[PreviewAttachNextCycleLineItemTypedDict]
r"""List of line items for the next billing cycle."""
usage_line_items: List[PreviewAttachUsageLineItemTypedDict]
@@ -1257,10 +1263,10 @@ class PreviewAttachNextCycle(BaseModel):
r"""Unix timestamp (milliseconds) when the next billing cycle starts."""
subtotal: float
r"""The total amount in cents before discounts for the next cycle."""
r"""The total amount in cents before discounts and tax for the next cycle."""
total: float
r"""The final amount in cents after discounts for the next cycle."""
r"""The final amount in cents after discounts and tax for the next cycle."""
line_items: List[PreviewAttachNextCycleLineItem]
r"""List of line items for the next billing cycle."""
@@ -1468,6 +1474,25 @@ class PreviewAttachTax(BaseModel):
r"""Calculation status ('complete' when Stripe Tax succeeds or 'incomplete' when Stripe Tax returned 0 or errored)."""
class PreviewAttachInvoiceCreditsTypedDict(TypedDict):
r"""Stripe customer invoice credits preview."""
balance: float
r"""Stripe customer credit balance available, expressed as a positive number in major currency units."""
currency: str
r"""Three-letter currency code."""
class PreviewAttachInvoiceCredits(BaseModel):
r"""Stripe customer invoice credits preview."""
balance: float
r"""Stripe customer credit balance available, expressed as a positive number in major currency units."""
currency: str
r"""Three-letter currency code."""
class PreviewAttachResponseTypedDict(TypedDict):
r"""OK"""
@@ -1475,9 +1500,9 @@ class PreviewAttachResponseTypedDict(TypedDict):
r"""The ID of the customer."""
line_items: List[PreviewAttachLineItemTypedDict]
subtotal: float
r"""The total amount in cents before discounts for the current billing period."""
r"""The total amount in cents before discounts and tax for the current billing period."""
total: float
r"""The final amount in cents after discounts for the current billing period."""
r"""The final amount in cents after discounts and tax for the current billing period."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
incoming: List[PreviewAttachIncomingTypedDict]
@@ -1494,6 +1519,8 @@ class PreviewAttachResponseTypedDict(TypedDict):
r"""Expand the response with additional data."""
tax: NotRequired[PreviewAttachTaxTypedDict]
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
invoice_credits: NotRequired[PreviewAttachInvoiceCreditsTypedDict]
r"""Stripe customer invoice credits preview."""
class PreviewAttachResponse(BaseModel):
@@ -1505,10 +1532,10 @@ class PreviewAttachResponse(BaseModel):
line_items: List[PreviewAttachLineItem]
subtotal: float
r"""The total amount in cents before discounts for the current billing period."""
r"""The total amount in cents before discounts and tax for the current billing period."""
total: float
r"""The final amount in cents after discounts for the current billing period."""
r"""The final amount in cents after discounts and tax for the current billing period."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
@@ -1534,9 +1561,12 @@ class PreviewAttachResponse(BaseModel):
tax: Optional[PreviewAttachTax] = None
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
invoice_credits: Optional[PreviewAttachInvoiceCredits] = None
r"""Stripe customer invoice credits preview."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["next_cycle", "expand", "tax"])
optional_fields = set(["next_cycle", "expand", "tax", "invoice_credits"])
nullable_fields = set(["checkout_type"])
serialized = handler(self)
m = {}

View File

@@ -1060,9 +1060,9 @@ class PreviewMultiAttachLineItemTypedDict(TypedDict):
description: str
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
feature_id: Nullable[str]
@@ -1083,10 +1083,10 @@ class PreviewMultiAttachLineItem(BaseModel):
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
@@ -1187,9 +1187,9 @@ class PreviewMultiAttachNextCycleLineItemTypedDict(TypedDict):
description: str
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
feature_id: Nullable[str]
@@ -1210,10 +1210,10 @@ class PreviewMultiAttachNextCycleLineItem(BaseModel):
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
@@ -1331,9 +1331,9 @@ class PreviewMultiAttachNextCycleTypedDict(TypedDict):
starts_at: float
r"""Unix timestamp (milliseconds) when the next billing cycle starts."""
subtotal: float
r"""The total amount in cents before discounts for the next cycle."""
r"""The total amount in cents before discounts and tax for the next cycle."""
total: float
r"""The final amount in cents after discounts for the next cycle."""
r"""The final amount in cents after discounts and tax for the next cycle."""
line_items: List[PreviewMultiAttachNextCycleLineItemTypedDict]
r"""List of line items for the next billing cycle."""
usage_line_items: List[PreviewMultiAttachUsageLineItemTypedDict]
@@ -1347,10 +1347,10 @@ class PreviewMultiAttachNextCycle(BaseModel):
r"""Unix timestamp (milliseconds) when the next billing cycle starts."""
subtotal: float
r"""The total amount in cents before discounts for the next cycle."""
r"""The total amount in cents before discounts and tax for the next cycle."""
total: float
r"""The final amount in cents after discounts for the next cycle."""
r"""The final amount in cents after discounts and tax for the next cycle."""
line_items: List[PreviewMultiAttachNextCycleLineItem]
r"""List of line items for the next billing cycle."""
@@ -1558,6 +1558,25 @@ class PreviewMultiAttachTax(BaseModel):
r"""Calculation status ('complete' when Stripe Tax succeeds or 'incomplete' when Stripe Tax returned 0 or errored)."""
class PreviewMultiAttachInvoiceCreditsTypedDict(TypedDict):
r"""Stripe customer invoice credits preview."""
balance: float
r"""Stripe customer credit balance available, expressed as a positive number in major currency units."""
currency: str
r"""Three-letter currency code."""
class PreviewMultiAttachInvoiceCredits(BaseModel):
r"""Stripe customer invoice credits preview."""
balance: float
r"""Stripe customer credit balance available, expressed as a positive number in major currency units."""
currency: str
r"""Three-letter currency code."""
class PreviewMultiAttachResponseTypedDict(TypedDict):
r"""OK"""
@@ -1565,9 +1584,9 @@ class PreviewMultiAttachResponseTypedDict(TypedDict):
r"""The ID of the customer."""
line_items: List[PreviewMultiAttachLineItemTypedDict]
subtotal: float
r"""The total amount in cents before discounts for the current billing period."""
r"""The total amount in cents before discounts and tax for the current billing period."""
total: float
r"""The final amount in cents after discounts for the current billing period."""
r"""The final amount in cents after discounts and tax for the current billing period."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
incoming: List[PreviewMultiAttachIncomingTypedDict]
@@ -1584,6 +1603,8 @@ class PreviewMultiAttachResponseTypedDict(TypedDict):
r"""Expand the response with additional data."""
tax: NotRequired[PreviewMultiAttachTaxTypedDict]
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
invoice_credits: NotRequired[PreviewMultiAttachInvoiceCreditsTypedDict]
r"""Stripe customer invoice credits preview."""
class PreviewMultiAttachResponse(BaseModel):
@@ -1595,10 +1616,10 @@ class PreviewMultiAttachResponse(BaseModel):
line_items: List[PreviewMultiAttachLineItem]
subtotal: float
r"""The total amount in cents before discounts for the current billing period."""
r"""The total amount in cents before discounts and tax for the current billing period."""
total: float
r"""The final amount in cents after discounts for the current billing period."""
r"""The final amount in cents after discounts and tax for the current billing period."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
@@ -1624,9 +1645,12 @@ class PreviewMultiAttachResponse(BaseModel):
tax: Optional[PreviewMultiAttachTax] = None
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
invoice_credits: Optional[PreviewMultiAttachInvoiceCredits] = None
r"""Stripe customer invoice credits preview."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["next_cycle", "expand", "tax"])
optional_fields = set(["next_cycle", "expand", "tax", "invoice_credits"])
nullable_fields = set(["checkout_type"])
serialized = handler(self)
m = {}

View File

@@ -853,9 +853,9 @@ class PreviewUpdateLineItemTypedDict(TypedDict):
description: str
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
feature_id: Nullable[str]
@@ -876,10 +876,10 @@ class PreviewUpdateLineItem(BaseModel):
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
@@ -980,9 +980,9 @@ class PreviewUpdateNextCycleLineItemTypedDict(TypedDict):
description: str
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
feature_id: Nullable[str]
@@ -1003,10 +1003,10 @@ class PreviewUpdateNextCycleLineItem(BaseModel):
r"""A detailed description of the line item."""
subtotal: float
r"""The amount in cents before discounts for this line item."""
r"""The amount in cents before discounts and tax for this line item."""
total: float
r"""The final amount in cents after discounts for this line item."""
r"""The final amount in cents after discounts and tax for this line item."""
plan_id: str
r"""The ID of the plan that this line item belongs to."""
@@ -1124,9 +1124,9 @@ class PreviewUpdateNextCycleTypedDict(TypedDict):
starts_at: float
r"""Unix timestamp (milliseconds) when the next billing cycle starts."""
subtotal: float
r"""The total amount in cents before discounts for the next cycle."""
r"""The total amount in cents before discounts and tax for the next cycle."""
total: float
r"""The final amount in cents after discounts for the next cycle."""
r"""The final amount in cents after discounts and tax for the next cycle."""
line_items: List[PreviewUpdateNextCycleLineItemTypedDict]
r"""List of line items for the next billing cycle."""
usage_line_items: List[PreviewUpdateUsageLineItemTypedDict]
@@ -1140,10 +1140,10 @@ class PreviewUpdateNextCycle(BaseModel):
r"""Unix timestamp (milliseconds) when the next billing cycle starts."""
subtotal: float
r"""The total amount in cents before discounts for the next cycle."""
r"""The total amount in cents before discounts and tax for the next cycle."""
total: float
r"""The final amount in cents after discounts for the next cycle."""
r"""The final amount in cents after discounts and tax for the next cycle."""
line_items: List[PreviewUpdateNextCycleLineItem]
r"""List of line items for the next billing cycle."""
@@ -1311,6 +1311,69 @@ Intent = Union[
]
PreviewUpdateStatus = Union[
Literal[
"complete",
"incomplete",
],
UnrecognizedStr,
]
r"""Calculation status ('complete' when Stripe Tax succeeds or 'incomplete' when Stripe Tax returned 0 or errored)."""
class PreviewUpdateTaxTypedDict(TypedDict):
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
total: float
r"""Total tax amount in major currency units."""
amount_inclusive: float
r"""Tax included in line item subtotals."""
amount_exclusive: float
r"""Tax added on top of subtotals."""
currency: str
r"""Three-letter currency code."""
status: PreviewUpdateStatus
r"""Calculation status ('complete' when Stripe Tax succeeds or 'incomplete' when Stripe Tax returned 0 or errored)."""
class PreviewUpdateTax(BaseModel):
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
total: float
r"""Total tax amount in major currency units."""
amount_inclusive: float
r"""Tax included in line item subtotals."""
amount_exclusive: float
r"""Tax added on top of subtotals."""
currency: str
r"""Three-letter currency code."""
status: PreviewUpdateStatus
r"""Calculation status ('complete' when Stripe Tax succeeds or 'incomplete' when Stripe Tax returned 0 or errored)."""
class PreviewUpdateInvoiceCreditsTypedDict(TypedDict):
r"""Stripe customer invoice credits preview."""
balance: float
r"""Stripe customer credit balance available, expressed as a positive number in major currency units."""
currency: str
r"""Three-letter currency code."""
class PreviewUpdateInvoiceCredits(BaseModel):
r"""Stripe customer invoice credits preview."""
balance: float
r"""Stripe customer credit balance available, expressed as a positive number in major currency units."""
currency: str
r"""Three-letter currency code."""
class PreviewUpdateResponseTypedDict(TypedDict):
r"""OK"""
@@ -1319,9 +1382,9 @@ class PreviewUpdateResponseTypedDict(TypedDict):
line_items: List[PreviewUpdateLineItemTypedDict]
r"""List of line items for the current billing period."""
subtotal: float
r"""The total amount in cents before discounts for the current billing period."""
r"""The total amount in cents before discounts and tax for the current billing period."""
total: float
r"""The final amount in cents after discounts for the current billing period."""
r"""The final amount in cents after discounts and tax for the current billing period."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
incoming: List[PreviewUpdateIncomingTypedDict]
@@ -1333,6 +1396,10 @@ class PreviewUpdateResponseTypedDict(TypedDict):
r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles."""
expand: NotRequired[List[str]]
r"""Expand the response with additional data."""
tax: NotRequired[PreviewUpdateTaxTypedDict]
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
invoice_credits: NotRequired[PreviewUpdateInvoiceCreditsTypedDict]
r"""Stripe customer invoice credits preview."""
class PreviewUpdateResponse(BaseModel):
@@ -1345,10 +1412,10 @@ class PreviewUpdateResponse(BaseModel):
r"""List of line items for the current billing period."""
subtotal: float
r"""The total amount in cents before discounts for the current billing period."""
r"""The total amount in cents before discounts and tax for the current billing period."""
total: float
r"""The final amount in cents after discounts for the current billing period."""
r"""The final amount in cents after discounts and tax for the current billing period."""
currency: str
r"""The three-letter ISO currency code (e.g., 'usd')."""
@@ -1367,9 +1434,15 @@ class PreviewUpdateResponse(BaseModel):
expand: Optional[List[str]] = None
r"""Expand the response with additional data."""
tax: Optional[PreviewUpdateTax] = None
r"""Tax preview for the immediate charge. Contact us to enable the tax flag on your organisation. Shows only with flag enabled, a Stripe customer exists and has a location."""
invoice_credits: Optional[PreviewUpdateInvoiceCredits] = None
r"""Stripe customer invoice credits preview."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["next_cycle", "expand"])
optional_fields = set(["next_cycle", "expand", "tax", "invoice_credits"])
serialized = handler(self)
m = {}

View File

@@ -715,6 +715,8 @@ class SetupPaymentParamsTypedDict(TypedDict):
r"""URL to redirect to after successful checkout."""
billing_cycle_anchor: Literal["now"]
r"""Reset the billing cycle anchor immediately with 'now'."""
starts_at: NotRequired[int]
r"""Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription."""
checkout_session_params: NotRequired[Dict[str, Any]]
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
custom_line_items: NotRequired[List[SetupPaymentCustomLineItemTypedDict]]
@@ -770,6 +772,9 @@ class SetupPaymentParams(BaseModel):
] = "now"
r"""Reset the billing cycle anchor immediately with 'now'."""
starts_at: Optional[int] = None
r"""Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription."""
checkout_session_params: Optional[Dict[str, Any]] = None
r"""Additional parameters to pass into the creation of the Stripe checkout session."""
@@ -808,6 +813,7 @@ class SetupPaymentParams(BaseModel):
"discounts",
"success_url",
"billing_cycle_anchor",
"starts_at",
"checkout_session_params",
"custom_line_items",
"processor_subscription_id",

View File

@@ -132,7 +132,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -274,7 +274,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -371,7 +371,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -468,7 +468,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -564,7 +564,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -660,7 +660,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -814,7 +814,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -968,7 +968,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1065,7 +1065,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -1162,7 +1162,7 @@ class Plans(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -83,7 +83,7 @@ class Referrals(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -176,7 +176,7 @@ class Referrals(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -269,7 +269,7 @@ class Referrals(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -362,7 +362,7 @@ class Referrals(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -302,7 +302,7 @@ class Autumn(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -417,7 +417,7 @@ class Autumn(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -529,7 +529,7 @@ class Autumn(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)
@@ -641,7 +641,7 @@ class Autumn(BaseSDK):
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["4XX", "5XX"],
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
retry_config=retry_config,
)

View File

@@ -15,6 +15,7 @@ class SecurityMetadata:
scheme_type: Optional[str] = None
sub_type: Optional[str] = None
field_name: Optional[str] = None
composite: bool = False
def get_field_name(self, default: str) -> str:
return self.field_name or default

View File

@@ -5,6 +5,7 @@ from typing import (
Any,
Dict,
List,
Optional,
Tuple,
)
from pydantic import BaseModel
@@ -16,7 +17,9 @@ from .metadata import (
)
def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
def get_security(
security: Any, allowed_fields: Optional[List[str]] = None
) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
headers: Dict[str, str] = {}
query_params: Dict[str, List[str]] = {}
@@ -27,7 +30,14 @@ def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
raise TypeError("security must be a pydantic model")
sec_fields: Dict[str, FieldInfo] = security.__class__.model_fields
for name in sec_fields:
sec_field_names = (
list(sec_fields.keys()) if allowed_fields is None else allowed_fields
)
for name in sec_field_names:
if name not in sec_fields:
continue
sec_field = sec_fields[name]
value = getattr(security, name)
@@ -49,6 +59,9 @@ def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
else:
_parse_security_scheme(headers, query_params, metadata, name, value)
if not metadata.composite:
return headers, query_params
return headers, query_params
@@ -59,15 +72,24 @@ def _parse_security_option(
raise TypeError("security option must be a pydantic model")
opt_fields: Dict[str, FieldInfo] = option.__class__.model_fields
for name in opt_fields:
opt_field = opt_fields[name]
metadata = find_field_metadata(opt_field, SecurityMetadata)
if metadata is None or not metadata.scheme:
continue
_parse_security_scheme(
headers, query_params, metadata, name, getattr(option, name)
)
value = getattr(option, name)
if (
metadata.scheme_type == "http"
and metadata.sub_type == "basic"
and not isinstance(value, BaseModel)
):
_parse_basic_auth_scheme(headers, option)
return
_parse_security_scheme(headers, query_params, metadata, name, value)
def _parse_security_scheme(

View File

@@ -17,8 +17,7 @@ from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset
def serialize_decimal(as_str: bool):
def serialize(d):
# Optional[T] is a Union[T, None]
if is_union(type(d)) and type(None) in get_args(type(d)) and d is None:
if d is None:
return None
if isinstance(d, Unset):
return d
@@ -46,8 +45,7 @@ def validate_decimal(d):
def serialize_float(as_str: bool):
def serialize(f):
# Optional[T] is a Union[T, None]
if is_union(type(f)) and type(None) in get_args(type(f)) and f is None:
if f is None:
return None
if isinstance(f, Unset):
return f
@@ -75,8 +73,7 @@ def validate_float(f):
def serialize_int(as_str: bool):
def serialize(i):
# Optional[T] is a Union[T, None]
if is_union(type(i)) and type(None) in get_args(type(i)) and i is None:
if i is None:
return None
if isinstance(i, Unset):
return i
@@ -104,8 +101,7 @@ def validate_int(b):
def validate_const(v):
def validate(c):
# Optional[T] is a Union[T, None]
if is_union(type(c)) and type(None) in get_args(type(c)) and c is None:
if c is None:
return None
if v != c:

View File

@@ -179,6 +179,7 @@ export const attachParamsOutboundSchema = z.object({
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
plan_schedule: z.union([z.string(), z.undefined()]).optional(),
starts_at: z.union([z.number(), z.undefined()]).optional(),
checkout_session_params: z
.union([z.record(z.string(), z.any()), z.undefined()])
.optional(),
@@ -308,6 +309,7 @@ export const attachParamsSchema = z.object({
newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(),
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
planSchedule: z.union([attachPlanScheduleSchema, z.undefined()]).optional(),
startsAt: z.union([z.number(), z.undefined()]).optional(),
checkoutSessionParams: z
.union([z.record(z.string(), z.any()), z.undefined()])
.optional(),

View File

@@ -108,6 +108,8 @@ export const getOrCreateCustomerParamsOutboundSchema = z.object({
const closedEnumSchema = z.any();
const customerExpandSchema = z.any();
export const getOrCreateCustomerIntervalSchema = closedEnumSchema;
export const getOrCreateCustomerPurchaseLimitSchema = z.object({
@@ -169,5 +171,5 @@ export const getOrCreateCustomerParamsSchema = z.object({
.union([getOrCreateCustomerBillingControlsSchema, z.undefined()])
.optional(),
config: z.union([getOrCreateCustomerConfigSchema, z.undefined()]).optional(),
expand: z.union([z.array(z.string()), z.undefined()]).optional(),
expand: z.union([z.array(customerExpandSchema), z.undefined()]).optional(),
});

View File

@@ -133,6 +133,11 @@ export const previewAttachOutgoingFeatureQuantitySchema = z.object({
quantity: z.number(),
});
export const previewAttachInvoiceCreditsSchema = z.object({
balance: z.number(),
currency: z.string(),
});
export const previewAttachFeatureQuantityRequestOutboundSchema = z.object({
feature_id: z.string(),
quantity: z.union([z.number(), z.undefined()]).optional(),
@@ -270,6 +275,7 @@ export const previewAttachParamsOutboundSchema = z.object({
new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(),
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
plan_schedule: z.union([z.string(), z.undefined()]).optional(),
starts_at: z.union([z.number(), z.undefined()]).optional(),
checkout_session_params: z
.union([z.record(z.string(), z.any()), z.undefined()])
.optional(),
@@ -416,6 +422,7 @@ export const previewAttachParamsSchema = z.object({
planSchedule: z
.union([previewAttachPlanScheduleSchema, z.undefined()])
.optional(),
startsAt: z.union([z.number(), z.undefined()]).optional(),
checkoutSessionParams: z
.union([z.record(z.string(), z.any()), z.undefined()])
.optional(),
@@ -479,4 +486,7 @@ export const previewAttachResponseSchema = z.object({
redirectToCheckout: z.boolean(),
checkoutType: previewAttachCheckoutTypeSchema.nullable(),
tax: z.union([previewAttachTaxSchema, z.undefined()]).optional(),
invoiceCredits: z
.union([previewAttachInvoiceCreditsSchema, z.undefined()])
.optional(),
});

View File

@@ -129,6 +129,11 @@ export const previewMultiAttachOutgoingFeatureQuantitySchema = z.object({
quantity: z.number(),
});
export const previewMultiAttachInvoiceCreditsSchema = z.object({
balance: z.number(),
currency: z.string(),
});
export const previewMultiAttachBasePriceOutboundSchema = z.object({
amount: z.number(),
interval: z.string(),
@@ -503,6 +508,9 @@ export const previewMultiAttachResponseSchema = z.object({
redirectToCheckout: z.boolean(),
checkoutType: previewMultiAttachCheckoutTypeSchema.nullable(),
tax: z.union([previewMultiAttachTaxSchema, z.undefined()]).optional(),
invoiceCredits: z
.union([previewMultiAttachInvoiceCreditsSchema, z.undefined()])
.optional(),
});
export const previewMultiAttachParamsOutboundSchema = z.object({

View File

@@ -122,6 +122,11 @@ export const previewUpdateOutgoingFeatureQuantitySchema = z.object({
quantity: z.number(),
});
export const previewUpdateInvoiceCreditsSchema = z.object({
balance: z.number(),
currency: z.string(),
});
export const previewUpdateFeatureQuantityRequestOutboundSchema = z.object({
feature_id: z.string(),
quantity: z.union([z.number(), z.undefined()]).optional(),
@@ -402,6 +407,16 @@ export const previewUpdateOutgoingSchema = z.object({
export const intentSchema = openEnumSchema;
export const previewUpdateStatusSchema = openEnumSchema;
export const previewUpdateTaxSchema = z.object({
total: z.number(),
amountInclusive: z.number(),
amountExclusive: z.number(),
currency: z.string(),
status: previewUpdateStatusSchema,
});
export const previewUpdateResponseSchema = z.object({
customerId: z.string(),
lineItems: z.array(previewUpdateLineItemSchema),
@@ -413,4 +428,8 @@ export const previewUpdateResponseSchema = z.object({
incoming: z.array(previewUpdateIncomingSchema),
outgoing: z.array(previewUpdateOutgoingSchema),
intent: intentSchema,
tax: z.union([previewUpdateTaxSchema, z.undefined()]).optional(),
invoiceCredits: z
.union([previewUpdateInvoiceCreditsSchema, z.undefined()])
.optional(),
});

View File

@@ -167,6 +167,7 @@ export const setupPaymentParamsOutboundSchema = z.object({
.optional(),
success_url: z.union([z.string(), z.undefined()]).optional(),
billing_cycle_anchor: z.union([z.literal("now"), z.undefined()]).optional(),
starts_at: z.union([z.number(), z.undefined()]).optional(),
checkout_session_params: z
.union([z.record(z.string(), z.any()), z.undefined()])
.optional(),
@@ -295,6 +296,7 @@ export const setupPaymentParamsSchema = z.object({
.optional(),
successUrl: z.union([z.string(), z.undefined()]).optional(),
billingCycleAnchor: z.union([z.literal("now"), z.undefined()]).optional(),
startsAt: z.union([z.number(), z.undefined()]).optional(),
checkoutSessionParams: z
.union([z.record(z.string(), z.any()), z.undefined()])
.optional(),

View File

@@ -168,6 +168,46 @@ actions:
console.log(result);
}
run();
- target: $["paths"]["/v1/billing.create_schedule"]["post"]
update:
x-codeSamples:
- lang: typescript
label: Typescript (SDK)
source: |-
import { Autumn } from "@useautumn/sdk";
const autumn = new Autumn({
xApiVersion: "2.2.0",
secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "",
});
async function run() {
const result = await autumn.billing.createSchedule({
customerId: "cus_123",
phases: [
{
startsAt: 1735689600000,
plans: [
{
planId: "trial_plan",
},
],
},
{
startsAt: 1736899200000,
plans: [
{
planId: "pro_plan",
},
],
},
],
});
console.log(result);
}
run();
- target: $["paths"]["/v1/billing.multi_attach"]["post"]
update:
@@ -389,6 +429,28 @@ actions:
console.log(result);
}
run();
- target: $["paths"]["/v1/customers.get"]["post"]
update:
x-codeSamples:
- lang: typescript
label: Typescript (SDK)
source: |-
import { Autumn } from "@useautumn/sdk";
const autumn = new Autumn({
xApiVersion: "2.2.0",
secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "",
});
async function run() {
const result = await autumn.customers.get({
customerId: "cus_123",
});
console.log(result);
}
run();
- target: $["paths"]["/v1/customers.get_or_create"]["post"]
update:

File diff suppressed because it is too large Load Diff

View File

@@ -83,6 +83,7 @@ typescript:
enumFormat: union
envVarPrefix: AUTUMN
exportZodModelNamespace: false
fixEnumNameSanitization: false
flatAdditionalProperties: true
flattenGlobalSecurity: true
flatteningOrder: parameters-first

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,16 @@
speakeasyVersion: 1.759.3
speakeasyVersion: 1.762.0
sources:
Autumn API:
sourceNamespace: autumn-api
sourceRevisionDigest: sha256:beab93c6158f999d82bdc5cbb8f8c9a1f6b3ee5ecda0dad3e70da941ddd610ff
sourceBlobDigest: sha256:14dc5f6ac1665f2246fabda1db2ed4ca95e9e97a799c36749fcea946bb335c01
sourceRevisionDigest: sha256:e922279ab84dd784fae344610f8d06eb04f2f5b84f3d321d57042aff7398f320
sourceBlobDigest: sha256:1445d90d28945bf208771c6644e54cbb6cb947170e8f52e318b781f07afe2002
tags:
- latest
- 2.2.0
Autumn API Stripped:
sourceNamespace: autumn-api-stripped
sourceRevisionDigest: sha256:1855536f6873d7de43c645fd173ba8caf2e79a8db90bb6e0603ec65df84df392
sourceBlobDigest: sha256:15472373f815975e687aa0ce5e7723b4e24b691424a5b60f0e20d213a46c3b80
sourceRevisionDigest: sha256:01a791dade812767bfceaf47f714b48ccfee5b61b2fc30f05d7d49ed4d303aa4
sourceBlobDigest: sha256:c229488e630723a61a02868424762ae479e7824789c2b05d5e801eba99f34bde
tags:
- latest
- 2.2.0
@@ -18,17 +18,17 @@ targets:
autumn:
source: Autumn API
sourceNamespace: autumn-api
sourceRevisionDigest: sha256:beab93c6158f999d82bdc5cbb8f8c9a1f6b3ee5ecda0dad3e70da941ddd610ff
sourceBlobDigest: sha256:14dc5f6ac1665f2246fabda1db2ed4ca95e9e97a799c36749fcea946bb335c01
sourceRevisionDigest: sha256:e922279ab84dd784fae344610f8d06eb04f2f5b84f3d321d57042aff7398f320
sourceBlobDigest: sha256:1445d90d28945bf208771c6644e54cbb6cb947170e8f52e318b781f07afe2002
codeSamplesNamespace: autumn-api-typescript-code-samples
codeSamplesRevisionDigest: sha256:94a8e6cc3bba396bc43d4003390256d04f5f8b7e3d8ae604f25b763f7c83620a
codeSamplesRevisionDigest: sha256:2b8414d46b6284ca95eb97d8cfeaff7d1e5242b50fe279ad2738e1a4f41a7c5e
autumn-python:
source: Autumn API Stripped
sourceNamespace: autumn-api-stripped
sourceRevisionDigest: sha256:1855536f6873d7de43c645fd173ba8caf2e79a8db90bb6e0603ec65df84df392
sourceBlobDigest: sha256:15472373f815975e687aa0ce5e7723b4e24b691424a5b60f0e20d213a46c3b80
sourceRevisionDigest: sha256:01a791dade812767bfceaf47f714b48ccfee5b61b2fc30f05d7d49ed4d303aa4
sourceBlobDigest: sha256:c229488e630723a61a02868424762ae479e7824789c2b05d5e801eba99f34bde
codeSamplesNamespace: autumn-api-python-code-samples
codeSamplesRevisionDigest: sha256:6f5801246781ff1282d0aefad42f71fe727a74b04668a74334728e145fdd6640
codeSamplesRevisionDigest: sha256:5725a44f1a1d2b199e5db46b6a437f00720ffef7603f889356066a566e1dd483
workflow:
workflowVersion: 1.0.0
speakeasyVersion: pinned

View File

@@ -1,11 +1,11 @@
# Standalone Functions
> [!NOTE]
> This section is useful if you are using a bundler and targetting browsers and
> This section is useful if you are using a bundler and targeting browsers and
> runtimes where the size of an application affects performance and load times.
Every method in this SDK is also available as a standalone function. This
alternative API is suitable when targetting the browser or serverless runtimes
alternative API is suitable when targeting the browser or serverless runtimes
and using a bundler to build your application since all unused functionality
will be tree-shaken away. This includes code for unused methods, Zod schemas,
encoding helpers and response handlers. The result is dramatically smaller

View File

@@ -164,7 +164,6 @@ const response = await client.check({ customerId: "cus_123", featureId: "message
// Check and consume 3 units in one call
const response = await client.check({
customerId: "cus_123",
featureId: "messages",
requiredBalance: 3,
@@ -253,6 +252,7 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p
@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional)
@param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (optional)
@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional)
@param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
@param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
@param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
@@ -263,6 +263,28 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
@returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
* [createSchedule](docs/sdks/billing/README.md#createschedule) - Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
@example
```typescript
// Schedule a transition from a trial plan to a paid plan
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778065018741,"plans":[{"planId":"trial_plan"}]},{"startsAt":1779274618741,"plans":[{"planId":"pro_plan"}]}] });
```
@param customerId - The ID of the customer to create the schedule for.
@param entityId - Optional entity ID for an entity-scoped schedule. (optional)
@param invoiceMode - Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase. (optional)
@param successUrl - URL to redirect to after successful checkout. (optional)
@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
@param redirectMode - Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects. (optional)
@param billingBehavior - Whether to prorate the immediate phase. 'none' skips proration charges and credits. (optional)
@param billingCycleAnchor - Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time. (optional)
@param enablePlanImmediately - If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed. (optional)
@param phases - Ordered phase definitions for the schedule.
@returns A create-schedule response with the schedule ID, persisted phases, and any required payment or checkout URL.
* [multiAttach](docs/sdks/billing/README.md#multiattach) - Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated.
Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products.
@@ -323,6 +345,7 @@ const response = await client.billing.previewAttach({ customerId: "cus_123", pla
@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional)
@param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (optional)
@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional)
@param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
@param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
@param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
@@ -449,6 +472,24 @@ const response = await client.getOrCreate({ customerId: "cus_123", name: "John D
@param billingControls - Billing controls for the customer (auto top-ups, etc.) (optional)
@param config - Miscellaneous configurations for the customer. (optional)
@param expand - Fields to expand in the returned customer response, such as subscriptions.plan, purchases.plan, balances.feature, or flags.feature. (optional)
* [get](docs/sdks/customers/README.md#get) - Fetches a customer by ID, optionally expanding related data such as invoices or entities.
Use this when you know the customer exists or assert they exist without creating them.
@example
```typescript
// Fetch a customer by external ID
const response = await client.get({ customerId: "cus_123" });
```
@example
```typescript
// Fetch a customer with expanded invoices and entities
const response = await client.get({ customerId: "cus_123", expand: ["invoices","entities"] });
```
@param customerId - ID of the customer to fetch
@param expand - Expand related customer data like invoices or entities, or expand nested objects like balances.feature, flags.feature, subscriptions.plan, and purchases.plan. (optional)
* [list](docs/sdks/customers/README.md#list) - Lists customers with pagination and optional filters.
* [update](docs/sdks/customers/README.md#update) - Updates an existing customer by ID.
* [delete](docs/sdks/customers/README.md#delete) - Deletes a customer by ID.
@@ -464,7 +505,6 @@ Use entities when usage and access must be scoped to sub-resources (for example
// Create a seat entity
const response = await client.entities.create({
customerId: "cus_123",
entityId: "seat_42",
featureId: "seats",
@@ -546,7 +586,6 @@ Use this to programmatically create features for metering usage, managing access
// Create a metered feature for API calls
const response = await client.features.create({
featureId: "api-calls",
name: "API Calls",
type: "metered",
@@ -698,6 +737,7 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p
@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional)
@param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (optional)
@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional)
@param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
@param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
@param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
@@ -708,6 +748,28 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p
@param enablePlanImmediately - If true, the customer's plan is activated immediately even when payment is deferred (invoice mode) or pending (Stripe checkout). For Stripe checkout, the customer_product is inserted before the customer completes the hosted form. (optional)
@returns A billing response with customer ID, invoice details, and payment URL (if checkout required).
- [`billingCreateSchedule`](docs/sdks/billing/README.md#createschedule) - Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
@example
```typescript
// Schedule a transition from a trial plan to a paid plan
const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778065018741,"plans":[{"planId":"trial_plan"}]},{"startsAt":1779274618741,"plans":[{"planId":"pro_plan"}]}] });
```
@param customerId - The ID of the customer to create the schedule for.
@param entityId - Optional entity ID for an entity-scoped schedule. (optional)
@param invoiceMode - Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase. (optional)
@param successUrl - URL to redirect to after successful checkout. (optional)
@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
@param redirectMode - Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects. (optional)
@param billingBehavior - Whether to prorate the immediate phase. 'none' skips proration charges and credits. (optional)
@param billingCycleAnchor - Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time. (optional)
@param enablePlanImmediately - If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed. (optional)
@param phases - Ordered phase definitions for the schedule.
@returns A create-schedule response with the schedule ID, persisted phases, and any required payment or checkout URL.
- [`billingMultiAttach`](docs/sdks/billing/README.md#multiattach) - Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated.
Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products.
@@ -769,6 +831,7 @@ const response = await client.billing.previewAttach({ customerId: "cus_123", pla
@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional)
@param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (optional)
@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional)
@param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
@param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
@param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
@@ -884,7 +947,6 @@ const response = await client.check({ customerId: "cus_123", featureId: "message
// Check and consume 3 units in one call
const response = await client.check({
customerId: "cus_123",
featureId: "messages",
requiredBalance: 3,
@@ -903,6 +965,24 @@ const response = await client.check({
@returns Whether access is allowed, plus the current balance for that feature. If Autumn is experiencing degraded service from a downstream provider, the API may return 202 and allow access fail-open.
- [`customersDelete`](docs/sdks/customers/README.md#delete) - Deletes a customer by ID.
- [`customersGet`](docs/sdks/customers/README.md#get) - Fetches a customer by ID, optionally expanding related data such as invoices or entities.
Use this when you know the customer exists or assert they exist without creating them.
@example
```typescript
// Fetch a customer by external ID
const response = await client.get({ customerId: "cus_123" });
```
@example
```typescript
// Fetch a customer with expanded invoices and entities
const response = await client.get({ customerId: "cus_123", expand: ["invoices","entities"] });
```
@param customerId - ID of the customer to fetch
@param expand - Expand related customer data like invoices or entities, or expand nested objects like balances.feature, flags.feature, subscriptions.plan, and purchases.plan. (optional)
- [`customersGetOrCreate`](docs/sdks/customers/README.md#getorcreate) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID.
Use this as the primary entrypoint before billing operations so the customer record is always present and up to date.
@@ -936,7 +1016,6 @@ Use entities when usage and access must be scoped to sub-resources (for example
// Create a seat entity
const response = await client.entities.create({
customerId: "cus_123",
entityId: "seat_42",
featureId: "seats",
@@ -1012,7 +1091,6 @@ Use this to programmatically create features for metering usage, managing access
// Create a metered feature for API calls
const response = await client.features.create({
featureId: "api-calls",
name: "API Calls",
type: "metered",

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -63,6 +64,7 @@ import { Result } from "../types/fp.js";
* @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional)
* @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (optional)
* @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional)
* @param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
* @param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
* @param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
@@ -177,7 +179,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -0,0 +1,186 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { RequestOptions } from "../lib/sdks.js";
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
import { pathToFunc } from "../lib/url.js";
import { AutumnError } from "../models/autumn-error.js";
import {
ConnectionError,
InvalidRequestError,
RequestAbortedError,
RequestTimeoutError,
UnexpectedClientError,
} from "../models/http-client-errors.js";
import * as models from "../models/index.js";
import { ResponseValidationError } from "../models/response-validation-error.js";
import { SDKValidationError } from "../models/sdk-validation-error.js";
import { APICall, APIPromise } from "../types/async.js";
import { Result } from "../types/fp.js";
/**
* Creates a multi-phase subscription schedule for a customer. The first phase starts immediately and subsequent phases automatically transition at their scheduled start times.
*
* Use this endpoint to schedule future plan changes (e.g. switch from a trial plan to a paid plan on a specific date) or to define a sequence of plans that should activate over time.
*
* @example
* ```typescript
* // Schedule a transition from a trial plan to a paid plan
* const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778065018741,"plans":[{"planId":"trial_plan"}]},{"startsAt":1779274618741,"plans":[{"planId":"pro_plan"}]}] });
* ```
*
* @param customerId - The ID of the customer to create the schedule for.
* @param entityId - Optional entity ID for an entity-scoped schedule. (optional)
* @param invoiceMode - Invoice mode creates and sends an invoice instead of charging the customer's payment method immediately for the first phase. (optional)
* @param successUrl - URL to redirect to after successful checkout. (optional)
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
* @param redirectMode - Controls when to return a checkout URL for the immediate phase. 'always' forces a confirmation or checkout flow, 'if_required' only redirects when needed, and 'never' disables redirects. (optional)
* @param billingBehavior - Whether to prorate the immediate phase. 'none' skips proration charges and credits. (optional)
* @param billingCycleAnchor - Pass 'now' to reset the billing cycle anchor of the immediate phase to the current time. (optional)
* @param enablePlanImmediately - If true, the immediate-phase cusProducts are activated immediately (and scheduled-phase cusProducts pre-inserted) even when payment is pending via Stripe checkout. The Autumn schedule rows are persisted on checkout.session.completed. (optional)
* @param phases - Ordered phase definitions for the schedule.
*
* @returns A create-schedule response with the schedule ID, persisted phases, and any required payment or checkout URL.
*/
export function billingCreateSchedule(
client: AutumnCore,
request: models.CreateScheduleParams,
options?: RequestOptions,
): APIPromise<
Result<
models.CreateScheduleResponse,
| AutumnError
| ResponseValidationError
| ConnectionError
| RequestAbortedError
| RequestTimeoutError
| InvalidRequestError
| UnexpectedClientError
| SDKValidationError
>
> {
return new APIPromise($do(
client,
request,
options,
));
}
async function $do(
client: AutumnCore,
request: models.CreateScheduleParams,
options?: RequestOptions,
): Promise<
[
Result<
models.CreateScheduleResponse,
| AutumnError
| ResponseValidationError
| ConnectionError
| RequestAbortedError
| RequestTimeoutError
| InvalidRequestError
| UnexpectedClientError
| SDKValidationError
>,
APICall,
]
> {
const parsed = safeParse(
request,
(value) => z.parse(models.CreateScheduleParams$outboundSchema, value),
"Input validation failed",
);
if (!parsed.ok) {
return [parsed, { status: "invalid" }];
}
const payload = parsed.value;
const body = encodeJSON("body", payload, { explode: true });
const path = pathToFunc("/v1/billing.create_schedule")();
const headers = new Headers(compactMap({
"Content-Type": "application/json",
Accept: "application/json",
"x-api-version": encodeSimple(
"x-api-version",
client._options.xApiVersion,
{ explode: false, charEncoding: "none" },
),
}));
const secConfig = await extractSecurity(client._options.secretKey);
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
const requestSecurity = resolveGlobalSecurity(securityInput);
const context = {
options: client._options,
baseURL: options?.serverURL ?? client._baseURL ?? "",
operationID: "createSchedule",
oAuth2Scopes: null,
resolvedSecurity: requestSecurity,
securitySource: client._options.secretKey,
retryConfig: options?.retries
|| client._options.retryConfig
|| { strategy: "none" },
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
};
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
userAgent: client._options.userAgent,
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
}, options);
if (!requestRes.ok) {
return [requestRes, { status: "invalid" }];
}
const req = requestRes.value;
const doResult = await client._do(req, {
context,
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});
if (!doResult.ok) {
return [doResult, { status: "request-error", request: req }];
}
const response = doResult.value;
const [result] = await M.match<
models.CreateScheduleResponse,
| AutumnError
| ResponseValidationError
| ConnectionError
| RequestAbortedError
| RequestTimeoutError
| InvalidRequestError
| UnexpectedClientError
| SDKValidationError
>(
M.json(200, models.CreateScheduleResponse$inboundSchema),
M.fail("4XX"),
M.fail("5XX"),
)(response, req);
if (!result.ok) {
return [result, { status: "complete", request: req, response }];
}
return [result, { status: "complete", request: req, response }];
}

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -165,7 +166,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -51,6 +52,7 @@ import { Result } from "../types/fp.js";
* @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional)
* @param billingCycleAnchor - Reset the billing cycle anchor immediately with 'now'. (optional)
* @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional)
* @param startsAt - Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription. (optional)
* @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional)
* @param customLineItems - Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans). (optional)
* @param processorSubscriptionId - The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one. (optional)
@@ -165,7 +167,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -153,7 +154,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -157,7 +158,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -169,7 +170,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -162,7 +163,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -152,7 +153,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -0,0 +1,182 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { RequestOptions } from "../lib/sdks.js";
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
import { pathToFunc } from "../lib/url.js";
import { AutumnError } from "../models/autumn-error.js";
import {
ConnectionError,
InvalidRequestError,
RequestAbortedError,
RequestTimeoutError,
UnexpectedClientError,
} from "../models/http-client-errors.js";
import * as models from "../models/index.js";
import { ResponseValidationError } from "../models/response-validation-error.js";
import { SDKValidationError } from "../models/sdk-validation-error.js";
import { APICall, APIPromise } from "../types/async.js";
import { Result } from "../types/fp.js";
/**
* Fetches a customer by ID, optionally expanding related data such as invoices or entities.
*
* Use this when you know the customer exists or assert they exist without creating them.
*
* @example
* ```typescript
* // Fetch a customer by external ID
* const response = await client.get({ customerId: "cus_123" });
* ```
*
* @example
* ```typescript
* // Fetch a customer with expanded invoices and entities
* const response = await client.get({ customerId: "cus_123", expand: ["invoices","entities"] });
* ```
*
* @param customerId - ID of the customer to fetch
* @param expand - Expand related customer data like invoices or entities, or expand nested objects like balances.feature, flags.feature, subscriptions.plan, and purchases.plan. (optional)
*/
export function customersGet(
client: AutumnCore,
request: models.GetCustomerParams,
options?: RequestOptions,
): APIPromise<
Result<
models.GetCustomerResponse,
| AutumnError
| ResponseValidationError
| ConnectionError
| RequestAbortedError
| RequestTimeoutError
| InvalidRequestError
| UnexpectedClientError
| SDKValidationError
>
> {
return new APIPromise($do(
client,
request,
options,
));
}
async function $do(
client: AutumnCore,
request: models.GetCustomerParams,
options?: RequestOptions,
): Promise<
[
Result<
models.GetCustomerResponse,
| AutumnError
| ResponseValidationError
| ConnectionError
| RequestAbortedError
| RequestTimeoutError
| InvalidRequestError
| UnexpectedClientError
| SDKValidationError
>,
APICall,
]
> {
const parsed = safeParse(
request,
(value) => z.parse(models.GetCustomerParams$outboundSchema, value),
"Input validation failed",
);
if (!parsed.ok) {
return [parsed, { status: "invalid" }];
}
const payload = parsed.value;
const body = encodeJSON("body", payload, { explode: true });
const path = pathToFunc("/v1/customers.get")();
const headers = new Headers(compactMap({
"Content-Type": "application/json",
Accept: "application/json",
"x-api-version": encodeSimple(
"x-api-version",
client._options.xApiVersion,
{ explode: false, charEncoding: "none" },
),
}));
const secConfig = await extractSecurity(client._options.secretKey);
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
const requestSecurity = resolveGlobalSecurity(securityInput);
const context = {
options: client._options,
baseURL: options?.serverURL ?? client._baseURL ?? "",
operationID: "getCustomer",
oAuth2Scopes: null,
resolvedSecurity: requestSecurity,
securitySource: client._options.secretKey,
retryConfig: options?.retries
|| client._options.retryConfig
|| { strategy: "none" },
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
};
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
userAgent: client._options.userAgent,
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
}, options);
if (!requestRes.ok) {
return [requestRes, { status: "invalid" }];
}
const req = requestRes.value;
const doResult = await client._do(req, {
context,
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});
if (!doResult.ok) {
return [doResult, { status: "request-error", request: req }];
}
const response = doResult.value;
const [result] = await M.match<
models.GetCustomerResponse,
| AutumnError
| ResponseValidationError
| ConnectionError
| RequestAbortedError
| RequestTimeoutError
| InvalidRequestError
| UnexpectedClientError
| SDKValidationError
>(
M.json(200, models.GetCustomerResponse$inboundSchema),
M.fail("4XX"),
M.fail("5XX"),
)(response, req);
if (!result.ok) {
return [result, { status: "complete", request: req, response }];
}
return [result, { status: "complete", request: req, response }];
}

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -134,7 +135,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -154,7 +155,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -144,7 +145,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -150,7 +151,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -145,7 +146,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -160,7 +161,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -143,7 +144,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -143,7 +144,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -4,6 +4,7 @@
import { AutumnCore } from "../core.js";
import { encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { RequestOptions } from "../lib/sdks.js";
@@ -120,7 +121,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -156,7 +157,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -210,7 +211,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -153,7 +154,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -153,7 +154,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -141,7 +142,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -179,7 +180,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -131,7 +132,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -5,6 +5,7 @@
import * as z from "zod/v4-mini";
import { AutumnCore } from "../core.js";
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
import { matchStatusCode } from "../lib/http.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
@@ -154,7 +155,8 @@ async function $do(
const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "5XX"],
isErrorStatusCode: (statusCode: number) =>
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});

View File

@@ -72,6 +72,6 @@ export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "2.2.0",
sdkVersion: "0.10.17",
genVersion: "2.869.25",
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.25 2.2.0 @useautumn/sdk",
genVersion: "2.882.0",
userAgent: "speakeasy-sdk/typescript 0.10.17 2.882.0 2.2.0 @useautumn/sdk",
} as const;

View File

@@ -518,3 +518,12 @@ export function appendForm(
fd.append(key, String(value));
}
}
export async function normalizeBlob(
value: Pick<Blob, "arrayBuffer" | "type">,
): Promise<Blob> {
if (value instanceof Blob) {
return value;
}
return new Blob([await value.arrayBuffer()], { type: value.type });
}

View File

@@ -22,7 +22,6 @@ import {
isConnectionError,
isTimeoutError,
matchContentType,
matchStatusCode,
} from "./http.js";
import { Logger } from "./logger.js";
import { retry, RetryConfig } from "./retries.js";
@@ -233,7 +232,7 @@ export class ClientSDK {
request: Request,
options: {
context: HookContext;
errorCodes: number | string | (number | string)[];
isErrorStatusCode: (statusCode: number) => boolean;
retryConfig: RetryConfig;
retryCodes: string[];
},
@@ -246,7 +245,7 @@ export class ClientSDK {
| UnexpectedClientError
>
> {
const { context, errorCodes } = options;
const { context, isErrorStatusCode } = options;
return retry(
async () => {
@@ -258,7 +257,7 @@ export class ClientSDK {
let response = await this.#httpClient.request(req);
try {
if (matchStatusCode(response, errorCodes)) {
if (isErrorStatusCode(response.status)) {
const result = await this.#hooks.afterError(
context,
response,
@@ -382,8 +381,6 @@ async function logResponse(
break;
case matchContentType(res, "application/jsonl")
|| jsonlLikeContentTypeRE.test(ct):
logger.log(await res.clone().text());
break;
case matchContentType(res, "text/event-stream"):
logger.log(`<${contentType}>`);
break;

View File

@@ -240,8 +240,9 @@ function applyBearer(
export function resolveGlobalSecurity(
security: Partial<models.Security> | null | undefined,
allowedFields?: number[],
): SecurityState | null {
return resolveSecurity(
let inputs: SecurityInput[][] = [
[
{
fieldName: "Authorization",
@@ -249,7 +250,18 @@ export function resolveGlobalSecurity(
value: security?.secretKey ?? env().AUTUMN_SECRET_KEY,
},
],
);
];
if (allowedFields) {
inputs = allowedFields.map((i) => {
if (i < 0 || i >= inputs.length) {
throw new RangeError(`invalid allowedFields index ${i}`);
}
return inputs[i]!;
});
}
return resolveSecurity(...inputs);
}
export async function extractSecurity<

View File

@@ -513,6 +513,10 @@ export type AttachParams = {
* When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.
*/
planSchedule?: AttachPlanSchedule | undefined;
/**
* Unix timestamp in milliseconds for when the attached plan should start. Future dates create a scheduled subscription.
*/
startsAt?: number | undefined;
/**
* Additional parameters to pass into the creation of the Stripe checkout session.
*/
@@ -1183,6 +1187,7 @@ export type AttachParams$Outbound = {
new_billing_subscription?: boolean | undefined;
billing_cycle_anchor?: "now" | undefined;
plan_schedule?: string | undefined;
starts_at?: number | undefined;
checkout_session_params?: { [k: string]: any } | undefined;
custom_line_items?: Array<AttachCustomLineItem$Outbound> | undefined;
processor_subscription_id?: string | undefined;
@@ -1218,6 +1223,7 @@ export const AttachParams$outboundSchema: z.ZodMiniType<
newBillingSubscription: z.optional(z.boolean()),
billingCycleAnchor: z.optional(z.literal("now")),
planSchedule: z.optional(AttachPlanSchedule$outboundSchema),
startsAt: z.optional(z.int()),
checkoutSessionParams: z.optional(z.record(z.string(), z.any())),
customLineItems: z.optional(
z.array(z.lazy(() => AttachCustomLineItem$outboundSchema)),
@@ -1247,6 +1253,7 @@ export const AttachParams$outboundSchema: z.ZodMiniType<
newBillingSubscription: "new_billing_subscription",
billingCycleAnchor: "billing_cycle_anchor",
planSchedule: "plan_schedule",
startsAt: "starts_at",
checkoutSessionParams: "checkout_session_params",
customLineItems: "custom_line_items",
processorSubscriptionId: "processor_subscription_id",

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v4-mini";
import { ClosedEnum } from "../types/enums.js";
export const CustomerExpand = {
Invoices: "invoices",
TrialsUsed: "trials_used",
Rewards: "rewards",
Entities: "entities",
Referrals: "referrals",
PaymentMethod: "payment_method",
SubscriptionsPlan: "subscriptions.plan",
PurchasesPlan: "purchases.plan",
BalancesFeature: "balances.feature",
FlagsFeature: "flags.feature",
BillingControlsAutoTopupsPurchaseLimit:
"billing_controls.auto_topups.purchase_limit",
} as const;
export type CustomerExpand = ClosedEnum<typeof CustomerExpand>;
/** @internal */
export const CustomerExpand$outboundSchema: z.ZodMiniEnum<
typeof CustomerExpand
> = z.enum(CustomerExpand);

View File

@@ -436,14 +436,14 @@ export type Invoice = {
/**
* The environment (sandbox/live)
*/
export const EntityEnv = {
export const CustomerEntityEnv = {
Sandbox: "sandbox",
Live: "live",
} as const;
/**
* The environment (sandbox/live)
*/
export type EntityEnv = OpenEnum<typeof EntityEnv>;
export type CustomerEntityEnv = OpenEnum<typeof CustomerEntityEnv>;
export type Entity = {
/**
@@ -469,7 +469,7 @@ export type Entity = {
/**
* The environment (sandbox/live)
*/
env: EntityEnv;
env: CustomerEntityEnv;
};
export type TrialsUsed = {
@@ -481,7 +481,7 @@ export type TrialsUsed = {
/**
* The type of reward
*/
export const RewardsType = {
export const CustomerRewardsType = {
PercentageDiscount: "percentage_discount",
FixedDiscount: "fixed_discount",
FreeProduct: "free_product",
@@ -490,7 +490,7 @@ export const RewardsType = {
/**
* The type of reward
*/
export type RewardsType = OpenEnum<typeof RewardsType>;
export type CustomerRewardsType = OpenEnum<typeof CustomerRewardsType>;
/**
* How long the discount lasts
@@ -517,7 +517,7 @@ export type Discount = {
/**
* The type of reward
*/
type: RewardsType;
type: CustomerRewardsType;
/**
* The discount value (percentage or fixed amount)
*/
@@ -1166,8 +1166,10 @@ export function invoiceFromJSON(
}
/** @internal */
export const EntityEnv$inboundSchema: z.ZodMiniType<EntityEnv, unknown> =
openEnums.inboundSchema(EntityEnv);
export const CustomerEntityEnv$inboundSchema: z.ZodMiniType<
CustomerEntityEnv,
unknown
> = openEnums.inboundSchema(CustomerEntityEnv);
/** @internal */
export const Entity$inboundSchema: z.ZodMiniType<Entity, unknown> = z.pipe(
@@ -1177,7 +1179,7 @@ export const Entity$inboundSchema: z.ZodMiniType<Entity, unknown> = z.pipe(
customer_id: z.optional(z.nullable(types.string())),
feature_id: z.optional(z.nullable(types.string())),
created_at: types.number(),
env: EntityEnv$inboundSchema,
env: CustomerEntityEnv$inboundSchema,
}),
z.transform((v) => {
return remap$(v, {
@@ -1225,8 +1227,10 @@ export function trialsUsedFromJSON(
}
/** @internal */
export const RewardsType$inboundSchema: z.ZodMiniType<RewardsType, unknown> =
openEnums.inboundSchema(RewardsType);
export const CustomerRewardsType$inboundSchema: z.ZodMiniType<
CustomerRewardsType,
unknown
> = openEnums.inboundSchema(CustomerRewardsType);
/** @internal */
export const CustomerDurationType$inboundSchema: z.ZodMiniType<
@@ -1239,7 +1243,7 @@ export const Discount$inboundSchema: z.ZodMiniType<Discount, unknown> = z.pipe(
z.object({
id: types.string(),
name: types.string(),
type: RewardsType$inboundSchema,
type: CustomerRewardsType$inboundSchema,
discount_value: types.number(),
duration_type: CustomerDurationType$inboundSchema,
duration_value: z.optional(z.nullable(types.number())),

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More