Skip to content

Commit 037dc22

Browse files
authored
Merge pull request stripe#956 from stripe/remi/codegen-df0ebe7
Add support for `amount_total`, `amount_subtotal` and `amount_details` on Checkout `Session`
2 parents d6dfdc1 + fa5c5bb commit 037dc22

9 files changed

+101
-21
lines changed

types/2020-03-02/Checkout/Sessions.d.ts

+81-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ declare module 'stripe' {
1616
*/
1717
object: 'checkout.session';
1818

19+
/**
20+
* Total of all items before discounts or taxes are applied.
21+
*/
22+
amount_subtotal: number | null;
23+
24+
/**
25+
* Total of all items after discounts and taxes are applied.
26+
*/
27+
amount_total: number | null;
28+
1929
/**
2030
* Describes whether Checkout should collect the customer's billing address.
2131
*/
@@ -33,6 +43,11 @@ declare module 'stripe' {
3343
*/
3444
client_reference_id: string | null;
3545

46+
/**
47+
* 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).
48+
*/
49+
currency: string | null;
50+
3651
/**
3752
* The ID of the customer for this session.
3853
* For Checkout Sessions in `payment` or `subscription` mode, Checkout
@@ -125,6 +140,11 @@ declare module 'stripe' {
125140
* subscription creation is successful.
126141
*/
127142
success_url: string;
143+
144+
/**
145+
* Tax and discount details for the computed total amount.
146+
*/
147+
total_details: Session.TotalDetails | null;
128148
}
129149

130150
namespace Session {
@@ -506,6 +526,66 @@ declare module 'stripe' {
506526
}
507527

508528
type SubmitType = 'auto' | 'book' | 'donate' | 'pay';
529+
530+
interface TotalDetails {
531+
/**
532+
* This is the sum of all the line item discounts.
533+
*/
534+
amount_discount: number;
535+
536+
/**
537+
* This is the sum of all the line item tax amounts.
538+
*/
539+
amount_tax: number;
540+
541+
breakdown?: TotalDetails.Breakdown;
542+
}
543+
544+
namespace TotalDetails {
545+
interface Breakdown {
546+
/**
547+
* The aggregated line item discounts.
548+
*/
549+
discounts: Array<Breakdown.Discount>;
550+
551+
/**
552+
* The aggregated line item tax amounts by rate.
553+
*/
554+
taxes: Array<Breakdown.Tax>;
555+
}
556+
557+
namespace Breakdown {
558+
interface Discount {
559+
/**
560+
* The amount discounted.
561+
*/
562+
amount: number;
563+
564+
/**
565+
* A discount represents the actual application of a coupon to a particular
566+
* customer. It contains information about when the discount began and when it
567+
* will end.
568+
*
569+
* Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
570+
*/
571+
discount: Stripe.Discount;
572+
}
573+
574+
interface Tax {
575+
/**
576+
* Amount of tax applied for this rate.
577+
*/
578+
amount: number;
579+
580+
/**
581+
* Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.
582+
*
583+
* Related guide: [Tax Rates](https://stripe.com/docs/billing/taxes/tax-rates).
584+
*/
585+
rate: Stripe.TaxRate;
586+
}
587+
}
588+
}
509589
}
510590

511591
interface SessionCreateParams {
@@ -818,7 +898,7 @@ declare module 'stripe' {
818898
on_behalf_of?: string;
819899

820900
/**
821-
* Email address that the receipt for the resulting payment will be sent to.
901+
* Email address that the receipt for the resulting payment will be sent to. If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
822902
*/
823903
receipt_email?: string;
824904

types/2020-03-02/InvoiceLineItems.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ declare module 'stripe' {
201201
subscription_default_tax_rates?: Array<string> | null;
202202

203203
/**
204-
* List of subscription items, each with an attached plan.
204+
* A list of up to 20 subscription items, each with an attached price.
205205
*/
206206
subscription_items?: Array<
207207
InvoiceLineItemListUpcomingParams.SubscriptionItem

types/2020-03-02/Invoices.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ declare module 'stripe' {
898898
subscription_default_tax_rates?: Array<string> | null;
899899

900900
/**
901-
* List of subscription items, each with an attached plan.
901+
* A list of up to 20 subscription items, each with an attached price.
902902
*/
903903
subscription_items?: Array<
904904
InvoiceRetrieveUpcomingParams.SubscriptionItem

types/2020-03-02/LineItems.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ declare module 'stripe' {
6363
namespace LineItem {
6464
interface Discount {
6565
/**
66-
* Discount amount for this line item.
66+
* The amount discounted.
6767
*/
6868
amount: number;
6969

@@ -79,7 +79,7 @@ declare module 'stripe' {
7979

8080
interface Tax {
8181
/**
82-
* Amount of tax for this line item.
82+
* Amount of tax applied for this rate.
8383
*/
8484
amount: number;
8585

types/2020-03-02/PaymentIntents.d.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ declare module 'stripe' {
140140
payment_method_types: Array<string>;
141141

142142
/**
143-
* Email address that the receipt for the resulting payment will be sent to.
143+
* Email address that the receipt for the resulting payment will be sent to. If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
144144
*/
145145
receipt_email: string | null;
146146

@@ -606,7 +606,7 @@ declare module 'stripe' {
606606
payment_method_types?: Array<string>;
607607

608608
/**
609-
* Email address that the receipt for the resulting payment will be sent to.
609+
* Email address that the receipt for the resulting payment will be sent to. If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
610610
*/
611611
receipt_email?: string;
612612

@@ -1193,7 +1193,7 @@ declare module 'stripe' {
11931193
payment_method_types?: Array<string>;
11941194

11951195
/**
1196-
* Email address that the receipt for the resulting payment will be sent to.
1196+
* Email address that the receipt for the resulting payment will be sent to. If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
11971197
*/
11981198
receipt_email?: string | null;
11991199

@@ -1752,7 +1752,7 @@ declare module 'stripe' {
17521752
payment_method_options?: PaymentIntentConfirmParams.PaymentMethodOptions;
17531753

17541754
/**
1755-
* Email address that the receipt for the resulting payment will be sent to.
1755+
* Email address that the receipt for the resulting payment will be sent to. If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
17561756
*/
17571757
receipt_email?: string | null;
17581758

@@ -2317,7 +2317,7 @@ declare module 'stripe' {
23172317
list(options?: RequestOptions): ApiListPromise<Stripe.PaymentIntent>;
23182318

23192319
/**
2320-
* A PaymentIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action.
2320+
* A PaymentIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, or requires_action.
23212321
*
23222322
* Once canceled, no additional charges will be made by the PaymentIntent and any operations on the PaymentIntent will fail with an error. For PaymentIntents with status='requires_capture', the remaining amount_capturable will automatically be refunded.
23232323
*/

types/2020-03-02/SetupIntents.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ declare module 'stripe' {
748748
list(options?: RequestOptions): ApiListPromise<Stripe.SetupIntent>;
749749

750750
/**
751-
* A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action.
751+
* A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
752752
*
753753
* Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an error.
754754
*/

types/2020-03-02/SubscriptionItems.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ declare module 'stripe' {
124124
*
125125
* Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes).
126126
*
127-
* Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not create a subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
127+
* Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
128128
*/
129129
payment_behavior?: SubscriptionItemCreateParams.PaymentBehavior;
130130

@@ -267,7 +267,7 @@ declare module 'stripe' {
267267
*
268268
* Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes).
269269
*
270-
* Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not create a subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
270+
* Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
271271
*/
272272
payment_behavior?: SubscriptionItemUpdateParams.PaymentBehavior;
273273

@@ -487,7 +487,7 @@ declare module 'stripe' {
487487
): Promise<Stripe.UsageRecord>;
488488

489489
/**
490-
* For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the billing plan's month of September).
490+
* For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).
491491
*
492492
* The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn't ended yet. Since new usage records can still be added, the returned summary information for the subscription item's ID should be seen as unstable until the subscription billing period ends.
493493
*/

types/2020-03-02/Subscriptions.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ declare module 'stripe' {
100100
ended_at: number | null;
101101

102102
/**
103-
* List of subscription items, each with an attached plan.
103+
* List of subscription items, each with an attached price.
104104
*/
105105
items: ApiList<Stripe.SubscriptionItem>;
106106

@@ -371,7 +371,7 @@ declare module 'stripe' {
371371
expand?: Array<string>;
372372

373373
/**
374-
* A list of up to 20 subscription items, each with an attached plan.
374+
* A list of up to 20 subscription items, each with an attached price.
375375
*/
376376
items?: Array<SubscriptionCreateParams.Item>;
377377

@@ -694,7 +694,7 @@ declare module 'stripe' {
694694
expand?: Array<string>;
695695

696696
/**
697-
* List of subscription items, each with an attached plan.
697+
* A list of up to 20 subscription items, each with an attached price.
698698
*/
699699
items?: Array<SubscriptionUpdateParams.Item>;
700700

@@ -718,7 +718,7 @@ declare module 'stripe' {
718718
*
719719
* Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes).
720720
*
721-
* Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not create a subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
721+
* Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more.
722722
*/
723723
payment_behavior?: SubscriptionUpdateParams.PaymentBehavior;
724724

types/2020-03-02/TaxRates.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare module 'stripe' {
1515
object: 'tax_rate';
1616

1717
/**
18-
* Defaults to `true`. When set to `false`, this tax rate is considered archived and cannot be applied to new applications or Checkout Sessions, but will still be applied to subscriptions and invoices that already have it set.
18+
* Defaults to `true`. When set to `false`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.
1919
*/
2020
active: boolean;
2121

@@ -77,7 +77,7 @@ declare module 'stripe' {
7777
percentage: number;
7878

7979
/**
80-
* Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates continue to work where they are currently applied however they cannot be used for new applications or Checkout Sessions.
80+
* Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.
8181
*/
8282
active?: boolean;
8383

@@ -111,7 +111,7 @@ declare module 'stripe' {
111111

112112
interface TaxRateUpdateParams {
113113
/**
114-
* Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates continue to work where they are currently applied however they cannot be used for new applications or Checkout Sessions.
114+
* Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.
115115
*/
116116
active?: boolean;
117117

0 commit comments

Comments
 (0)