1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
|
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._quote import Quote
from stripe._quote_computed_upfront_line_items_service import (
QuoteComputedUpfrontLineItemsService,
)
from stripe._quote_line_item_service import QuoteLineItemService
from stripe._request_options import RequestOptions
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from typing import Any, Dict, List, cast
from typing_extensions import Literal, NotRequired, TypedDict
class QuoteService(StripeService):
def __init__(self, requestor):
super().__init__(requestor)
self.line_items = QuoteLineItemService(self._requestor)
self.computed_upfront_line_items = (
QuoteComputedUpfrontLineItemsService(
self._requestor,
)
)
class AcceptParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class CancelParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class CreateParams(TypedDict):
application_fee_amount: NotRequired["Literal['']|int"]
"""
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. There cannot be any line items with recurring prices when using this field.
"""
application_fee_percent: NotRequired["Literal['']|float"]
"""
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. There must be at least 1 line item with a recurring price to use this field.
"""
automatic_tax: NotRequired["QuoteService.CreateParamsAutomaticTax"]
"""
Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.
"""
collection_method: NotRequired[
Literal["charge_automatically", "send_invoice"]
]
"""
Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
"""
customer: NotRequired[str]
"""
The customer for which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
"""
default_tax_rates: NotRequired["Literal['']|List[str]"]
"""
The tax rates that will apply to any line item that does not have `tax_rates` set.
"""
description: NotRequired["Literal['']|str"]
"""
A description that will be displayed on the quote PDF. If no value is passed, the default description configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used.
"""
discounts: NotRequired[
"Literal['']|List[QuoteService.CreateParamsDiscount]"
]
"""
The discounts applied to the quote.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
expires_at: NotRequired[int]
"""
A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. If no value is passed, the default expiration date configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used.
"""
footer: NotRequired["Literal['']|str"]
"""
A footer that will be displayed on the quote PDF. If no value is passed, the default footer configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used.
"""
from_quote: NotRequired["QuoteService.CreateParamsFromQuote"]
"""
Clone an existing quote. The new quote will be created in `status=draft`. When using this parameter, you cannot specify any other parameters except for `expires_at`.
"""
header: NotRequired["Literal['']|str"]
"""
A header that will be displayed on the quote PDF. If no value is passed, the default header configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used.
"""
invoice_settings: NotRequired[
"QuoteService.CreateParamsInvoiceSettings"
]
"""
All invoices will be billed using the specified settings.
"""
line_items: NotRequired[List["QuoteService.CreateParamsLineItem"]]
"""
A list of line items the customer is being quoted for. Each line item includes information about the product, the quantity, and the resulting cost.
"""
metadata: NotRequired[Dict[str, str]]
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""
on_behalf_of: NotRequired["Literal['']|str"]
"""
The account on behalf of which to charge.
"""
subscription_data: NotRequired[
"QuoteService.CreateParamsSubscriptionData"
]
"""
When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created.
"""
test_clock: NotRequired[str]
"""
ID of the test clock to attach to the quote.
"""
transfer_data: NotRequired[
"Literal['']|QuoteService.CreateParamsTransferData"
]
"""
The data with which to automatically create a Transfer for each of the invoices.
"""
class CreateParamsAutomaticTax(TypedDict):
enabled: bool
"""
Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself.
"""
liability: NotRequired[
"QuoteService.CreateParamsAutomaticTaxLiability"
]
"""
The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
"""
class CreateParamsAutomaticTaxLiability(TypedDict):
account: NotRequired[str]
"""
The connected account being referenced when `type` is `account`.
"""
type: Literal["account", "self"]
"""
Type of the account referenced in the request.
"""
class CreateParamsDiscount(TypedDict):
coupon: NotRequired[str]
"""
ID of the coupon to create a new discount for.
"""
discount: NotRequired[str]
"""
ID of an existing discount on the object (or one of its ancestors) to reuse.
"""
promotion_code: NotRequired[str]
"""
ID of the promotion code to create a new discount for.
"""
class CreateParamsFromQuote(TypedDict):
is_revision: NotRequired[bool]
"""
Whether this quote is a revision of the previous quote.
"""
quote: str
"""
The `id` of the quote that will be cloned.
"""
class CreateParamsInvoiceSettings(TypedDict):
days_until_due: NotRequired[int]
"""
Number of days within which a customer must pay the invoice generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`.
"""
issuer: NotRequired["QuoteService.CreateParamsInvoiceSettingsIssuer"]
"""
The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
"""
class CreateParamsInvoiceSettingsIssuer(TypedDict):
account: NotRequired[str]
"""
The connected account being referenced when `type` is `account`.
"""
type: Literal["account", "self"]
"""
Type of the account referenced in the request.
"""
class CreateParamsLineItem(TypedDict):
discounts: NotRequired[
"Literal['']|List[QuoteService.CreateParamsLineItemDiscount]"
]
"""
The discounts applied to this line item.
"""
price: NotRequired[str]
"""
The ID of the price object. One of `price` or `price_data` is required.
"""
price_data: NotRequired["QuoteService.CreateParamsLineItemPriceData"]
"""
Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
"""
quantity: NotRequired[int]
"""
The quantity of the line item.
"""
tax_rates: NotRequired["Literal['']|List[str]"]
"""
The tax rates which apply to the line item. When set, the `default_tax_rates` on the quote do not apply to this line item.
"""
class CreateParamsLineItemDiscount(TypedDict):
coupon: NotRequired[str]
"""
ID of the coupon to create a new discount for.
"""
discount: NotRequired[str]
"""
ID of an existing discount on the object (or one of its ancestors) to reuse.
"""
promotion_code: NotRequired[str]
"""
ID of the promotion code to create a new discount for.
"""
class CreateParamsLineItemPriceData(TypedDict):
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
product: str
"""
The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
"""
recurring: NotRequired[
"QuoteService.CreateParamsLineItemPriceDataRecurring"
]
"""
The recurring components of a price such as `interval` and `interval_count`.
"""
tax_behavior: NotRequired[
Literal["exclusive", "inclusive", "unspecified"]
]
"""
Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
"""
unit_amount: NotRequired[int]
"""
A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
"""
unit_amount_decimal: NotRequired[str]
"""
Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
"""
class CreateParamsLineItemPriceDataRecurring(TypedDict):
interval: Literal["day", "month", "week", "year"]
"""
Specifies billing frequency. Either `day`, `week`, `month` or `year`.
"""
interval_count: NotRequired[int]
"""
The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
"""
class CreateParamsSubscriptionData(TypedDict):
description: NotRequired[str]
"""
The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
"""
effective_date: NotRequired[
"Literal['']|Literal['current_period_end']|int"
]
"""
When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted.
"""
metadata: NotRequired[Dict[str, str]]
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
"""
trial_period_days: NotRequired["Literal['']|int"]
"""
Integer representing the number of trial period days before the customer is charged for the first time.
"""
class CreateParamsTransferData(TypedDict):
amount: NotRequired[int]
"""
The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. There cannot be any line items with recurring prices when using this field.
"""
amount_percent: NotRequired[float]
"""
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. There must be at least 1 line item with a recurring price to use this field.
"""
destination: str
"""
ID of an existing, connected Stripe account.
"""
class FinalizeQuoteParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
expires_at: NotRequired[int]
"""
A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch.
"""
class ListParams(TypedDict):
customer: NotRequired[str]
"""
The ID of the customer whose quotes will be retrieved.
"""
ending_before: NotRequired[str]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired[int]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired[str]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""
status: NotRequired[Literal["accepted", "canceled", "draft", "open"]]
"""
The status of the quote.
"""
test_clock: NotRequired[str]
"""
Provides a list of quotes that are associated with the specified test clock. The response will not include quotes with test clocks if this and the customer parameter is not set.
"""
class PdfParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class RetrieveParams(TypedDict):
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
class UpdateParams(TypedDict):
application_fee_amount: NotRequired["Literal['']|int"]
"""
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. There cannot be any line items with recurring prices when using this field.
"""
application_fee_percent: NotRequired["Literal['']|float"]
"""
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. There must be at least 1 line item with a recurring price to use this field.
"""
automatic_tax: NotRequired["QuoteService.UpdateParamsAutomaticTax"]
"""
Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.
"""
collection_method: NotRequired[
Literal["charge_automatically", "send_invoice"]
]
"""
Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
"""
customer: NotRequired[str]
"""
The customer for which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
"""
default_tax_rates: NotRequired["Literal['']|List[str]"]
"""
The tax rates that will apply to any line item that does not have `tax_rates` set.
"""
description: NotRequired["Literal['']|str"]
"""
A description that will be displayed on the quote PDF.
"""
discounts: NotRequired[
"Literal['']|List[QuoteService.UpdateParamsDiscount]"
]
"""
The discounts applied to the quote.
"""
expand: NotRequired[List[str]]
"""
Specifies which fields in the response should be expanded.
"""
expires_at: NotRequired[int]
"""
A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch.
"""
footer: NotRequired["Literal['']|str"]
"""
A footer that will be displayed on the quote PDF.
"""
header: NotRequired["Literal['']|str"]
"""
A header that will be displayed on the quote PDF.
"""
invoice_settings: NotRequired[
"QuoteService.UpdateParamsInvoiceSettings"
]
"""
All invoices will be billed using the specified settings.
"""
line_items: NotRequired[List["QuoteService.UpdateParamsLineItem"]]
"""
A list of line items the customer is being quoted for. Each line item includes information about the product, the quantity, and the resulting cost.
"""
metadata: NotRequired[Dict[str, str]]
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""
on_behalf_of: NotRequired["Literal['']|str"]
"""
The account on behalf of which to charge.
"""
subscription_data: NotRequired[
"QuoteService.UpdateParamsSubscriptionData"
]
"""
When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created.
"""
transfer_data: NotRequired[
"Literal['']|QuoteService.UpdateParamsTransferData"
]
"""
The data with which to automatically create a Transfer for each of the invoices.
"""
class UpdateParamsAutomaticTax(TypedDict):
enabled: bool
"""
Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself.
"""
liability: NotRequired[
"QuoteService.UpdateParamsAutomaticTaxLiability"
]
"""
The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
"""
class UpdateParamsAutomaticTaxLiability(TypedDict):
account: NotRequired[str]
"""
The connected account being referenced when `type` is `account`.
"""
type: Literal["account", "self"]
"""
Type of the account referenced in the request.
"""
class UpdateParamsDiscount(TypedDict):
coupon: NotRequired[str]
"""
ID of the coupon to create a new discount for.
"""
discount: NotRequired[str]
"""
ID of an existing discount on the object (or one of its ancestors) to reuse.
"""
promotion_code: NotRequired[str]
"""
ID of the promotion code to create a new discount for.
"""
class UpdateParamsInvoiceSettings(TypedDict):
days_until_due: NotRequired[int]
"""
Number of days within which a customer must pay the invoice generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`.
"""
issuer: NotRequired["QuoteService.UpdateParamsInvoiceSettingsIssuer"]
"""
The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
"""
class UpdateParamsInvoiceSettingsIssuer(TypedDict):
account: NotRequired[str]
"""
The connected account being referenced when `type` is `account`.
"""
type: Literal["account", "self"]
"""
Type of the account referenced in the request.
"""
class UpdateParamsLineItem(TypedDict):
discounts: NotRequired[
"Literal['']|List[QuoteService.UpdateParamsLineItemDiscount]"
]
"""
The discounts applied to this line item.
"""
id: NotRequired[str]
"""
The ID of an existing line item on the quote.
"""
price: NotRequired[str]
"""
The ID of the price object. One of `price` or `price_data` is required.
"""
price_data: NotRequired["QuoteService.UpdateParamsLineItemPriceData"]
"""
Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
"""
quantity: NotRequired[int]
"""
The quantity of the line item.
"""
tax_rates: NotRequired["Literal['']|List[str]"]
"""
The tax rates which apply to the line item. When set, the `default_tax_rates` on the quote do not apply to this line item.
"""
class UpdateParamsLineItemDiscount(TypedDict):
coupon: NotRequired[str]
"""
ID of the coupon to create a new discount for.
"""
discount: NotRequired[str]
"""
ID of an existing discount on the object (or one of its ancestors) to reuse.
"""
promotion_code: NotRequired[str]
"""
ID of the promotion code to create a new discount for.
"""
class UpdateParamsLineItemPriceData(TypedDict):
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
product: str
"""
The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
"""
recurring: NotRequired[
"QuoteService.UpdateParamsLineItemPriceDataRecurring"
]
"""
The recurring components of a price such as `interval` and `interval_count`.
"""
tax_behavior: NotRequired[
Literal["exclusive", "inclusive", "unspecified"]
]
"""
Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
"""
unit_amount: NotRequired[int]
"""
A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
"""
unit_amount_decimal: NotRequired[str]
"""
Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
"""
class UpdateParamsLineItemPriceDataRecurring(TypedDict):
interval: Literal["day", "month", "week", "year"]
"""
Specifies billing frequency. Either `day`, `week`, `month` or `year`.
"""
interval_count: NotRequired[int]
"""
The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
"""
class UpdateParamsSubscriptionData(TypedDict):
description: NotRequired["Literal['']|str"]
"""
The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
"""
effective_date: NotRequired[
"Literal['']|Literal['current_period_end']|int"
]
"""
When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted.
"""
metadata: NotRequired[Dict[str, str]]
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
"""
trial_period_days: NotRequired["Literal['']|int"]
"""
Integer representing the number of trial period days before the customer is charged for the first time.
"""
class UpdateParamsTransferData(TypedDict):
amount: NotRequired[int]
"""
The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. There cannot be any line items with recurring prices when using this field.
"""
amount_percent: NotRequired[float]
"""
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. There must be at least 1 line item with a recurring price to use this field.
"""
destination: str
"""
ID of an existing, connected Stripe account.
"""
def list(
self,
params: "QuoteService.ListParams" = {},
options: RequestOptions = {},
) -> ListObject[Quote]:
"""
Returns a list of your quotes.
"""
return cast(
ListObject[Quote],
self._request(
"get",
"/v1/quotes",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: "QuoteService.ListParams" = {},
options: RequestOptions = {},
) -> ListObject[Quote]:
"""
Returns a list of your quotes.
"""
return cast(
ListObject[Quote],
await self._request_async(
"get",
"/v1/quotes",
base_address="api",
params=params,
options=options,
),
)
def create(
self,
params: "QuoteService.CreateParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
"""
return cast(
Quote,
self._request(
"post",
"/v1/quotes",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "QuoteService.CreateParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
"""
return cast(
Quote,
await self._request_async(
"post",
"/v1/quotes",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
quote: str,
params: "QuoteService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Retrieves the quote with the given ID.
"""
return cast(
Quote,
self._request(
"get",
"/v1/quotes/{quote}".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
quote: str,
params: "QuoteService.RetrieveParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Retrieves the quote with the given ID.
"""
return cast(
Quote,
await self._request_async(
"get",
"/v1/quotes/{quote}".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
def update(
self,
quote: str,
params: "QuoteService.UpdateParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
A quote models prices and services for a customer.
"""
return cast(
Quote,
self._request(
"post",
"/v1/quotes/{quote}".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
async def update_async(
self,
quote: str,
params: "QuoteService.UpdateParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
A quote models prices and services for a customer.
"""
return cast(
Quote,
await self._request_async(
"post",
"/v1/quotes/{quote}".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
def accept(
self,
quote: str,
params: "QuoteService.AcceptParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Accepts the specified quote.
"""
return cast(
Quote,
self._request(
"post",
"/v1/quotes/{quote}/accept".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
async def accept_async(
self,
quote: str,
params: "QuoteService.AcceptParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Accepts the specified quote.
"""
return cast(
Quote,
await self._request_async(
"post",
"/v1/quotes/{quote}/accept".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
def cancel(
self,
quote: str,
params: "QuoteService.CancelParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Cancels the quote.
"""
return cast(
Quote,
self._request(
"post",
"/v1/quotes/{quote}/cancel".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
async def cancel_async(
self,
quote: str,
params: "QuoteService.CancelParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Cancels the quote.
"""
return cast(
Quote,
await self._request_async(
"post",
"/v1/quotes/{quote}/cancel".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
def finalize_quote(
self,
quote: str,
params: "QuoteService.FinalizeQuoteParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Finalizes the quote.
"""
return cast(
Quote,
self._request(
"post",
"/v1/quotes/{quote}/finalize".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
async def finalize_quote_async(
self,
quote: str,
params: "QuoteService.FinalizeQuoteParams" = {},
options: RequestOptions = {},
) -> Quote:
"""
Finalizes the quote.
"""
return cast(
Quote,
await self._request_async(
"post",
"/v1/quotes/{quote}/finalize".format(quote=sanitize_id(quote)),
base_address="api",
params=params,
options=options,
),
)
def pdf(
self,
quote: str,
params: "QuoteService.PdfParams" = {},
options: RequestOptions = {},
) -> Any:
"""
Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
"""
return cast(
Any,
self._request_stream(
"get",
"/v1/quotes/{quote}/pdf".format(quote=sanitize_id(quote)),
base_address="files",
params=params,
options=options,
),
)
async def pdf_async(
self,
quote: str,
params: "QuoteService.PdfParams" = {},
options: RequestOptions = {},
) -> Any:
"""
Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
"""
return cast(
Any,
await self._request_stream_async(
"get",
"/v1/quotes/{quote}/pdf".format(quote=sanitize_id(quote)),
base_address="files",
params=params,
options=options,
),
)
|