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

API Updates #1295

Merged
merged 4 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = {
Reviews: require('./resources/Reviews'),
SetupAttempts: require('./resources/SetupAttempts'),
SetupIntents: require('./resources/SetupIntents'),
ShippingRates: require('./resources/ShippingRates'),
Skus: require('./resources/SKUs'),
Sources: require('./resources/Sources'),
Subscriptions: require('./resources/Subscriptions'),
Expand Down
31 changes: 31 additions & 0 deletions lib/resources/ShippingRates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'shipping_rates',

create: stripeMethod({
method: 'POST',
path: '',
}),

retrieve: stripeMethod({
method: 'GET',
path: '/{shippingRateToken}',
}),

update: stripeMethod({
method: 'POST',
path: '/{shippingRateToken}',
}),

list: stripeMethod({
method: 'GET',
path: '',
methodType: 'list',
}),
});
4 changes: 2 additions & 2 deletions types/2020-08-27/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ declare module 'stripe' {
application_fee_amount?: number;

/**
* Whether to immediately capture the charge. Defaults to `true`. When `false`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https://stripe.com/docs/api#capture_charge) later. Uncaptured charges expire in _seven days_. For more information, see the [authorizing charges and settling later](https://stripe.com/docs/charges/placing-a-hold) documentation.
* Whether to immediately capture the charge. Defaults to `true`. When `false`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https://stripe.com/docs/api#capture_charge) later. Uncaptured charges expire after a set number of days (7 by default). For more information, see the [authorizing charges and settling later](https://stripe.com/docs/charges/placing-a-hold) documentation.
*/
capture?: boolean;

Expand Down Expand Up @@ -2018,7 +2018,7 @@ declare module 'stripe' {
/**
* Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you [created a charge](https://stripe.com/docs/api#create_charge) with the capture option set to false.
*
* Uncaptured payments expire exactly seven days after they are created. If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.
* Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.
*/
capture(
id: string,
Expand Down
142 changes: 141 additions & 1 deletion types/2020-08-27/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ declare module 'stripe' {
*/
shipping_address_collection: Session.ShippingAddressCollection | null;

/**
* The shipping rate options applied to this Session.
*/
shipping_options: Array<Session.ShippingOption>;

/**
* The ID of the ShippingRate for Checkout Sessions in `payment` mode.
*/
shipping_rate: string | Stripe.ShippingRate | null;

/**
* The status of the Checkout Session, one of `open`, `complete`, or `expired`.
*/
Expand Down Expand Up @@ -763,6 +773,18 @@ declare module 'stripe' {
| 'ZZ';
}

interface ShippingOption {
/**
* A non-negative integer in cents representing how much to charge.
*/
shipping_amount: number;

/**
* The shipping rate.
*/
shipping_rate: string | Stripe.ShippingRate;
}

type Status = 'complete' | 'expired' | 'open';

type SubmitType = 'auto' | 'book' | 'donate' | 'pay';
Expand Down Expand Up @@ -995,7 +1017,12 @@ declare module 'stripe' {
shipping_address_collection?: SessionCreateParams.ShippingAddressCollection;

/**
* The shipping rate to apply to this Session. Currently, only up to one may be specified.
* The shipping rate options to apply to this Session.
*/
shipping_options?: Array<SessionCreateParams.ShippingOption>;

/**
* [To be deprecated] The shipping rate to apply to this Session. Only up to one may be specified.
*/
shipping_rates?: Array<string>;

Expand Down Expand Up @@ -1849,6 +1876,119 @@ declare module 'stripe' {
| 'ZZ';
}

interface ShippingOption {
/**
* The ID of the Shipping Rate to use for this shipping option.
*/
shipping_rate?: string;

/**
* Parameters to be passed to Shipping Rate creation for this shipping option
*/
shipping_rate_data?: ShippingOption.ShippingRateData;
}

namespace ShippingOption {
interface ShippingRateData {
/**
* The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
*/
delivery_estimate?: ShippingRateData.DeliveryEstimate;

/**
* The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
*/
display_name: string;

/**
* Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`.
*/
fixed_amount?: ShippingRateData.FixedAmount;

/**
* 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`.
*/
metadata?: Stripe.MetadataParam;

/**
* Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
*/
tax_behavior?: ShippingRateData.TaxBehavior;

/**
* A [tax code](https://stripe.com/docs/tax/tax-codes) ID. The Shipping tax code is `txcd_92010001`.
*/
tax_code?: string;

/**
* The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now.
*/
type?: 'fixed_amount';
}

namespace ShippingRateData {
interface DeliveryEstimate {
/**
* The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
*/
maximum?: DeliveryEstimate.Maximum;

/**
* The lower bound of the estimated range. If empty, represents no lower bound.
*/
minimum?: DeliveryEstimate.Minimum;
}

namespace DeliveryEstimate {
interface Maximum {
/**
* A unit of time.
*/
unit: Maximum.Unit;

/**
* Must be greater than 0.
*/
value: number;
}

namespace Maximum {
type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
}

interface Minimum {
/**
* A unit of time.
*/
unit: Minimum.Unit;

/**
* Must be greater than 0.
*/
value: number;
}

namespace Minimum {
type Unit = 'business_day' | 'day' | 'hour' | 'month' | 'week';
}
}

interface FixedAmount {
/**
* A non-negative integer in cents representing how much to charge.
*/
amount: number;

/**
* 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;
}

type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
}
}

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

interface SubscriptionData {
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/PaymentIntents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3793,7 +3793,7 @@ declare module 'stripe' {
/**
* Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
*
* Uncaptured PaymentIntents will be canceled exactly seven days after they are created.
* Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by default).
*
* Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
*/
Expand Down
Loading