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 listing Checkout Session and passing tax rate information #819

Merged
merged 1 commit into from
Feb 24, 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
2 changes: 1 addition & 1 deletion lib/resources/Checkout/Sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ const StripeResource = require('../../StripeResource');
module.exports = StripeResource.extend({
path: 'checkout/sessions',

includeBasic: ['create', 'retrieve'],
includeBasic: ['create', 'list', 'retrieve'],
});
44 changes: 44 additions & 0 deletions types/2019-12-03/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ declare module 'stripe' {
* The quantity of the line item being purchased.
*/
quantity: number;

/**
* The tax rates which apply to this line item. This is only allowed in subscription mode.
*/
tax_rates?: Array<string>;
}

type Locale =
Expand Down Expand Up @@ -510,6 +515,13 @@ declare module 'stripe' {
*/
application_fee_percent?: number;

/**
* The tax rates that will apply to any subscription item that does not have
* `tax_rates` set. Invoices created will have their `default_tax_rates` populated
* from the subscription.
*/
default_tax_rates?: Array<string>;

/**
* A list of items, each with an attached plan, that the customer is subscribing to. Use this parameter for subscriptions. To create one-time payments, use `line_items`.
*/
Expand Down Expand Up @@ -552,6 +564,12 @@ declare module 'stripe' {
* Quantity for this item.
*/
quantity?: number;

/**
* The tax rates which apply to this item. When set, the `default_tax_rates`
* on `subscription_data` do not apply to this item.
*/
tax_rates?: Array<string>;
}
}
}
Expand All @@ -563,6 +581,23 @@ declare module 'stripe' {
expand?: Array<string>;
}

interface SessionListParams extends PaginationParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;

/**
* Only return the Checkout Session for the PaymentIntent specified.
*/
payment_intent?: string;

/**
* Only return the Checkout Session for the subscription specified.
*/
subscription?: string;
}

class SessionsResource {
/**
* Creates a Session object.
Expand All @@ -584,6 +619,15 @@ declare module 'stripe' {
id: string,
options?: RequestOptions
): Promise<Stripe.Checkout.Session>;

/**
* Returns a list of Checkout Sessions.
*/
list(
params?: SessionListParams,
options?: RequestOptions
): ApiListPromise<Stripe.Checkout.Session>;
list(options?: RequestOptions): ApiListPromise<Stripe.Checkout.Session>;
}
}
}
Expand Down