Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for amount_total, amount_subtotal, currency and total_details on Checkout Session #956

Merged
merged 1 commit into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 81 additions & 1 deletion types/2020-03-02/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ declare module 'stripe' {
*/
object: 'checkout.session';

/**
* Total of all items before discounts or taxes are applied.
*/
amount_subtotal: number | null;

/**
* Total of all items after discounts and taxes are applied.
*/
amount_total: number | null;

/**
* Describes whether Checkout should collect the customer's billing address.
*/
Expand All @@ -33,6 +43,11 @@ declare module 'stripe' {
*/
client_reference_id: string | null;

/**
* 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).
*/
currency: string | null;

/**
* The ID of the customer for this session.
* For Checkout Sessions in `payment` or `subscription` mode, Checkout
Expand Down Expand Up @@ -125,6 +140,11 @@ declare module 'stripe' {
* subscription creation is successful.
*/
success_url: string;

/**
* Tax and discount details for the computed total amount.
*/
total_details: Session.TotalDetails | null;
}

namespace Session {
Expand Down Expand Up @@ -506,6 +526,66 @@ declare module 'stripe' {
}

type SubmitType = 'auto' | 'book' | 'donate' | 'pay';

interface TotalDetails {
/**
* This is the sum of all the line item discounts.
*/
amount_discount: number;

/**
* This is the sum of all the line item tax amounts.
*/
amount_tax: number;

breakdown?: TotalDetails.Breakdown;
}

namespace TotalDetails {
interface Breakdown {
/**
* The aggregated line item discounts.
*/
discounts: Array<Breakdown.Discount>;

/**
* The aggregated line item tax amounts by rate.
*/
taxes: Array<Breakdown.Tax>;
}

namespace Breakdown {
interface Discount {
/**
* The amount discounted.
*/
amount: number;

/**
* A discount represents the actual application of a coupon to a particular
* customer. It contains information about when the discount began and when it
* will end.
*
* Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
*/
discount: Stripe.Discount;
}

interface Tax {
/**
* Amount of tax applied for this rate.
*/
amount: number;

/**
* 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.
*
* Related guide: [Tax Rates](https://stripe.com/docs/billing/taxes/tax-rates).
*/
rate: Stripe.TaxRate;
}
}
}
}

interface SessionCreateParams {
Expand Down Expand Up @@ -818,7 +898,7 @@ declare module 'stripe' {
on_behalf_of?: string;

/**
* Email address that the receipt for the resulting payment will be sent to.
* 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).
*/
receipt_email?: string;

Expand Down
2 changes: 1 addition & 1 deletion types/2020-03-02/InvoiceLineItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ declare module 'stripe' {
subscription_default_tax_rates?: Array<string> | null;

/**
* List of subscription items, each with an attached plan.
* A list of up to 20 subscription items, each with an attached price.
*/
subscription_items?: Array<
InvoiceLineItemListUpcomingParams.SubscriptionItem
Expand Down
2 changes: 1 addition & 1 deletion types/2020-03-02/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ declare module 'stripe' {
subscription_default_tax_rates?: Array<string> | null;

/**
* List of subscription items, each with an attached plan.
* A list of up to 20 subscription items, each with an attached price.
*/
subscription_items?: Array<
InvoiceRetrieveUpcomingParams.SubscriptionItem
Expand Down
4 changes: 2 additions & 2 deletions types/2020-03-02/LineItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ declare module 'stripe' {
namespace LineItem {
interface Discount {
/**
* Discount amount for this line item.
* The amount discounted.
*/
amount: number;

Expand All @@ -79,7 +79,7 @@ declare module 'stripe' {

interface Tax {
/**
* Amount of tax for this line item.
* Amount of tax applied for this rate.
*/
amount: number;

Expand Down
10 changes: 5 additions & 5 deletions types/2020-03-02/PaymentIntents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ declare module 'stripe' {
payment_method_types: Array<string>;

/**
* Email address that the receipt for the resulting payment will be sent to.
* 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).
*/
receipt_email: string | null;

Expand Down Expand Up @@ -606,7 +606,7 @@ declare module 'stripe' {
payment_method_types?: Array<string>;

/**
* Email address that the receipt for the resulting payment will be sent to.
* 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).
*/
receipt_email?: string;

Expand Down Expand Up @@ -1193,7 +1193,7 @@ declare module 'stripe' {
payment_method_types?: Array<string>;

/**
* Email address that the receipt for the resulting payment will be sent to.
* 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).
*/
receipt_email?: string | null;

Expand Down Expand Up @@ -1752,7 +1752,7 @@ declare module 'stripe' {
payment_method_options?: PaymentIntentConfirmParams.PaymentMethodOptions;

/**
* Email address that the receipt for the resulting payment will be sent to.
* 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).
*/
receipt_email?: string | null;

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

/**
* A PaymentIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action.
* A PaymentIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, or requires_action.
*
* 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.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/2020-03-02/SetupIntents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ declare module 'stripe' {
list(options?: RequestOptions): ApiListPromise<Stripe.SetupIntent>;

/**
* A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action.
* A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
*
* Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an error.
*/
Expand Down
6 changes: 3 additions & 3 deletions types/2020-03-02/SubscriptionItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ declare module 'stripe' {
*
* 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).
*
* 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.
* 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.
*/
payment_behavior?: SubscriptionItemCreateParams.PaymentBehavior;

Expand Down Expand Up @@ -267,7 +267,7 @@ declare module 'stripe' {
*
* 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).
*
* 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.
* 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.
*/
payment_behavior?: SubscriptionItemUpdateParams.PaymentBehavior;

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

/**
* 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).
* 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).
*
* 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.
*/
Expand Down
8 changes: 4 additions & 4 deletions types/2020-03-02/Subscriptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ declare module 'stripe' {
ended_at: number | null;

/**
* List of subscription items, each with an attached plan.
* List of subscription items, each with an attached price.
*/
items: ApiList<Stripe.SubscriptionItem>;

Expand Down Expand Up @@ -371,7 +371,7 @@ declare module 'stripe' {
expand?: Array<string>;

/**
* A list of up to 20 subscription items, each with an attached plan.
* A list of up to 20 subscription items, each with an attached price.
*/
items?: Array<SubscriptionCreateParams.Item>;

Expand Down Expand Up @@ -694,7 +694,7 @@ declare module 'stripe' {
expand?: Array<string>;

/**
* List of subscription items, each with an attached plan.
* A list of up to 20 subscription items, each with an attached price.
*/
items?: Array<SubscriptionUpdateParams.Item>;

Expand All @@ -718,7 +718,7 @@ declare module 'stripe' {
*
* 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).
*
* 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.
* 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.
*/
payment_behavior?: SubscriptionUpdateParams.PaymentBehavior;

Expand Down
6 changes: 3 additions & 3 deletions types/2020-03-02/TaxRates.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare module 'stripe' {
object: 'tax_rate';

/**
* 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.
* 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.
*/
active: boolean;

Expand Down Expand Up @@ -77,7 +77,7 @@ declare module 'stripe' {
percentage: number;

/**
* 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.
* 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.
*/
active?: boolean;

Expand Down Expand Up @@ -111,7 +111,7 @@ declare module 'stripe' {

interface TaxRateUpdateParams {
/**
* 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.
* 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.
*/
active?: boolean;

Expand Down