Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2feaeea9e3c2b01dd5b7e4092d8364af4bf1e740
9e950cbf7b5a814a98f27d1a94b72cd6f1df2078
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2190
v2202
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
[![pypi](https://img.shields.io/pypi/v/stripe.svg)](https://pypi.python.org/pypi/stripe)
[![Build Status](https://github.com/stripe/stripe-python/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-python/actions?query=branch%3Amaster)

> [!TIP]
> Want to chat live with Stripe engineers? Join us on our [Discord server](https://stripe.com/go/discord/python).

The Stripe Python library provides convenient access to the Stripe API from
applications written in the Python language. It includes a pre-defined set of
classes for API resources that initialize themselves dynamically from API
Expand Down Expand Up @@ -195,7 +198,7 @@ print(customer.last_response.headers)
### How to use undocumented parameters and properties

In some cases, you might encounter parameters on an API request or fields on an API response that aren’t available in the SDKs.
This might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.
This might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.
See [undocumented params and properties](https://docs.stripe.com/sdks/server-side?lang=python#undocumented-params-and-fields) to send those parameters or access those fields.

### Writing a Plugin
Expand Down
6 changes: 6 additions & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def add_beta_version(
forwarding as forwarding,
identity as identity,
issuing as issuing,
orchestration as orchestration,
params as params,
privacy as privacy,
product_catalog as product_catalog,
Expand Down Expand Up @@ -438,6 +439,9 @@ def add_beta_version(
)
from stripe._oauth import OAuth as OAuth
from stripe._oauth_service import OAuthService as OAuthService
from stripe._orchestration_service import (
OrchestrationService as OrchestrationService,
)
from stripe._order import Order as Order
from stripe._order_service import OrderService as OrderService
from stripe._payment_attempt_record import (
Expand Down Expand Up @@ -664,6 +668,7 @@ def add_beta_version(
"forwarding": ("stripe.forwarding", True),
"identity": ("stripe.identity", True),
"issuing": ("stripe.issuing", True),
"orchestration": ("stripe.orchestration", True),
"params": ("stripe.params", True),
"privacy": ("stripe.privacy", True),
"product_catalog": ("stripe.product_catalog", True),
Expand Down Expand Up @@ -884,6 +889,7 @@ def add_beta_version(
),
"OAuth": ("stripe._oauth", False),
"OAuthService": ("stripe._oauth_service", False),
"OrchestrationService": ("stripe._orchestration_service", False),
"Order": ("stripe._order", False),
"OrderService": ("stripe._order_service", False),
"PaymentAttemptRecord": ("stripe._payment_attempt_record", False),
Expand Down
2 changes: 1 addition & 1 deletion stripe/_account_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Indicator(StripeObject):
"""
delinquency: Optional[Delinquency]
"""
The delinquency signal of the account
The delinquency signal of the account.
"""
livemode: bool
"""
Expand Down
13 changes: 7 additions & 6 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import (
Any,
AsyncIterable,
Callable,
Dict,
List,
Mapping,
Expand Down Expand Up @@ -545,14 +546,14 @@ def request_headers(
ua: Dict[str, Union[str, "AppInfo"]] = {
"bindings_version": VERSION,
"lang": "python",
"publisher": "stripe",
"httplib": self._get_http_client().name,
}
for attr, func in [
["lang_version", platform.python_version],
["platform", platform.platform],
["uname", lambda: " ".join(platform.uname())],
]:
attr_funcs: List[Tuple[str, Callable[[], str]]] = [
("lang_version", platform.python_version),
]
if stripe.enable_telemetry:
attr_funcs.append(("platform", platform.platform))
for attr, func in attr_funcs:
try:
val = func()
except Exception:
Expand Down
34 changes: 9 additions & 25 deletions stripe/_invoice_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,17 @@ class InvoiceItem(
OBJECT_NAME: ClassVar[Literal["invoiceitem"]] = "invoiceitem"

class Parent(StripeObject):
class LicenseFeeSubscriptionDetails(StripeObject):
license_fee_subscription: str
"""
The license fee subscription that generated this invoice item
"""
license_fee_version: str
"""
The license fee version that generated this invoice item
"""
class PricingPlanSubscriptionDetails(StripeObject):
pricing_plan_subscription: str
"""
The pricing plan subscription that manages the license fee subscription
The pricing plan subscription that manages this charge
"""
pricing_plan_version: str
"""
The pricing plan version at the time this invoice item was generated
The pricing plan version at the time this charge was generated
"""

class RateCardSubscriptionDetails(StripeObject):
pricing_plan_subscription: Optional[str]
"""
The pricing plan subscription that manages the rate card subscription
"""
pricing_plan_version: Optional[str]
"""
The pricing plan version at the time this invoice item was generated
"""
rate_card_subscription: str
"""
The rate card subscription that generated this invoice item
Expand All @@ -106,11 +90,11 @@ class SubscriptionDetails(StripeObject):
The subscription item that generated this invoice item
"""

license_fee_subscription_details: Optional[
LicenseFeeSubscriptionDetails
pricing_plan_subscription_details: Optional[
PricingPlanSubscriptionDetails
]
"""
Details about the license fee subscription that generated this invoice item
Details about the pricing plan subscription that generated this invoice item
"""
rate_card_subscription_details: Optional[RateCardSubscriptionDetails]
"""
Expand All @@ -125,7 +109,7 @@ class SubscriptionDetails(StripeObject):
Details about the subscription that generated this invoice item
"""
type: Literal[
"license_fee_subscription_details",
"pricing_plan_subscription_details",
"rate_card_subscription_details",
"schedule_details",
"subscription_details",
Expand All @@ -134,7 +118,7 @@ class SubscriptionDetails(StripeObject):
The type of parent that generated this invoice item
"""
_inner_class_types = {
"license_fee_subscription_details": LicenseFeeSubscriptionDetails,
"pricing_plan_subscription_details": PricingPlanSubscriptionDetails,
"rate_card_subscription_details": RateCardSubscriptionDetails,
"schedule_details": ScheduleDetails,
"subscription_details": SubscriptionDetails,
Expand Down Expand Up @@ -286,7 +270,7 @@ class DiscountAmount(StripeObject):
"""
The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
"""
frozen_fields: Optional[List[Literal["pricing", "quantity"]]]
frozen_fields: Optional[List[Literal["discounts", "pricing", "quantity"]]]
"""
Array of field names that can't be modified. Attempting to update a frozen field returns an error.
"""
Expand Down
32 changes: 8 additions & 24 deletions stripe/_invoice_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,41 +83,25 @@ class CreditedItems(StripeObject):
"""
_inner_class_types = {"proration_details": ProrationDetails}

class LicenseFeeSubscriptionDetails(StripeObject):
class PricingPlanSubscriptionDetails(StripeObject):
invoice_item: str
"""
The invoice item that generated this line item
"""
license_fee_subscription: str
"""
The license fee subscription that generated this line item
"""
license_fee_version: str
"""
The license fee version at the time this line item was generated
"""
pricing_plan_subscription: str
"""
The pricing plan subscription that manages the license fee subscription
The pricing plan subscription that manages this charge
"""
pricing_plan_version: str
"""
The pricing plan version at the time this line item was generated
The pricing plan version at the time this charge was generated
"""

class RateCardSubscriptionDetails(StripeObject):
invoice_item: str
"""
The invoice item that generated this line item
"""
pricing_plan_subscription: Optional[str]
"""
The pricing plan subscription that manages the rate card subscription
"""
pricing_plan_version: Optional[str]
"""
The pricing plan version at the time this line item was generated
"""
rate_card_subscription: str
"""
The rate card subscription that generated this line item
Expand Down Expand Up @@ -211,11 +195,11 @@ class CreditedItems(StripeObject):
"""
Details about the invoice item that generated this line item
"""
license_fee_subscription_details: Optional[
LicenseFeeSubscriptionDetails
pricing_plan_subscription_details: Optional[
PricingPlanSubscriptionDetails
]
"""
Details about the license fee subscription that generated this line item
Details about the pricing plan subscription that generated this line item
"""
rate_card_subscription_details: Optional[RateCardSubscriptionDetails]
"""
Expand All @@ -231,7 +215,7 @@ class CreditedItems(StripeObject):
"""
type: Literal[
"invoice_item_details",
"license_fee_subscription_details",
"pricing_plan_subscription_details",
"rate_card_subscription_details",
"schedule_details",
"subscription_item_details",
Expand All @@ -241,7 +225,7 @@ class CreditedItems(StripeObject):
"""
_inner_class_types = {
"invoice_item_details": InvoiceItemDetails,
"license_fee_subscription_details": LicenseFeeSubscriptionDetails,
"pricing_plan_subscription_details": PricingPlanSubscriptionDetails,
"rate_card_subscription_details": RateCardSubscriptionDetails,
"schedule_details": ScheduleDetails,
"subscription_item_details": SubscriptionItemDetails,
Expand Down
8 changes: 8 additions & 0 deletions stripe/_object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@
"login_link": ("stripe._login_link", "LoginLink"),
"mandate": ("stripe._mandate", "Mandate"),
"margin": ("stripe._margin", "Margin"),
"orchestration.payment_attempt": (
"stripe.orchestration._payment_attempt",
"PaymentAttempt",
),
"order": ("stripe._order", "Order"),
"payment_attempt_record": (
"stripe._payment_attempt_record",
Expand Down Expand Up @@ -290,6 +294,10 @@
"stripe.radar._account_evaluation",
"AccountEvaluation",
),
"radar.customer_evaluation": (
"stripe.radar._customer_evaluation",
"CustomerEvaluation",
),
"radar.early_fraud_warning": (
"stripe.radar._early_fraud_warning",
"EarlyFraudWarning",
Expand Down
40 changes: 40 additions & 0 deletions stripe/_orchestration_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from importlib import import_module
from typing_extensions import TYPE_CHECKING

if TYPE_CHECKING:
from stripe.orchestration._payment_attempt_service import (
PaymentAttemptService,
)

_subservices = {
"payment_attempts": [
"stripe.orchestration._payment_attempt_service",
"PaymentAttemptService",
],
}


class OrchestrationService(StripeService):
payment_attempts: "PaymentAttemptService"

def __init__(self, requestor):
super().__init__(requestor)

def __getattr__(self, name):
try:
import_from, service = _subservices[name]
service_class = getattr(
import_module(import_from),
service,
)
setattr(
self,
name,
service_class(self._requestor),
)
return getattr(self, name)
except KeyError:
raise AttributeError()
Loading
Loading