diff --git a/README.md b/README.md index 666d3e9207..c41c213bc1 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,11 @@ The Stripe Node library provides convenient access to the Stripe API from applications written in server-side JavaScript. -Please keep in mind that this package is for use with server-side Node that -uses Stripe secret keys. To maintain PCI compliance, tokenization of credit -card information should always be done with [Stripe.js][stripe-js] on the -client side. This package should not be used for that purpose. +For collecting customer and payment information in the browser, use [Stripe.js][stripe-js]. ## Documentation -See the [`stripe-node` API docs](https://stripe.com/docs/api/node#intro) for Node.js. +See the [`stripe-node` API docs](https://stripe.com/docs/api?lang=node) for Node.js. ## Installation @@ -24,6 +21,8 @@ Install the package with: ```sh npm install stripe --save +# or +yarn add stripe ``` ## Usage @@ -32,73 +31,83 @@ The package needs to be configured with your account's secret key which is available in your [Stripe Dashboard][api-keys]. Require it with the key's value: + ```js const stripe = require('stripe')('sk_test_...'); -const customer = await stripe.customers.create({ +stripe.customers.create({ email: 'customer@example.com', -}); +}) + .then(customer => console.log(customer.id)) + .catch(error => console.error(error)); ``` -Or using ES modules, this looks more like: +Or using ES modules and `async`/`await`: ```js import Stripe from 'stripe'; -const stripe = Stripe('sk_test_...'); -//… +const stripe = new Stripe('sk_test_...'); + +(async () => { + const customer = await stripe.customers.create({ + email: 'customer@example.com', + }); + + console.log(customer.id); +})(); ``` -## Initialize with config object +### Usage with TypeScript -The package can be initialized with several options: +As of 8.0.0, Stripe maintains types for the latest [API version][api-versions]. -```js -import ProxyAgent from 'https-proxy-agent'; +Import Stripe as a default import (not `* as Stripe`, unlike the DefinitelyTyped version) +and instantiate it as `new Stripe()` with the latest API version. -const stripe = Stripe('sk_test_...', { - apiVersion: '2019-08-08', - maxNetworkRetries: 1, - httpAgent: new ProxyAgent(process.env.http_proxy), - timeout: 1000, - host: 'api.example.com', - port: 123, - telemetry: true, +```ts +import Stripe from 'stripe'; +const stripe = new Stripe('sk_test_...', { + apiVersion: '2019-12-03', + typescript: true, }); -``` -| Option | Default | Description | -| ------------------- | ----------------------------- | ------------------------------------------------------------------------------------- | -| `apiVersion` | `null` | Stripe API version to be used. If not set the account's default version will be used. | -| `maxNetworkRetries` | 0 | The amount of times a request should be [retried](#network-retries). | -| `httpAgent` | `null` | [Proxy](#configuring-a-proxy) agent to be used by the library. | -| `timeout` | 120000 (Node default timeout) | [Maximum time each request can take in ms.](#configuring-timeout) | -| `host` | `'api.stripe.com'` | Host that requests are made to. | -| `port` | 443 | Port that requests are made to. | -| `telemetry` | `true` | Allow Stripe to send latency [telemetry](#request-latency-telemetry) | +const createCustomer = async () => { + const params: Stripe.CustomerCreateParams = { + description: 'test customer', + }; -Note: Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis. `timeout` can be updated at any time with [`stripe.setTimeout`](#configuring-timeout). + const customer: Stripe.Customer = await stripe.customers.create(params); -### Usage with TypeScript + console.log(customer.id); +}; +createCustomer(); +``` -Stripe does not currently maintain typings for this package, but there are -community typings available from DefinitelyTyped. +#### Using old API versions with TypeScript -To install: +Types can change between API versions (eg; Stripe may have changed a field from a string to a hash), +so our types only reflect the latest API version. -```sh -npm install --dev @types/stripe -``` +We therefore encourage [upgrading your API version][api-version-upgrading] +if you would like to take advantage of Stripe's TypeScript definitions. -To use: +If you are on an older API version (eg; `2019-10-17`) and not able to upgrade, +you may pass another version or `apiVersion: null` to use your account's default API version, +and use a comment like `// @ts-ignore stripe-version-2019-10-17` to silence type errors here +and anywhere the types differ between your API version and the latest. +When you upgrade, you should remove these comments. -```ts -// Note `* as` and `new Stripe` for TypeScript: -import * as Stripe from 'stripe'; -const stripe = new Stripe('sk_test_...'); +#### Using `expand` with TypeScript -const customer: Promise< - Stripe.customers.ICustomer -> = stripe.customers.create(/* ... */); +[Expandable][expanding_objects] fields are typed as `string | Foo`, +so you must cast them appropriately, eg; + +```ts +const charge: Stripe.Charge = await stripe.charges.retrieve('ch_123', { + expand: ['customer'], +}); +const customerEmail: string = (charge.customer as Stripe.Customer).email; +const btId: string = charge.balance_transaction as string; ``` ### Using Promises @@ -132,23 +141,49 @@ stripe.customers }); ``` -### Configuring Timeout +## Configuration + +### Initialize with config object -Request timeout is configurable (the default is Node's default of 120 seconds): +The package can be initialized with several options: ```js -stripe.setTimeout(20000); // in ms (this is 20 seconds) +import ProxyAgent from 'https-proxy-agent'; + +const stripe = Stripe('sk_test_...', { + apiVersion: '2019-08-08', + maxNetworkRetries: 1, + httpAgent: new ProxyAgent(process.env.http_proxy), + timeout: 1000, + host: 'api.example.com', + port: 123, + telemetry: true, +}); ``` -Timeout can also be set globally via the config object: +| Option | Default | Description | +| ------------------- | ----------------------------- | ------------------------------------------------------------------------------------- | +| `apiVersion` | `null` | Stripe API version to be used. If not set the account's default version will be used. | +| `maxNetworkRetries` | 0 | The amount of times a request should be [retried](#network-retries). | +| `httpAgent` | `null` | [Proxy](#configuring-a-proxy) agent to be used by the library. | +| `timeout` | 120000 (Node default timeout) | [Maximum time each request can take in ms.](#configuring-timeout) | +| `host` | `'api.stripe.com'` | Host that requests are made to. | +| `port` | 443 | Port that requests are made to. | +| `telemetry` | `true` | Allow Stripe to send latency [telemetry](#request-latency-telemetry) | + +Note: Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis. + +### Configuring Timeout + +Timeout can be set globally via the config object: ```js const stripe = Stripe('sk_test_...', { - timeout: 2000, + timeout: 20 * 1000, // 20 seconds }); ``` -And on a per-request basis: +And overridden on a per-request basis: ```js stripe.customers.create( @@ -156,38 +191,31 @@ stripe.customers.create( email: 'customer@example.com', }, { - timeout: 1000, + timeout: 1000, // 1 second } ); ``` -If `timeout` is set globally via the config object, the value set in a per-request basis will be favored. - ### Configuring For Connect A per-request `Stripe-Account` header for use with [Stripe Connect][connect] can be added to any method: ```js -// Retrieve the balance for a connected account: -stripe.balance - .retrieve({ +// List the balance transactions for a connected account: +stripe.balanceTransactions.list( + { + limit: 10, + }, + { stripeAccount: 'acct_foo', - }) - .then((balance) => { - // The balance object for the connected account - }) - .catch((err) => { - // Error - }); + } +); ``` ### Configuring a Proxy -An [https-proxy-agent][https-proxy-agent] can be configured with -`setHttpAgent`. - -To use stripe behind a proxy you can pass to sdk on initialization: +To use stripe behind a proxy you can pass an [https-proxy-agent][https-proxy-agent] on initialization: ```js if (process.env.http_proxy) { @@ -338,7 +366,6 @@ This information is passed along when the library makes calls to the Stripe API. ### Auto-pagination -As of stripe-node 6.11.0, you may auto-paginate list methods. We provide a few different APIs for this to aid with a variety of node versions and styles. #### Async iterators (`for-await-of`) @@ -389,32 +416,6 @@ stripe.customers .catch(handleError); ``` -If you prefer callbacks to promises, you may also use a `next` callback and a second `onDone` callback: - -```js -stripe.customers.list().autoPagingEach( - function onItem(customer, next) { - doSomething(customer, function(err, result) { - if (shouldStop(result)) { - next(false); // Passing `false` breaks out of the loop. - } else { - next(); - } - }); - }, - function onDone(err) { - if (err) { - console.error(err); - } else { - console.log('Done iterating.'); - } - } -); -``` - -If your `onItem` function does not accept a `next` callback parameter _or_ return a Promise, -the return value is used to decide whether to continue (`false` breaks, anything else continues). - #### `autoPagingToArray` This is a convenience for cases where you expect the number of items @@ -437,7 +438,9 @@ numbers help Stripe improve the overall latency of its API for all users. You can disable this behavior if you prefer: ```js -stripe.setTelemetryEnabled(false); +const stripe = new Stripe('sk_test_...', { + telemetry: false, +}); ``` ## More Information @@ -487,7 +490,10 @@ $ yarn fix ``` [api-keys]: https://dashboard.stripe.com/account/apikeys +[api-versions]: https://stripe.com/docs/api/versioning +[api-version-upgrading]: https://stripe.com/docs/upgrades#how-can-i-upgrade-my-api [connect]: https://stripe.com/connect +[expanding_objects]: https://stripe.com/docs/api/expanding_objects [https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent [stripe-js]: https://stripe.com/docs/stripe.js diff --git a/lib/resources/Accounts.js b/lib/resources/Accounts.js index af743d3033..7b405c8a2d 100644 --- a/lib/resources/Accounts.js +++ b/lib/resources/Accounts.js @@ -7,31 +7,25 @@ const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: '', - reject: stripeMethod({ - method: 'POST', - path: 'accounts/{account}/reject', - }), - create: stripeMethod({ method: 'POST', path: 'accounts', }), + del: stripeMethod({ + method: 'DELETE', + path: 'accounts/{account}', + }), + list: stripeMethod({ method: 'GET', path: 'accounts', methodType: 'list', }), - update: stripeMethod({ + reject: stripeMethod({ method: 'POST', - path: 'accounts/{id}', - }), - - // Avoid 'delete' keyword in JS - del: stripeMethod({ - method: 'DELETE', - path: 'accounts/{id}', + path: 'accounts/{account}/reject', }), retrieve(id) { @@ -54,9 +48,9 @@ module.exports = StripeResource.extend({ } }, - createLoginLink: stripeMethod({ + update: stripeMethod({ method: 'POST', - path: 'accounts/{account}/login_links', + path: 'accounts/{account}', }), listCapabilities: stripeMethod({ @@ -101,6 +95,11 @@ module.exports = StripeResource.extend({ path: 'accounts/{account}/external_accounts/{id}', }), + createLoginLink: stripeMethod({ + method: 'POST', + path: 'accounts/{account}/login_links', + }), + createPerson: stripeMethod({ method: 'POST', path: 'accounts/{account}/persons', diff --git a/lib/resources/Balance.js b/lib/resources/Balance.js index cdb30b26a5..6d68c66b31 100644 --- a/lib/resources/Balance.js +++ b/lib/resources/Balance.js @@ -8,5 +8,6 @@ module.exports = StripeResource.extend({ retrieve: stripeMethod({ method: 'GET', + path: '', }), }); diff --git a/lib/resources/Customers.js b/lib/resources/Customers.js index e4537002dc..a43741cae6 100644 --- a/lib/resources/Customers.js +++ b/lib/resources/Customers.js @@ -13,21 +13,6 @@ module.exports = StripeResource.extend({ path: '/{customer}/discount', }), - updateSource: stripeMethod({ - method: 'POST', - path: '/{customer}/sources/{id}', - }), - - deleteSource: stripeMethod({ - method: 'DELETE', - path: '/{customer}/sources/{id}', - }), - - verifySource: stripeMethod({ - method: 'POST', - path: '/{customer}/sources/{sourceId}/verify', - }), - createBalanceTransaction: stripeMethod({ method: 'POST', path: '/{customer}/balance_transactions', @@ -54,6 +39,11 @@ module.exports = StripeResource.extend({ path: '/{customer}/sources', }), + deleteSource: stripeMethod({ + method: 'DELETE', + path: '/{customer}/sources/{id}', + }), + listSources: stripeMethod({ method: 'GET', path: '/{customer}/sources', @@ -65,6 +55,16 @@ module.exports = StripeResource.extend({ path: '/{customer}/sources/{id}', }), + updateSource: stripeMethod({ + method: 'POST', + path: '/{customer}/sources/{id}', + }), + + verifySource: stripeMethod({ + method: 'POST', + path: '/{customer}/sources/{id}/verify', + }), + createTaxId: stripeMethod({ method: 'POST', path: '/{customer}/tax_ids', diff --git a/lib/resources/EphemeralKeys.js b/lib/resources/EphemeralKeys.js index fe9d7d5bb8..62a2ecc281 100644 --- a/lib/resources/EphemeralKeys.js +++ b/lib/resources/EphemeralKeys.js @@ -10,6 +10,7 @@ module.exports = StripeResource.extend({ create: stripeMethod({ method: 'POST', + path: '', validator: (data, options) => { if (!options.headers || !options.headers['Stripe-Version']) { throw new Error( diff --git a/lib/resources/Files.js b/lib/resources/Files.js index eea7ffa509..37e5a8697f 100644 --- a/lib/resources/Files.js +++ b/lib/resources/Files.js @@ -9,8 +9,6 @@ module.exports = StripeResource.extend({ includeBasic: ['list', 'retrieve'], - requestDataProcessor: multipartRequestDataProcessor, - create: stripeMethod({ method: 'POST', headers: { @@ -18,4 +16,6 @@ module.exports = StripeResource.extend({ }, host: 'files.stripe.com', }), + + requestDataProcessor: multipartRequestDataProcessor, }); diff --git a/lib/resources/Invoices.js b/lib/resources/Invoices.js index 9209823efc..d958d07b4d 100644 --- a/lib/resources/Invoices.js +++ b/lib/resources/Invoices.js @@ -23,6 +23,11 @@ module.exports = StripeResource.extend({ path: '/{invoice}/pay', }), + retrieveUpcoming: stripeMethod({ + method: 'GET', + path: '/upcoming', + }), + sendInvoice: stripeMethod({ method: 'POST', path: '/{invoice}/send', @@ -33,20 +38,15 @@ module.exports = StripeResource.extend({ path: '/{invoice}/void', }), - listUpcomingLineItems: stripeMethod({ + listLineItems: stripeMethod({ method: 'GET', - path: 'upcoming/lines', + path: '/{invoice}/lines', methodType: 'list', }), - retrieveUpcoming: stripeMethod({ - method: 'GET', - path: 'upcoming', - }), - - listLineItems: stripeMethod({ + listUpcomingLineItems: stripeMethod({ method: 'GET', - path: '/{invoice}/lines', + path: '/upcoming/lines', methodType: 'list', }), }); diff --git a/lib/resources/Sources.js b/lib/resources/Sources.js index 0f2a3c732c..64c252c869 100644 --- a/lib/resources/Sources.js +++ b/lib/resources/Sources.js @@ -8,14 +8,14 @@ module.exports = StripeResource.extend({ includeBasic: ['create', 'retrieve', 'update'], - verify: stripeMethod({ - method: 'POST', - path: '/{source}/verify', - }), - listSourceTransactions: stripeMethod({ method: 'GET', path: '/{source}/source_transactions', methodType: 'list', }), + + verify: stripeMethod({ + method: 'POST', + path: '/{source}/verify', + }), }); diff --git a/lib/resources/Subscriptions.js b/lib/resources/Subscriptions.js index a72ebe447f..11edc64490 100644 --- a/lib/resources/Subscriptions.js +++ b/lib/resources/Subscriptions.js @@ -6,7 +6,7 @@ const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'subscriptions', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], deleteDiscount: stripeMethod({ method: 'DELETE', diff --git a/lib/stripe.js b/lib/stripe.js index d698094a88..bedae7ecc3 100644 --- a/lib/stripe.js +++ b/lib/stripe.js @@ -19,6 +19,7 @@ Stripe.USER_AGENT = { platform: process.platform, publisher: 'stripe', uname: null, + typescript: false, }; Stripe.USER_AGENT_SERIALIZED = null; @@ -29,6 +30,7 @@ Stripe.INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5; const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; const ALLOWED_CONFIG_PROPERTIES = [ 'apiVersion', + 'typescript', 'maxNetworkRetries', 'httpAgent', 'timeout', @@ -81,6 +83,16 @@ function Stripe(key, config = {}) { dev: false, }; + const typescript = props.typescript || false; + if (typescript !== Stripe.USER_AGENT.typescript) { + // The mutation here is uncomfortable, but likely fastest; + // seralizing the user agent involves shelling out to the system, + // and given some users may instantiate the library many times without switching between TS and non-TS, + // we only want to incur the performance hit when that actually happens. + Stripe.USER_AGENT_SERIALIZED = null; + Stripe.USER_AGENT.typescript = typescript; + } + this._prepResources(); this.setApiKey(key); @@ -341,5 +353,10 @@ Stripe.prototype = { }; module.exports = Stripe; + // expose constructor as a named property to enable mocking with Sinon.JS module.exports.Stripe = Stripe; + +// Allow use with the TypeScript compiler without `esModuleInterop`. +// We may also want to add `Object.defineProperty(exports, "__esModule", {value: true});` in the future, so that Babel users will use the `default` version. +module.exports.default = Stripe; diff --git a/package.json b/package.json index e226041628..b07a4d70ca 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,14 @@ "node": "^8.1 || >=10.*" }, "main": "lib/stripe.js", + "types": "types/2019-12-03/index.d.ts", "devDependencies": { + "@typescript-eslint/eslint-plugin": "^2.13.0", + "@typescript-eslint/parser": "^2.13.0", "chai": "~4.2.0", "chai-as-promised": "~7.1.1", "coveralls": "^3.0.0", - "eslint": "^5.16.0", + "eslint": "^6.8.0", "eslint-config-prettier": "^4.1.0", "eslint-plugin-chai-friendly": "^0.4.0", "eslint-plugin-prettier": "^3.0.1", @@ -37,9 +40,11 @@ "mocha-junit-reporter": "^1.23.1", "nock": "^10.0.6", "nyc": "^14.1.0", - "prettier": "^1.16.4" + "prettier": "^1.16.4", + "typescript": "^3.7.2" }, "dependencies": { + "@types/node": "^13.1.0", "qs": "^6.6.0" }, "license": "MIT", @@ -47,8 +52,9 @@ "clean": "rm -rf ./.nyc_output ./node_modules/.cache ./coverage", "mocha": "nyc mocha", "mocha-only": "mocha", - "test": "npm run lint && npm run mocha", - "lint": "eslint --ext .js,.jsx .", + "test": "yarn lint && yarn test-typescript && yarn mocha", + "test-typescript": "tsc --build types/test", + "lint": "eslint --ext .js,.jsx,.ts .", "fix": "yarn lint --fix", "report": "nyc -r text -r lcov report", "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" diff --git a/test/stripe.spec.js b/test/stripe.spec.js index ac7acc142e..9ee809743a 100644 --- a/test/stripe.spec.js +++ b/test/stripe.spec.js @@ -119,6 +119,32 @@ describe('Stripe Module', function() { }); }) ).to.eventually.have.property('lang', 'node')); + + it('Should include whether typescript: true was passed, respecting reinstantiations', () => { + return new Promise((resolve) => resolve()) + .then(() => { + const stripe = new Stripe('sk_test_123', { + typescript: true, + }); + return expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgent((c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('typescript', 'true'); + }) + .then(() => { + const stripe = new Stripe('sk_test_123', {}); + return expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgent((c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('typescript', 'false'); + }); + }); }); describe('GetClientUserAgentSeeded', () => { diff --git a/types/.eslintrc.js b/types/.eslintrc.js new file mode 100644 index 0000000000..788ac02227 --- /dev/null +++ b/types/.eslintrc.js @@ -0,0 +1,18 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint', 'prettier'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + ], + rules: { + '@typescript-eslint/no-use-before-define': 0, + '@typescript-eslint/no-empty-interface': 0, + '@typescript-eslint/no-unused-vars': 0, + '@typescript-eslint/triple-slash-reference': 0, + '@typescript-eslint/ban-ts-ignore': 0, + }, +}; diff --git a/types/2019-12-03/AccountLinks.d.ts b/types/2019-12-03/AccountLinks.d.ts new file mode 100644 index 0000000000..1e3a412072 --- /dev/null +++ b/types/2019-12-03/AccountLinks.d.ts @@ -0,0 +1,74 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The AccountLink object. + */ + interface AccountLink { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'account_link'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The timestamp at which this account link will expire. + */ + expires_at: number; + + /** + * The URL for the account link. + */ + url: string; + } + + interface AccountLinkCreateParams { + /** + * The identifier of the account to create an account link for. + */ + account: string; + + /** + * The URL that the user will be redirected to if the account link is no longer valid. + */ + failure_url: string; + + /** + * The URL that the user will be redirected to upon leaving or completing the linked flow successfully. + */ + success_url: string; + + /** + * The type of account link the user is requesting. Possible values are `custom_account_verification` or `custom_account_update`. + */ + type: string; + + /** + * Which information the platform needs to collect from the user. One of `currently_due` or `eventually_due`. Default is `currently_due`. + */ + collect?: AccountLinkCreateParams.Collect; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace AccountLinkCreateParams { + type Collect = 'currently_due' | 'eventually_due'; + } + + class AccountLinksResource { + /** + * Creates an AccountLink object that returns a single-use Stripe URL that the user can redirect their user to in order to take them through the Connect Onboarding flow. + */ + create( + params: AccountLinkCreateParams, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/Accounts.d.ts b/types/2019-12-03/Accounts.d.ts new file mode 100644 index 0000000000..1b352196b8 --- /dev/null +++ b/types/2019-12-03/Accounts.d.ts @@ -0,0 +1,1991 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Account object. + */ + interface Account { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'account'; + + /** + * Optional information related to the business. + */ + business_profile: Account.BusinessProfile | null; + + /** + * The business type. + */ + business_type: Account.BusinessType | null; + + capabilities?: Account.Capabilities; + + /** + * Whether the account can create live charges. + */ + charges_enabled: boolean; + + company?: Account.Company; + + /** + * The account's country. + */ + country: string; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created?: number; + + /** + * Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). + */ + default_currency: string; + + deleted?: void; + + /** + * Whether account details have been submitted. Standard accounts cannot receive payouts before this is true. + */ + details_submitted: boolean; + + /** + * The primary user's email address. + */ + email: string | null; + + /** + * External accounts (bank accounts and debit cards) currently attached to this account + */ + external_accounts?: ApiList; + + individual?: Person; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: Metadata; + + /** + * Whether Stripe can send payouts to this account. + */ + payouts_enabled: boolean; + + requirements?: Account.Requirements; + + /** + * Options for customizing how the account functions within Stripe. + */ + settings: Account.Settings | null; + + tos_acceptance?: Account.TosAcceptance; + + /** + * The Stripe account type. Can be `standard`, `express`, or `custom`. + */ + type: Account.Type; + } + + namespace Account { + interface BusinessProfile { + /** + * The merchant category code for the account. MCCs are used to classify businesses based on the goods or services they provide. + */ + mcc: string | null; + + /** + * The customer-facing business name. + */ + name: string | null; + + /** + * Internal-only description of the product sold or service provided by the business. It's used by Stripe for risk and underwriting purposes. + */ + product_description?: string | null; + + /** + * A publicly available mailing address for sending support issues to. + */ + support_address: Address | null; + + /** + * A publicly available email address for sending support issues to. + */ + support_email: string | null; + + /** + * A publicly available phone number to call with support issues. + */ + support_phone: string | null; + + /** + * A publicly available website for handling support issues. + */ + support_url: string | null; + + /** + * The business's publicly available website. + */ + url: string | null; + } + + type BusinessType = 'company' | 'individual'; + + interface Capabilities { + /** + * The status of the card issuing capability of the account, or whether you can use Issuing to distribute funds on cards + */ + card_issuing?: Capabilities.CardIssuing; + + /** + * The status of the card payments capability of the account, or whether the account can directly process credit and debit card charges. + */ + card_payments?: Capabilities.CardPayments; + + /** + * The status of the legacy payments capability of the account. + */ + legacy_payments?: Capabilities.LegacyPayments; + + /** + * The status of the transfers capability of the account, or whether your platform can transfer funds to the account. + */ + transfers?: Capabilities.Transfers; + } + + namespace Capabilities { + type CardIssuing = 'active' | 'inactive' | 'pending'; + + type CardPayments = 'active' | 'inactive' | 'pending'; + + type LegacyPayments = 'active' | 'inactive' | 'pending'; + + type Transfers = 'active' | 'inactive' | 'pending'; + } + + interface Company { + address?: Address; + + /** + * The Kana variation of the company's primary address (Japan only). + */ + address_kana?: Company.AddressKana | null; + + /** + * The Kanji variation of the company's primary address (Japan only). + */ + address_kanji?: Company.AddressKanji | null; + + /** + * Whether the company's directors have been provided. This Boolean will be `true` if you've manually indicated that all directors are provided via [the `directors_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-directors_provided). + */ + directors_provided?: boolean; + + /** + * Whether the company's executives have been provided. This Boolean will be `true` if you've manually indicated that all executives are provided via [the `executives_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-executives_provided), or if Stripe determined that sufficient executives were provided. + */ + executives_provided?: boolean; + + /** + * The company's legal name. + */ + name: string | null; + + /** + * The Kana variation of the company's legal name (Japan only). + */ + name_kana?: string | null; + + /** + * The Kanji variation of the company's legal name (Japan only). + */ + name_kanji?: string | null; + + /** + * Whether the company's owners have been provided. This Boolean will be `true` if you've manually indicated that all owners are provided via [the `owners_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-owners_provided), or if Stripe determined that sufficient owners were provided. Stripe determines ownership requirements using both the number of owners provided and their total percent ownership (calculated by adding the `percent_ownership` of each owner together). + */ + owners_provided?: boolean; + + /** + * The company's phone number (used for verification). + */ + phone?: string | null; + + /** + * Whether the company's business ID number was provided. + */ + tax_id_provided?: boolean; + + /** + * The jurisdiction in which the `tax_id` is registered (Germany-based companies only). + */ + tax_id_registrar?: string; + + /** + * Whether the company's business VAT number was provided. + */ + vat_id_provided?: boolean; + + /** + * Information on the verification state of the company. + */ + verification?: Company.Verification | null; + } + + namespace Company { + interface AddressKana { + /** + * City/Ward. + */ + city: string | null; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string | null; + + /** + * Block/Building number. + */ + line1: string | null; + + /** + * Building details. + */ + line2: string | null; + + /** + * Zip/Postal Code. + */ + postal_code: string | null; + + /** + * Prefecture. + */ + state: string | null; + + /** + * Town/cho-me. + */ + town: string | null; + } + + interface AddressKanji { + /** + * City/Ward. + */ + city: string | null; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string | null; + + /** + * Block/Building number. + */ + line1: string | null; + + /** + * Building details. + */ + line2: string | null; + + /** + * Zip/Postal Code. + */ + postal_code: string | null; + + /** + * Prefecture. + */ + state: string | null; + + /** + * Town/cho-me. + */ + town: string | null; + } + + interface Verification { + document: Verification.Document; + } + + namespace Verification { + interface Document { + /** + * The back of a document returned by a [file upload](#create_file) with a `purpose` value of `additional_verification`. + */ + back: string | File | null; + + /** + * A user-displayable string describing the verification state of this document. + */ + details: string | null; + + /** + * One of `document_corrupt`, `document_expired`, `document_failed_copy`, `document_failed_greyscale`, `document_failed_other`, `document_failed_test_mode`, `document_fraudulent`, `document_incomplete`, `document_invalid`, `document_manipulated`, `document_not_readable`, `document_not_uploaded`, `document_type_not_supported`, or `document_too_large`. A machine-readable code specifying the verification state for this document. + */ + details_code: string | null; + + /** + * The front of a document returned by a [file upload](#create_file) with a `purpose` value of `additional_verification`. + */ + front: string | File | null; + } + } + } + + interface Requirements { + /** + * The date the fields in `currently_due` must be collected by to keep payouts enabled for the account. These fields might block payouts sooner if the next threshold is reached before these fields are collected. + */ + current_deadline: number | null; + + /** + * The fields that need to be collected to keep the account enabled. If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + */ + currently_due: Array | null; + + /** + * If the account is disabled, this string describes why the account can't create charges or receive payouts. Can be `requirements.past_due`, `requirements.pending_verification`, `rejected.fraud`, `rejected.terms_of_service`, `rejected.listed`, `rejected.other`, `listed`, `under_review`, or `other`. + */ + disabled_reason: string | null; + + /** + * The fields that need to be collected assuming all volume thresholds are reached. As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set. + */ + eventually_due: Array | null; + + /** + * The fields that weren't collected by the `current_deadline`. These fields need to be collected to re-enable the account. + */ + past_due: Array | null; + + /** + * Fields that may become required depending on the results of verification or review. An empty array unless an asynchronous verification is pending. If verification fails, the fields in this array become required and move to `currently_due` or `past_due`. + */ + pending_verification: Array | null; + } + + interface Settings { + branding: Settings.Branding; + + card_payments: Settings.CardPayments; + + dashboard: Settings.Dashboard; + + payments: Settings.Payments; + + payouts?: Settings.Payouts; + } + + namespace Settings { + interface Branding { + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px. + */ + icon: string | File | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for the account that will be used in Checkout instead of the icon and without the account's name next to it if provided. Must be at least 128px x 128px. + */ + logo: string | File | null; + + /** + * A CSS hex color value representing the primary branding color for this account + */ + primary_color: string | null; + } + + interface CardPayments { + decline_on?: CardPayments.DeclineOn; + + /** + * The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. + */ + statement_descriptor_prefix: string | null; + } + + namespace CardPayments { + interface DeclineOn { + /** + * Whether Stripe automatically declines charges with an incorrect ZIP or postal code. This setting only applies when a ZIP or postal code is provided and they fail bank verification. + */ + avs_failure: boolean; + + /** + * Whether Stripe automatically declines charges with an incorrect CVC. This setting only applies when a CVC is provided and it fails bank verification. + */ + cvc_failure: boolean; + } + } + + interface Dashboard { + /** + * The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts. + */ + display_name: string | null; + + /** + * The timezone used in the Stripe Dashboard for this account. A list of possible time zone values is maintained at the [IANA Time Zone Database](http://www.iana.org/time-zones). + */ + timezone: string | null; + } + + interface Payments { + /** + * The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. + */ + statement_descriptor: string | null; + + /** + * The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only) + */ + statement_descriptor_kana: string | null; + + /** + * The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only) + */ + statement_descriptor_kanji: string | null; + } + + interface Payouts { + /** + * A Boolean indicating if Stripe should try to reclaim negative balances from an attached bank account. See our [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances) documentation for details. Default value is `true` for Express accounts and `false` for Custom accounts. + */ + debit_negative_balances: boolean; + + schedule: Payouts.Schedule; + + /** + * The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + */ + statement_descriptor: string | null; + } + + namespace Payouts { + interface Schedule { + /** + * The number of days charges for the account will be held before being paid out. + */ + delay_days: number; + + /** + * How frequently funds will be paid out. One of `manual` (payouts only created via API call), `daily`, `weekly`, or `monthly`. + */ + interval: string; + + /** + * The day of the month funds will be paid out. Only shown if `interval` is monthly. Payouts scheduled between the 29th and 31st of the month are sent on the last day of shorter months. + */ + monthly_anchor?: number; + + /** + * The day of the week funds will be paid out, of the style 'monday', 'tuesday', etc. Only shown if `interval` is weekly. + */ + weekly_anchor?: string; + } + } + } + + interface TosAcceptance { + /** + * The Unix timestamp marking when the Stripe Services Agreement was accepted by the account representative + */ + date: number | null; + + /** + * The IP address from which the Stripe Services Agreement was accepted by the account representative + */ + ip: string | null; + + /** + * The user agent of the browser from which the Stripe Services Agreement was accepted by the account representative + */ + user_agent: string | null; + } + + type Type = 'custom' | 'express' | 'standard'; + } + + /** + * The DeletedAccount object. + */ + interface DeletedAccount { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'account'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface AccountCreateParams { + /** + * An [account token](https://stripe.com/docs/api#create_account_token), used to securely provide details to the account. + */ + account_token?: string; + + /** + * Non-essential business information about the account + */ + business_profile?: AccountCreateParams.BusinessProfile; + + /** + * The business type. + */ + business_type?: AccountCreateParams.BusinessType; + + /** + * Information about the company or business. This field is null unless `business_type` is set to `company`. + */ + company?: AccountCreateParams.Company; + + /** + * The country in which the account holder resides, or in which the business is legally established. This should be an ISO 3166-1 alpha-2 country code. For example, if you are in the United States and the business for which you're creating an account is legally represented in Canada, you would use `CA` as the country for the account being created. + */ + country?: string; + + /** + * Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). + */ + default_currency?: string; + + /** + * The email address of the account holder. For Custom accounts, this is only to make the account easier to identify to you: Stripe will never directly email your users. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A card or bank account to attach to the account. You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe.js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. + * + * By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. To add additional external accounts without replacing the existing default for the currency, use the bank account or card creation API. + */ + external_account?: string; + + /** + * Information about the person represented by the account. This field is null unless `business_type` is set to `individual`. + */ + individual?: AccountCreateParams.Individual; + + /** + * A set of key-value pairs that you can attach to an `Account` object. This can be useful for storing additional information about the account in a structured format. + */ + metadata?: MetadataParam; + + /** + * The set of capabilities you want to unlock for this account. Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. An account may have some of its requested capabilities be active and some be inactive. + */ + requested_capabilities?: Array; + + /** + * Options for customizing how the account functions within Stripe. + */ + settings?: AccountCreateParams.Settings; + + /** + * Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). + */ + tos_acceptance?: AccountCreateParams.TosAcceptance; + + /** + * The type of Stripe account to create. Currently must be `custom`, as only [Custom accounts](https://stripe.com/docs/connect/custom-accounts) may be created via the API. + */ + type?: AccountCreateParams.Type; + } + + namespace AccountCreateParams { + interface BusinessProfile { + /** + * The merchant category code for the account. MCCs are used to classify businesses based on the goods or services they provide. + */ + mcc?: string; + + /** + * The customer-facing business name. + */ + name?: string; + + /** + * Internal-only description of the product sold by, or service provided by, the business. Used by Stripe for risk and underwriting purposes. + */ + product_description?: string; + + /** + * A publicly available email address for sending support issues to. + */ + support_email?: string; + + /** + * A publicly available phone number to call with support issues. + */ + support_phone?: string; + + /** + * A publicly available website for handling support issues. + */ + support_url?: string; + + /** + * The business's publicly available website. + */ + url?: string; + } + + type BusinessType = 'company' | 'individual'; + + interface Company { + /** + * The company's primary address. + */ + address?: Company.Address; + + /** + * The Kana variation of the company's primary address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the company's primary address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * Whether the company's directors have been provided. Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. + */ + directors_provided?: boolean; + + /** + * Whether the company's executives have been provided. Set this Boolean to `true` after creating all the company's executives with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.executive` requirement. + */ + executives_provided?: boolean; + + /** + * The company's legal name. + */ + name?: string; + + /** + * The Kana variation of the company's legal name (Japan only). + */ + name_kana?: string; + + /** + * The Kanji variation of the company's legal name (Japan only). + */ + name_kanji?: string; + + /** + * Whether the company's owners have been provided. Set this Boolean to `true` after creating all the company's owners with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.owner` requirement. + */ + owners_provided?: boolean; + + /** + * The company's phone number (used for verification). + */ + phone?: string; + + /** + * The business ID number of the company, as appropriate for the company's country. (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.) + */ + tax_id?: string; + + /** + * The jurisdiction in which the `tax_id` is registered (Germany-based companies only). + */ + tax_id_registrar?: string; + + /** + * The VAT number of the company. + */ + vat_id?: string; + + /** + * Information on the verification state of the company. + */ + verification?: Company.Verification; + } + + namespace Company { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Verification { + /** + * A document verifying the business. + */ + document?: Verification.Document; + } + + namespace Verification { + interface Document { + /** + * The back of a document returned by a [file upload](#create_file) with a `purpose` value of `additional_verification`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of a document returned by a [file upload](#create_file) with a `purpose` value of `additional_verification`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + interface Individual { + /** + * The individual's primary address. + */ + address?: Individual.Address; + + /** + * The Kana variation of the the individual's primary address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the the individual's primary address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * The individual's date of birth. + */ + dob?: Individual.Dob | null; + + email?: string; + + /** + * The individual's first name. + */ + first_name?: string; + + /** + * The Kana variation of the the individual's first name (Japan only). + */ + first_name_kana?: string; + + /** + * The Kanji variation of the individual's first name (Japan only). + */ + first_name_kanji?: string; + + /** + * The individual's gender (International regulations require either "male" or "female"). + */ + gender?: string; + + /** + * The government-issued ID number of the individual, as appropriate for the representative's country. (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/stripe.js#collecting-pii-data). + */ + id_number?: string; + + /** + * The individual's last name. + */ + last_name?: string; + + /** + * The Kana varation of the individual's last name (Japan only). + */ + last_name_kana?: string; + + /** + * The Kanji varation of the individual's last name (Japan only). + */ + last_name_kanji?: string; + + /** + * The individual's maiden name. + */ + maiden_name?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The individual's phone number. + */ + phone?: string; + + /** + * The last four digits of the individual's Social Security Number (U.S. only). + */ + ssn_last_4?: string; + + /** + * The individual's verification document information. + */ + verification?: Individual.Verification; + } + + namespace Individual { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Verification { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: Verification.AdditionalDocument; + + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface AdditionalDocument { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + type RequestedCapability = + | 'card_issuing' + | 'card_payments' + | 'legacy_payments' + | 'transfers'; + + interface Settings { + /** + * Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. + */ + branding?: Settings.Branding; + + /** + * Settings specific to card charging on the account. + */ + card_payments?: Settings.CardPayments; + + /** + * Settings that apply across payment methods for charging on the account. + */ + payments?: Settings.Payments; + + /** + * Settings specific to the account's payouts. + */ + payouts?: Settings.Payouts; + } + + namespace Settings { + interface Branding { + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px. + */ + icon?: string; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for the account that will be used in Checkout instead of the icon and without the account's name next to it if provided. Must be at least 128px x 128px. + */ + logo?: string; + + /** + * A CSS hex color value representing the primary branding color for this account. + */ + primary_color?: string; + } + + interface CardPayments { + /** + * Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. + */ + decline_on?: CardPayments.DeclineOn; + + /** + * The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. + */ + statement_descriptor_prefix?: string; + } + + namespace CardPayments { + interface DeclineOn { + /** + * Whether Stripe automatically declines charges with an incorrect ZIP or postal code. This setting only applies when a ZIP or postal code is provided and they fail bank verification. + */ + avs_failure?: boolean; + + /** + * Whether Stripe automatically declines charges with an incorrect CVC. This setting only applies when a CVC is provided and it fails bank verification. + */ + cvc_failure?: boolean; + } + } + + interface Payments { + /** + * The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. + */ + statement_descriptor?: string; + + /** + * The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). + */ + statement_descriptor_kana?: string; + + /** + * The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). + */ + statement_descriptor_kanji?: string; + } + + interface Payouts { + /** + * A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). + */ + debit_negative_balances?: boolean; + + /** + * Details on when funds from charges are available, and when they are paid out to an external account. For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. + */ + schedule?: Payouts.Schedule; + + /** + * The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + */ + statement_descriptor?: string; + } + + namespace Payouts { + interface Schedule { + /** + * The number of days charge funds are held before being paid out. May also be set to `minimum`, representing the lowest available value for the account country. Default is `minimum`. The `delay_days` parameter does not apply when the `interval` is `manual`. + */ + delay_days?: 'minimum' | number; + + /** + * How frequently available funds are paid out. One of: `daily`, `manual`, `weekly`, or `monthly`. Default is `daily`. + */ + interval?: Schedule.Interval; + + /** + * The day of the month when available funds are paid out, specified as a number between 1--31. Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. Required and applicable only if `interval` is `monthly`. + */ + monthly_anchor?: number; + + /** + * The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. (required and applicable only if `interval` is `weekly`.) + */ + weekly_anchor?: Schedule.WeeklyAnchor; + } + + namespace Schedule { + type Interval = 'daily' | 'manual' | 'monthly' | 'weekly'; + + type WeeklyAnchor = + | 'friday' + | 'monday' + | 'saturday' + | 'sunday' + | 'thursday' + | 'tuesday' + | 'wednesday'; + } + } + } + + interface TosAcceptance { + /** + * The Unix timestamp marking when the account representative accepted the Stripe Services Agreement. + */ + date?: number; + + /** + * The IP address from which the account representative accepted the Stripe Services Agreement. + */ + ip?: string; + + /** + * The user agent of the browser from which the account representative accepted the Stripe Services Agreement. + */ + user_agent?: string; + } + + type Type = 'custom' | 'express' | 'standard'; + } + + interface AccountRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface AccountRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface AccountUpdateParams { + /** + * An [account token](https://stripe.com/docs/api#create_account_token), used to securely provide details to the account. + */ + account_token?: string; + + /** + * Non-essential business information about the account + */ + business_profile?: AccountUpdateParams.BusinessProfile; + + /** + * The business type. + */ + business_type?: AccountUpdateParams.BusinessType; + + /** + * Information about the company or business. This field is null unless `business_type` is set to `company`. + */ + company?: AccountUpdateParams.Company; + + /** + * Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). + */ + default_currency?: string; + + /** + * Email address of the account representative. For Standard accounts, this is used to ask them to claim their Stripe account. For Custom accounts, this only makes the account easier to identify to platforms; Stripe does not email the account representative. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A card or bank account to attach to the account. You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe.js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. + * + * By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. To add additional external accounts without replacing the existing default for the currency, use the bank account or card creation API. + */ + external_account?: string; + + /** + * Information about the person represented by the account. This field is null unless `business_type` is set to `individual`. + */ + individual?: AccountUpdateParams.Individual; + + /** + * A set of key-value pairs that you can attach to an `Account` object. This can be useful for storing additional information about the account in a structured format. + */ + metadata?: MetadataParam; + + /** + * The set of capabilities you want to unlock for this account. Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. An account may have some of its requested capabilities be active and some be inactive. + */ + requested_capabilities?: Array; + + /** + * Options for customizing how the account functions within Stripe. + */ + settings?: AccountUpdateParams.Settings; + + /** + * Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). + */ + tos_acceptance?: AccountUpdateParams.TosAcceptance; + } + + namespace AccountUpdateParams { + interface BusinessProfile { + /** + * The merchant category code for the account. MCCs are used to classify businesses based on the goods or services they provide. + */ + mcc?: string; + + /** + * The customer-facing business name. + */ + name?: string; + + /** + * Internal-only description of the product sold by, or service provided by, the business. Used by Stripe for risk and underwriting purposes. + */ + product_description?: string; + + /** + * A publicly available email address for sending support issues to. + */ + support_email?: string; + + /** + * A publicly available phone number to call with support issues. + */ + support_phone?: string; + + /** + * A publicly available website for handling support issues. + */ + support_url?: string; + + /** + * The business's publicly available website. + */ + url?: string; + } + + type BusinessType = 'company' | 'individual'; + + interface Company { + /** + * The company's primary address. + */ + address?: Company.Address; + + /** + * The Kana variation of the company's primary address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the company's primary address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * Whether the company's directors have been provided. Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. + */ + directors_provided?: boolean; + + /** + * Whether the company's executives have been provided. Set this Boolean to `true` after creating all the company's executives with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.executive` requirement. + */ + executives_provided?: boolean; + + /** + * The company's legal name. + */ + name?: string; + + /** + * The Kana variation of the company's legal name (Japan only). + */ + name_kana?: string; + + /** + * The Kanji variation of the company's legal name (Japan only). + */ + name_kanji?: string; + + /** + * Whether the company's owners have been provided. Set this Boolean to `true` after creating all the company's owners with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.owner` requirement. + */ + owners_provided?: boolean; + + /** + * The company's phone number (used for verification). + */ + phone?: string; + + /** + * The business ID number of the company, as appropriate for the company's country. (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.) + */ + tax_id?: string; + + /** + * The jurisdiction in which the `tax_id` is registered (Germany-based companies only). + */ + tax_id_registrar?: string; + + /** + * The VAT number of the company. + */ + vat_id?: string; + + /** + * Information on the verification state of the company. + */ + verification?: Company.Verification; + } + + namespace Company { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Verification { + /** + * A document verifying the business. + */ + document?: Verification.Document; + } + + namespace Verification { + interface Document { + /** + * The back of a document returned by a [file upload](#create_file) with a `purpose` value of `additional_verification`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of a document returned by a [file upload](#create_file) with a `purpose` value of `additional_verification`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + interface Individual { + /** + * The individual's primary address. + */ + address?: Individual.Address; + + /** + * The Kana variation of the the individual's primary address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the the individual's primary address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * The individual's date of birth. + */ + dob?: Individual.Dob | null; + + email?: string; + + /** + * The individual's first name. + */ + first_name?: string; + + /** + * The Kana variation of the the individual's first name (Japan only). + */ + first_name_kana?: string; + + /** + * The Kanji variation of the individual's first name (Japan only). + */ + first_name_kanji?: string; + + /** + * The individual's gender (International regulations require either "male" or "female"). + */ + gender?: string; + + /** + * The government-issued ID number of the individual, as appropriate for the representative's country. (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/stripe.js#collecting-pii-data). + */ + id_number?: string; + + /** + * The individual's last name. + */ + last_name?: string; + + /** + * The Kana varation of the individual's last name (Japan only). + */ + last_name_kana?: string; + + /** + * The Kanji varation of the individual's last name (Japan only). + */ + last_name_kanji?: string; + + /** + * The individual's maiden name. + */ + maiden_name?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The individual's phone number. + */ + phone?: string; + + /** + * The last four digits of the individual's Social Security Number (U.S. only). + */ + ssn_last_4?: string; + + /** + * The individual's verification document information. + */ + verification?: Individual.Verification; + } + + namespace Individual { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Verification { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: Verification.AdditionalDocument; + + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface AdditionalDocument { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + type RequestedCapability = + | 'card_issuing' + | 'card_payments' + | 'legacy_payments' + | 'transfers'; + + interface Settings { + /** + * Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. + */ + branding?: Settings.Branding; + + /** + * Settings specific to card charging on the account. + */ + card_payments?: Settings.CardPayments; + + /** + * Settings that apply across payment methods for charging on the account. + */ + payments?: Settings.Payments; + + /** + * Settings specific to the account's payouts. + */ + payouts?: Settings.Payouts; + } + + namespace Settings { + interface Branding { + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px. + */ + icon?: string; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for the account that will be used in Checkout instead of the icon and without the account's name next to it if provided. Must be at least 128px x 128px. + */ + logo?: string; + + /** + * A CSS hex color value representing the primary branding color for this account. + */ + primary_color?: string; + } + + interface CardPayments { + /** + * Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. + */ + decline_on?: CardPayments.DeclineOn; + + /** + * The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. + */ + statement_descriptor_prefix?: string; + } + + namespace CardPayments { + interface DeclineOn { + /** + * Whether Stripe automatically declines charges with an incorrect ZIP or postal code. This setting only applies when a ZIP or postal code is provided and they fail bank verification. + */ + avs_failure?: boolean; + + /** + * Whether Stripe automatically declines charges with an incorrect CVC. This setting only applies when a CVC is provided and it fails bank verification. + */ + cvc_failure?: boolean; + } + } + + interface Payments { + /** + * The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. + */ + statement_descriptor?: string; + + /** + * The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). + */ + statement_descriptor_kana?: string; + + /** + * The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). + */ + statement_descriptor_kanji?: string; + } + + interface Payouts { + /** + * A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). + */ + debit_negative_balances?: boolean; + + /** + * Details on when funds from charges are available, and when they are paid out to an external account. For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. + */ + schedule?: Payouts.Schedule; + + /** + * The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + */ + statement_descriptor?: string; + } + + namespace Payouts { + interface Schedule { + /** + * The number of days charge funds are held before being paid out. May also be set to `minimum`, representing the lowest available value for the account country. Default is `minimum`. The `delay_days` parameter does not apply when the `interval` is `manual`. + */ + delay_days?: 'minimum' | number; + + /** + * How frequently available funds are paid out. One of: `daily`, `manual`, `weekly`, or `monthly`. Default is `daily`. + */ + interval?: Schedule.Interval; + + /** + * The day of the month when available funds are paid out, specified as a number between 1--31. Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. Required and applicable only if `interval` is `monthly`. + */ + monthly_anchor?: number; + + /** + * The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. (required and applicable only if `interval` is `weekly`.) + */ + weekly_anchor?: Schedule.WeeklyAnchor; + } + + namespace Schedule { + type Interval = 'daily' | 'manual' | 'monthly' | 'weekly'; + + type WeeklyAnchor = + | 'friday' + | 'monday' + | 'saturday' + | 'sunday' + | 'thursday' + | 'tuesday' + | 'wednesday'; + } + } + } + + interface TosAcceptance { + /** + * The Unix timestamp marking when the account representative accepted the Stripe Services Agreement. + */ + date?: number; + + /** + * The IP address from which the account representative accepted the Stripe Services Agreement. + */ + ip?: string; + + /** + * The user agent of the browser from which the account representative accepted the Stripe Services Agreement. + */ + user_agent?: string; + } + } + + interface AccountListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface AccountDeleteParams {} + + interface AccountRejectParams { + /** + * The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. + */ + reason: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class AccountsResource { + /** + * With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users. + * To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings). + * + * For Standard accounts, parameters other than country, email, and type + * are used to prefill the account application that we ask the account holder to complete. + */ + create( + params?: AccountCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of an account. + */ + retrieve( + params?: AccountRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(options?: RequestOptions): Promise; + + /** + * Retrieves the details of an account. + */ + retrieve( + id: string, + params?: AccountRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates a connected [Express or Custom account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are left unchanged. Most parameters can be changed only for Custom accounts. (These are marked Custom Only below.) Parameters marked Custom and Express are supported by both account types. + * + * To update your own account, use the [Dashboard](https://dashboard.stripe.com/account). Refer to our [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. + */ + update( + id: string, + params?: AccountUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty. + */ + list( + params?: AccountListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * With [Connect](https://stripe.com/docs/connect), you can delete Custom or Express accounts you manage. + * + * Accounts created using test-mode keys can be deleted at any time. Accounts created using live-mode keys can only be deleted once all balances are zero. + * + * If you want to delete your own account, use the [data tab in your account settings](https://dashboard.stripe.com/account/data) instead. + */ + del( + id: string, + params?: AccountDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + + /** + * With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. + * + * Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero. + */ + reject( + id: string, + params: AccountRejectParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves information about the specified Account Capability. + */ + retrieveCapability( + accountId: string, + id: string, + params?: CapabilityRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveCapability( + accountId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates an existing Account Capability. + */ + updateCapability( + accountId: string, + id: string, + params?: CapabilityUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first. + */ + listCapabilities( + id: string, + params?: CapabilityListParams, + options?: RequestOptions + ): ApiListPromise; + listCapabilities( + id: string, + options?: RequestOptions + ): ApiListPromise; + + /** + * Create an external account for a given account. + */ + createExternalAccount( + id: string, + params: ExternalAccountCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieve a specified external account for a given account. + */ + retrieveExternalAccount( + accountId: string, + id: string, + params?: ExternalAccountRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveExternalAccount( + accountId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the metadata, account holder name, and account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. Other bank account details are not editable by design. + * You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. + */ + updateExternalAccount( + accountId: string, + id: string, + params?: ExternalAccountUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * List external accounts for an account. + */ + listExternalAccounts( + id: string, + params?: ExternalAccountListParams, + options?: RequestOptions + ): ApiListPromise; + listExternalAccounts( + id: string, + options?: RequestOptions + ): ApiListPromise; + + /** + * Delete a specified external account for a given account. + */ + deleteExternalAccount( + accountId: string, + id: string, + params?: ExternalAccountDeleteParams, + options?: RequestOptions + ): Promise; + deleteExternalAccount( + accountId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Creates a single-use login link for an Express account to access their Stripe dashboard. + * + * You may only create login links for [Express accounts](https://stripe.com/docs/connect/express-accounts) connected to your platform. + */ + createLoginLink( + id: string, + params?: LoginLinkCreateParams, + options?: RequestOptions + ): Promise; + createLoginLink(id: string, options?: RequestOptions): Promise; + + /** + * Creates a new person. + */ + createPerson( + id: string, + params?: PersonCreateParams, + options?: RequestOptions + ): Promise; + createPerson(id: string, options?: RequestOptions): Promise; + + /** + * Retrieves an existing person. + */ + retrievePerson( + accountId: string, + id: string, + params?: PersonRetrieveParams, + options?: RequestOptions + ): Promise; + retrievePerson( + accountId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates an existing person. + */ + updatePerson( + accountId: string, + id: string, + params?: PersonUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first. + */ + listPersons( + id: string, + params?: PersonListParams, + options?: RequestOptions + ): ApiListPromise; + listPersons(id: string, options?: RequestOptions): ApiListPromise; + + /** + * Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file. + */ + deletePerson( + accountId: string, + id: string, + params?: PersonDeleteParams, + options?: RequestOptions + ): Promise; + deletePerson( + accountId: string, + id: string, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/Addresses.d.ts b/types/2019-12-03/Addresses.d.ts new file mode 100644 index 0000000000..2b7d347918 --- /dev/null +++ b/types/2019-12-03/Addresses.d.ts @@ -0,0 +1,36 @@ +declare namespace Stripe { + /** + * The Address object. + */ + interface Address { + /** + * City/District/Suburb/Town/Village. + */ + city: string | null; + + /** + * 2-letter country code. + */ + country: string | null; + + /** + * Address line 1 (Street address/PO Box/Company name). + */ + line1: string | null; + + /** + * Address line 2 (Apartment/Suite/Unit/Building). + */ + line2: string | null; + + /** + * ZIP or postal code. + */ + postal_code: string | null; + + /** + * State/County/Province/Region. + */ + state: string | null; + } +} diff --git a/types/2019-12-03/AlipayAccounts.d.ts b/types/2019-12-03/AlipayAccounts.d.ts new file mode 100644 index 0000000000..f463a3ba16 --- /dev/null +++ b/types/2019-12-03/AlipayAccounts.d.ts @@ -0,0 +1,87 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The AlipayAccount object. + */ + interface AlipayAccount { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'alipay_account'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + customer?: string | Customer | DeletedCustomer | null; + + deleted?: void; + + /** + * Uniquely identifies the account and will be the same across all Alipay account objects that are linked to the same Alipay account. + */ + fingerprint: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: Metadata; + + /** + * If the Alipay account object is not reusable, the exact amount that you can create a charge for. + */ + payment_amount: number | null; + + /** + * If the Alipay account object is not reusable, the exact currency that you can create a charge for. + */ + payment_currency: string | null; + + /** + * True if you can create multiple payments using this account. If the account is reusable, then you can freely choose the amount of each payment. + */ + reusable: boolean; + + /** + * Whether this Alipay account object has ever been used for a payment. + */ + used: boolean; + + /** + * The username for the Alipay account. + */ + username: string; + } + + /** + * The DeletedAlipayAccount object. + */ + interface DeletedAlipayAccount { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'alipay_account'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + } +} diff --git a/types/2019-12-03/ApplePayDomains.d.ts b/types/2019-12-03/ApplePayDomains.d.ts new file mode 100644 index 0000000000..c4e1377fb7 --- /dev/null +++ b/types/2019-12-03/ApplePayDomains.d.ts @@ -0,0 +1,118 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The ApplePayDomain object. + */ + interface ApplePayDomain { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'apple_pay_domain'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + deleted?: void; + + domain_name: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + } + + /** + * The DeletedApplePayDomain object. + */ + interface DeletedApplePayDomain { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'apple_pay_domain'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface ApplePayDomainCreateParams { + domain_name: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ApplePayDomainRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ApplePayDomainListParams extends PaginationParams { + domain_name?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ApplePayDomainDeleteParams {} + + class ApplePayDomainsResource { + /** + * Create an apple pay domain. + */ + create( + params: ApplePayDomainCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieve an apple pay domain. + */ + retrieve( + id: string, + params?: ApplePayDomainRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * List apple pay domains. + */ + list( + params?: ApplePayDomainListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Delete an apple pay domain. + */ + del( + id: string, + params?: ApplePayDomainDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/ApplicationFees.d.ts b/types/2019-12-03/ApplicationFees.d.ts new file mode 100644 index 0000000000..29953a9430 --- /dev/null +++ b/types/2019-12-03/ApplicationFees.d.ts @@ -0,0 +1,178 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The ApplicationFee object. + */ + interface ApplicationFee { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'application_fee'; + + /** + * ID of the Stripe account this fee was taken from. + */ + account: string | Account; + + /** + * Amount earned, in %s. + */ + amount: number; + + /** + * Amount in %s refunded (can be less than the amount attribute on the fee if a partial refund was issued) + */ + amount_refunded: number; + + /** + * ID of the Connect application that earned the fee. + */ + application: string | Application; + + /** + * Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds). + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * ID of the charge that the application fee was taken from. + */ + charge: string | Charge; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * ID of the corresponding charge on the platform account, if this fee was the result of a charge using the `destination` parameter. + */ + originating_transaction: string | Charge | null; + + /** + * Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false. + */ + refunded: boolean; + + /** + * A list of refunds that have been applied to the fee. + */ + refunds: ApiList; + } + + interface ApplicationFeeRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ApplicationFeeListParams extends PaginationParams { + /** + * Only return application fees for the charge specified by this charge ID. + */ + charge?: string; + + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ApplicationFeesResource { + /** + * Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the application fee. + */ + retrieve( + id: string, + params?: ApplicationFeeRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first. + */ + list( + params?: ApplicationFeeListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Refunds an application fee that has previously been collected but not yet refunded. + * Funds will be refunded to the Stripe account from which the fee was originally collected. + * + * You can optionally refund only part of an application fee. + * You can do so multiple times, until the entire fee has been refunded. + * + * Once entirely refunded, an application fee can't be refunded again. + * This method will raise an error when called on an already-refunded application fee, + * or when trying to refund more money than is left on an application fee. + */ + createRefund( + id: string, + params?: FeeRefundCreateParams, + options?: RequestOptions + ): Promise; + createRefund(id: string, options?: RequestOptions): Promise; + + /** + * By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee. + */ + retrieveRefund( + feeId: string, + id: string, + params?: FeeRefundRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveRefund( + feeId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * + * This request only accepts metadata as an argument. + */ + updateRefund( + feeId: string, + id: string, + params?: FeeRefundUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds. + */ + listRefunds( + id: string, + params?: FeeRefundListParams, + options?: RequestOptions + ): ApiListPromise; + listRefunds( + id: string, + options?: RequestOptions + ): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Applications.d.ts b/types/2019-12-03/Applications.d.ts new file mode 100644 index 0000000000..7b9fe759be --- /dev/null +++ b/types/2019-12-03/Applications.d.ts @@ -0,0 +1,23 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Application object. + */ + interface Application { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'application'; + + /** + * The name of the application. + */ + name: string | null; + } + } +} diff --git a/types/2019-12-03/Balance.d.ts b/types/2019-12-03/Balance.d.ts new file mode 100644 index 0000000000..2033131fed --- /dev/null +++ b/types/2019-12-03/Balance.d.ts @@ -0,0 +1,138 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Balance object. + */ + interface Balance { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'balance'; + + /** + * Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the [Transfers API](#transfers) or [Payouts API](#payouts). The available balance for each currency and payment type can be found in the `source_types` property. + */ + available: Array; + + /** + * Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the `source_types` property. + */ + connect_reserved?: Array; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the `source_types` property. + */ + pending: Array; + } + + namespace Balance { + interface Available { + /** + * Balance amount. + */ + 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; + + source_types?: Available.SourceTypes; + } + + namespace Available { + interface SourceTypes { + /** + * Amount for bank account. + */ + bank_account?: number; + + /** + * Amount for card. + */ + card?: number; + } + } + + interface ConnectReserved { + /** + * Balance amount. + */ + 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; + + source_types?: ConnectReserved.SourceTypes; + } + + namespace ConnectReserved { + interface SourceTypes { + /** + * Amount for bank account. + */ + bank_account?: number; + + /** + * Amount for card. + */ + card?: number; + } + } + + interface Pending { + /** + * Balance amount. + */ + 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; + + source_types?: Pending.SourceTypes; + } + + namespace Pending { + interface SourceTypes { + /** + * Amount for bank account. + */ + bank_account?: number; + + /** + * Amount for card. + */ + card?: number; + } + } + } + + interface BalanceRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class BalanceResource { + /** + * Retrieves the current account balance, based on the authentication that was used to make the request. + * For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances). + */ + retrieve( + params?: BalanceRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/BalanceTransactions.d.ts b/types/2019-12-03/BalanceTransactions.d.ts new file mode 100644 index 0000000000..b68431bd03 --- /dev/null +++ b/types/2019-12-03/BalanceTransactions.d.ts @@ -0,0 +1,212 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The BalanceTransaction object. + */ + interface BalanceTransaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'balance_transaction'; + + /** + * Gross amount of the transaction, in %s. + */ + amount: number; + + /** + * The date the transaction's net funds will become available in the Stripe balance. + */ + available_on: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + exchange_rate: number | null; + + /** + * Fees (in %s) paid for this transaction. + */ + fee: number; + + /** + * Detailed breakdown of fees (in %s) paid for this transaction. + */ + fee_details: Array; + + /** + * Net amount of the transaction, in %s. + */ + net: number; + + /** + * The Stripe object to which this transaction is related. + */ + source: + | string + | ApplicationFee + | Charge + | ConnectCollectionTransfer + | Dispute + | FeeRefund + | Issuing.Authorization + | Issuing.Transaction + | Payout + | PlatformTaxFee + | Refund + | ReserveTransaction + | TaxDeductedAtSource + | Topup + | Transfer + | TransferReversal + | null; + + /** + * If the transaction's net funds are available in the Stripe balance yet. Either `available` or `pending`. + */ + status: string; + + /** + * Transaction type: `adjustment`, `advance`, `advance_funding`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. + */ + type: BalanceTransaction.Type; + } + + namespace BalanceTransaction { + interface FeeDetail { + /** + * Amount of the fee, in cents. + */ + amount: number; + + application: 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * Type of the fee, one of: `application_fee`, `stripe_fee` or `tax`. + */ + type: string; + } + + type Type = + | 'adjustment' + | 'advance' + | 'advance_funding' + | 'application_fee' + | 'application_fee_refund' + | 'charge' + | 'connect_collection_transfer' + | 'issuing_authorization_hold' + | 'issuing_authorization_release' + | 'issuing_transaction' + | 'payment' + | 'payment_failure_refund' + | 'payment_refund' + | 'payout' + | 'payout_cancel' + | 'payout_failure' + | 'refund' + | 'refund_failure' + | 'reserve_transaction' + | 'reserved_funds' + | 'stripe_fee' + | 'stripe_fx_fee' + | 'tax_fee' + | 'topup' + | 'topup_reversal' + | 'transfer' + | 'transfer_cancel' + | 'transfer_failure' + | 'transfer_refund'; + } + + interface BalanceTransactionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface BalanceTransactionListParams extends PaginationParams { + available_on?: RangeQueryParam | number; + + created?: RangeQueryParam | number; + + currency?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * For automatic Stripe payouts only, only returns transactions that were paid out on the specified payout ID. + */ + payout?: string; + + /** + * Only returns the original transaction. + */ + source?: string; + + /** + * Only returns transactions of the given type. One of: `charge`, `refund`, `adjustment`, `application_fee`, `application_fee_refund`, `transfer`, `payment`, `payout`, `payout_failure`, `stripe_fee`, or `network_cost`. + */ + type?: string; + } + + class BalanceTransactionsResource { + /** + * Retrieves the balance transaction with the given ID. + * + * Note that this endpoint previously used the path /v1/balance/history/:id. + */ + retrieve( + id: string, + params?: BalanceTransactionRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first. + * + * Note that this endpoint was previously called “Balance history” and used the path /v1/balance/history. + */ + list( + params?: BalanceTransactionListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/BankAccounts.d.ts b/types/2019-12-03/BankAccounts.d.ts new file mode 100644 index 0000000000..e0a41923ca --- /dev/null +++ b/types/2019-12-03/BankAccounts.d.ts @@ -0,0 +1,103 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The BankAccount object. + */ + interface BankAccount { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'bank_account'; + + account?: string | Account | null; + + /** + * The name of the person or business that owns the bank account. + */ + account_holder_name: string | null; + + /** + * The type of entity that holds the account. This can be either `individual` or `company`. + */ + account_holder_type: string | null; + + /** + * Name of the bank associated with the routing number (e.g., `WELLS FARGO`). + */ + bank_name: string | null; + + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account. + */ + currency: string; + + customer?: string | Customer | DeletedCustomer | null; + + /** + * Whether this bank account is the default external account for its currency. + */ + default_for_currency?: boolean | null; + + deleted?: void; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string | null; + + last4: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: Metadata | null; + + /** + * The routing transit number for the bank account. + */ + routing_number: string | null; + + /** + * For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn't enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a transfer sent to this bank account fails, we'll set the status to `errored` and will not continue to send transfers until the bank details are updated. + * + * For external accounts, possible values are `new` and `errored`. Validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply. If a transfer fails, the status is set to `errored` and transfers are stopped until account details are updated. + */ + status: string; + } + + /** + * The DeletedBankAccount object. + */ + interface DeletedBankAccount { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'bank_account'; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account. + */ + currency: string | null; + + /** + * Always true for a deleted object + */ + deleted: true; + } + } +} diff --git a/types/2019-12-03/BitcoinReceivers.d.ts b/types/2019-12-03/BitcoinReceivers.d.ts new file mode 100644 index 0000000000..db30cd2f66 --- /dev/null +++ b/types/2019-12-03/BitcoinReceivers.d.ts @@ -0,0 +1,194 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The BitcoinReceiver object. + */ + interface BitcoinReceiver { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'bitcoin_receiver'; + + /** + * True when this bitcoin receiver has received a non-zero amount of bitcoin. + */ + active: boolean; + + /** + * The amount of `currency` that you are collecting as payment. + */ + amount: number; + + /** + * The amount of `currency` to which `bitcoin_amount_received` has been converted. + */ + amount_received: number; + + /** + * The amount of bitcoin that the customer should send to fill the receiver. The `bitcoin_amount` is denominated in Satoshi: there are 10^8 Satoshi in one bitcoin. + */ + bitcoin_amount: number; + + /** + * The amount of bitcoin that has been sent by the customer to this receiver. + */ + bitcoin_amount_received: number; + + /** + * This URI can be displayed to the customer as a clickable link (to activate their bitcoin client) or as a QR code (for mobile wallets). + */ + bitcoin_uri: string; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) to which the bitcoin will be converted. + */ + currency: string; + + customer?: string | null; + + deleted?: void; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * The customer's email address, set by the API call that creates the receiver. + */ + email: string | null; + + /** + * This flag is initially false and updates to true when the customer sends the `bitcoin_amount` to this receiver. + */ + filled: boolean; + + /** + * A bitcoin address that is specific to this receiver. The customer can send bitcoin to this address to fill the receiver. + */ + inbound_address: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key. + */ + payment?: string | null; + + refund_address: string | null; + + /** + * A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the receiver with a publishable key. + */ + transactions?: ApiList; + + /** + * This receiver contains uncaptured funds that can be used for a payment or refunded. + */ + uncaptured_funds: boolean; + + used_for_payment: boolean | null; + } + + /** + * The DeletedBitcoinReceiver object. + */ + interface DeletedBitcoinReceiver { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'bitcoin_receiver'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface BitcoinReceiverRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface BitcoinReceiverListParams extends PaginationParams { + /** + * Filter for active receivers. + */ + active?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Filter for filled receivers. + */ + filled?: boolean; + + /** + * Filter for receivers with uncaptured funds. + */ + uncaptured_funds?: boolean; + } + + class BitcoinReceiversResource { + /** + * Retrieves the Bitcoin receiver with the given ID. + */ + retrieve( + id: string, + params?: BitcoinReceiverRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Returns a list of your receivers. Receivers are returned sorted by creation date, with the most recently created receivers appearing first. + */ + list( + params?: BitcoinReceiverListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * List bitcoin transacitons for a given receiver. + */ + listTransactions( + id: string, + params?: BitcoinTransactionListParams, + options?: RequestOptions + ): ApiListPromise; + listTransactions( + id: string, + options?: RequestOptions + ): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/BitcoinTransactions.d.ts b/types/2019-12-03/BitcoinTransactions.d.ts new file mode 100644 index 0000000000..187aef2f20 --- /dev/null +++ b/types/2019-12-03/BitcoinTransactions.d.ts @@ -0,0 +1,55 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The BitcoinTransaction object. + */ + interface BitcoinTransaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'bitcoin_transaction'; + + /** + * The amount of `currency` that the transaction was converted to in real-time. + */ + amount: number; + + /** + * The amount of bitcoin contained in the transaction. + */ + bitcoin_amount: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) to which this transaction was converted. + */ + currency: string; + + /** + * The receiver to which this transaction was sent. + */ + receiver: string; + } + + interface BitcoinTransactionListParams extends PaginationParams { + /** + * Only return transactions for the customer specified by this customer ID. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } +} diff --git a/types/2019-12-03/Capabilities.d.ts b/types/2019-12-03/Capabilities.d.ts new file mode 100644 index 0000000000..92bffed0f7 --- /dev/null +++ b/types/2019-12-03/Capabilities.d.ts @@ -0,0 +1,107 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Capability object. + */ + interface Capability { + /** + * The identifier for the capability. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'capability'; + + /** + * The account for which the capability enables functionality. + */ + account: string | Account; + + /** + * Whether the capability has been requested. + */ + requested: boolean; + + /** + * Time at which the capability was requested. Measured in seconds since the Unix epoch. + */ + requested_at: number | null; + + requirements?: Capability.Requirements; + + /** + * The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`. + */ + status: Capability.Status; + } + + namespace Capability { + interface Requirements { + /** + * The date the fields in `currently_due` must be collected by to keep the capability enabled for the account. + */ + current_deadline: number | null; + + /** + * The fields that need to be collected to keep the capability enabled. If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled. + */ + currently_due: Array; + + /** + * If the capability is disabled, this string describes why. Possible values are `requirement.fields_needed`, `pending.onboarding`, `pending.review`, `rejected_fraud`, or `rejected.other`. + */ + disabled_reason: string | null; + + /** + * The fields that need to be collected assuming all volume thresholds are reached. As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set. + */ + eventually_due: Array; + + /** + * The fields that weren't collected by the `current_deadline`. These fields need to be collected to enable the capability for the account. + */ + past_due: Array; + + /** + * Fields that may become required depending on the results of verification or review. An empty array unless an asynchronous verification is pending. If verification fails, the fields in this array become required and move to `currently_due` or `past_due`. + */ + pending_verification: Array; + } + + type Status = + | 'active' + | 'disabled' + | 'inactive' + | 'pending' + | 'unrequested'; + } + + interface CapabilityRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CapabilityUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + + interface CapabilityListParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } +} diff --git a/types/2019-12-03/Cards.d.ts b/types/2019-12-03/Cards.d.ts new file mode 100644 index 0000000000..cff98641f6 --- /dev/null +++ b/types/2019-12-03/Cards.d.ts @@ -0,0 +1,191 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Card object. + */ + interface Card { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'card'; + + /** + * The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. + */ + account?: string | Account | null; + + /** + * City/District/Suburb/Town/Village. + */ + address_city: string | null; + + /** + * Billing address country, if provided when creating card. + */ + address_country: string | null; + + /** + * Address line 1 (Street address/PO Box/Company name). + */ + address_line1: string | null; + + /** + * If `address_line1` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`. + */ + address_line1_check: string | null; + + /** + * Address line 2 (Apartment/Suite/Unit/Building). + */ + address_line2: string | null; + + /** + * State/County/Province/Region. + */ + address_state: string | null; + + /** + * ZIP or postal code. + */ + address_zip: string | null; + + /** + * If `address_zip` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`. + */ + address_zip_check: string | null; + + /** + * A set of available payout methods for this card. Will be either `["standard"]` or `["standard", "instant"]`. Only values from this set should be passed as the `method` when creating a transfer. + */ + available_payout_methods?: Array | null; + + /** + * Card brand. Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`. + */ + brand: string; + + /** + * Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + */ + country: string | null; + + currency?: string | null; + + /** + * The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead. + */ + customer?: string | Customer | DeletedCustomer | null; + + /** + * If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`. + */ + cvc_check: string | null; + + /** + * Whether this card is the default external account for its currency. + */ + default_for_currency?: boolean | null; + + deleted?: void; + + /** + * Card description. (Only for internal use only and not typically available in standard API requests.) + */ + description?: string; + + /** + * (For tokenized numbers only.) The last four digits of the device account number. + */ + dynamic_last4: string | null; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number; + + /** + * Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. + */ + fingerprint?: string | null; + + /** + * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + */ + funding: string; + + /** + * Issuer identification number of the card. (Only for internal use only and not typically available in standard API requests.) + */ + iin?: string; + + /** + * Issuer bank name of the card. (Only for internal use only and not typically available in standard API requests.) + */ + issuer?: string; + + /** + * The last four digits of the card. + */ + last4: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * Cardholder name. + */ + name: string | null; + + /** + * The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead. + */ + recipient?: string | Recipient | null; + + /** + * If the card number is tokenized, this is the method that was used. Can be `apple_pay` or `google_pay`. + */ + tokenization_method: string | null; + } + + namespace Card { + type AvailablePayoutMethod = 'instant' | 'standard'; + } + + /** + * The DeletedCard object. + */ + interface DeletedCard { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'card'; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account. + */ + currency: string | null; + + /** + * Always true for a deleted object + */ + deleted: true; + } + } +} diff --git a/types/2019-12-03/Charges.d.ts b/types/2019-12-03/Charges.d.ts new file mode 100644 index 0000000000..0a8a08eec8 --- /dev/null +++ b/types/2019-12-03/Charges.d.ts @@ -0,0 +1,1508 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Charge object. + */ + interface Charge { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'charge'; + + alternate_statement_descriptors?: Charge.AlternateStatementDescriptors; + + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount: number; + + /** + * Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued). + */ + amount_refunded: number; + + /** + * ID of the Connect application that created the charge. + */ + application: string | Application | null; + + /** + * The application fee (if any) for the charge. [See the Connect documentation](https://stripe.com/docs/connect/direct-charges#collecting-fees) for details. + */ + application_fee: string | ApplicationFee | null; + + /** + * The amount of the application fee (if any) for the charge. [See the Connect documentation](https://stripe.com/docs/connect/direct-charges#collecting-fees) for details. + */ + application_fee_amount: number | null; + + /** + * Authorization code on the charge. + */ + authorization_code?: string; + + /** + * ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes). + */ + balance_transaction: string | BalanceTransaction | null; + + billing_details: Charge.BillingDetails; + + /** + * If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured. + */ + captured: boolean; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * ID of the customer this charge is for if one exists. + */ + customer: string | Customer | DeletedCustomer | null; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * ID of an existing, connected Stripe account to transfer funds to if `transfer_data` was specified in the charge request. + */ + destination: string | Account | null; + + /** + * Details about the dispute if the charge has been disputed. + */ + dispute: string | Dispute | null; + + /** + * Whether the charge has been disputed. + */ + disputed: boolean; + + /** + * Error code explaining reason for charge failure if available (see [the errors section](https://stripe.com/docs/api#errors) for a list of codes). + */ + failure_code: string | null; + + /** + * Message to user further explaining reason for charge failure if available. + */ + failure_message: string | null; + + /** + * Information on fraud assessments for the charge. + */ + fraud_details: Charge.FraudDetails | null; + + /** + * ID of the invoice this charge is for if one exists. + */ + invoice: string | Invoice | null; + + level3?: Charge.Level3; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers) for details. + */ + on_behalf_of: string | Account | null; + + /** + * ID of the order this charge is for if one exists. + */ + order: string | Order | null; + + /** + * Details about whether the payment was accepted, and why. See [understanding declines](https://stripe.com/docs/declines) for details. + */ + outcome: Charge.Outcome | null; + + /** + * `true` if the charge succeeded, or was successfully authorized for later capture. + */ + paid: boolean; + + /** + * ID of the PaymentIntent associated with this charge, if one exists. + */ + payment_intent: string | null; + + /** + * ID of the payment method used in this charge. + */ + payment_method: string | null; + + /** + * Details about the payment method at the time of the transaction. + */ + payment_method_details: Charge.PaymentMethodDetails | null; + + /** + * This is the email address that the receipt for this charge was sent to. + */ + receipt_email: string | null; + + /** + * This is the transaction number that appears on email receipts sent for this charge. This attribute will be `null` until a receipt has been sent. + */ + receipt_number: string | null; + + /** + * This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt. + */ + receipt_url: string; + + /** + * Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false. + */ + refunded: boolean; + + /** + * A list of refunds that have been applied to the charge. + */ + refunds: ApiList; + + /** + * ID of the review associated with this charge if one exists. + */ + review: string | Review | null; + + /** + * Shipping information for the charge. + */ + shipping: Charge.Shipping | null; + + /** + * This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to `payment_method` or `payment_method_details` instead. + */ + source: CustomerSource | null; + + /** + * The transfer ID which created this charge. Only present if the charge came from another Stripe account. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. + */ + source_transfer: string | Transfer | null; + + /** + * For card charges, use `statement_descriptor_suffix` instead. Otherwise, you can use this value as the complete description of a charge on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor: string | null; + + /** + * Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix: string | null; + + /** + * The status of the payment is either `succeeded`, `pending`, or `failed`. + */ + status: string; + + /** + * ID of the transfer to the `destination` account (only applicable if the charge was created using the `destination` parameter). + */ + transfer?: string | Transfer; + + /** + * An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. + */ + transfer_data: Charge.TransferData | null; + + /** + * A string that identifies this transaction as part of a group. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers#grouping-transactions) for details. + */ + transfer_group: string | null; + } + + namespace Charge { + interface AlternateStatementDescriptors { + /** + * The Kana variation of the descriptor. + */ + kana?: string; + + /** + * The Kanji variation of the descriptor. + */ + kanji?: string; + } + + interface BillingDetails { + /** + * Billing address. + */ + address: Address | null; + + /** + * Email address. + */ + email: string | null; + + /** + * Full name. + */ + name: string | null; + + /** + * Billing phone number (including extension). + */ + phone: string | null; + } + + interface FraudDetails { + /** + * Assessments from Stripe. If set, the value is `fraudulent`. + */ + stripe_report?: string; + + /** + * Assessments reported by you. If set, possible values of are `safe` and `fraudulent`. + */ + user_report?: string; + } + + interface Level3 { + customer_reference?: string; + + line_items: Array; + + merchant_reference: string; + + shipping_address_zip?: string; + + shipping_amount?: number; + + shipping_from_zip?: string; + } + + namespace Level3 { + interface LineItem { + discount_amount: number | null; + + product_code: string; + + product_description: string; + + quantity: number | null; + + tax_amount: number | null; + + unit_cost: number | null; + } + } + + interface Outcome { + /** + * Possible values are `approved_by_network`, `declined_by_network`, `not_sent_to_network`, and `reversed_after_approval`. The value `reversed_after_approval` indicates the payment was [blocked by Stripe](https://stripe.com/docs/declines#blocked-payments) after bank authorization, and may temporarily appear as "pending" on a cardholder's statement. + */ + network_status: string | null; + + /** + * An enumerated value providing a more detailed explanation of the outcome's `type`. Charges blocked by Radar's default block rule have the value `highest_risk_level`. Charges placed in review by Radar's default review rule have the value `elevated_risk_level`. Charges authorized, blocked, or placed in review by custom rules have the value `rule`. See [understanding declines](https://stripe.com/docs/declines) for more details. + */ + reason: string | null; + + /** + * Stripe's evaluation of the riskiness of the payment. Possible values for evaluated payments are `normal`, `elevated`, `highest`. For non-card payments, and card-based payments predating the public assignment of risk levels, this field will have the value `not_assessed`. In the event of an error in the evaluation, this field will have the value `unknown`. + */ + risk_level?: string; + + /** + * Stripe's evaluation of the riskiness of the payment. Possible values for evaluated payments are between 0 and 100. For non-card payments, card-based payments predating the public assignment of risk scores, or in the event of an error during evaluation, this field will not be present. This field is only available with Radar for Fraud Teams. + */ + risk_score?: number; + + /** + * The ID of the Radar rule that matched the payment, if applicable. + */ + rule?: string | Outcome.Rule; + + /** + * A human-readable description of the outcome type and reason, designed for you (the recipient of the payment), not your customer. + */ + seller_message: string | null; + + /** + * Possible values are `authorized`, `manual_review`, `issuer_declined`, `blocked`, and `invalid`. See [understanding declines](https://stripe.com/docs/declines) and [Radar reviews](https://stripe.com/docs/radar/reviews) for details. + */ + type: string; + } + + namespace Outcome { + interface Rule { + /** + * The action taken on the payment. + */ + action: string; + + /** + * Unique identifier for the object. + */ + id: string; + + /** + * The predicate to evaluate the payment against. + */ + predicate: string; + } + } + + interface PaymentMethodDetails { + ach_credit_transfer?: PaymentMethodDetails.AchCreditTransfer; + + ach_debit?: PaymentMethodDetails.AchDebit; + + acss_debit?: PaymentMethodDetails.AcssDebit; + + alipay?: PaymentMethodDetails.Alipay; + + au_becs_debit?: PaymentMethodDetails.AuBecsDebit; + + bancontact?: PaymentMethodDetails.Bancontact; + + bitcoin?: PaymentMethodDetails.Bitcoin; + + card?: PaymentMethodDetails.Card; + + card_present?: PaymentMethodDetails.CardPresent; + + eps?: PaymentMethodDetails.Eps; + + giropay?: PaymentMethodDetails.Giropay; + + ideal?: PaymentMethodDetails.Ideal; + + klarna?: PaymentMethodDetails.Klarna; + + multibanco?: PaymentMethodDetails.Multibanco; + + p24?: PaymentMethodDetails.P24; + + sepa_credit_transfer?: PaymentMethodDetails.SepaCreditTransfer; + + sepa_debit?: PaymentMethodDetails.SepaDebit; + + sofort?: PaymentMethodDetails.Sofort; + + stripe_account?: PaymentMethodDetails.StripeAccount; + + /** + * The type of transaction-specific details of the payment method used in the payment, one of `ach_credit_transfer`, `ach_debit`, `alipay`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `klarna`, `multibanco`, `p24`, `sepa_debit`, `sofort`, `stripe_account`, or `wechat`. + * An additional hash is included on `payment_method_details` with a name matching this value. + * It contains information specific to the payment method. + */ + type: string; + + wechat?: PaymentMethodDetails.Wechat; + } + + namespace PaymentMethodDetails { + interface AchCreditTransfer { + /** + * Account number to transfer funds to. + */ + account_number: string | null; + + /** + * Name of the bank associated with the routing number. + */ + bank_name: string | null; + + /** + * Routing transit number for the bank account to transfer funds to. + */ + routing_number: string | null; + + /** + * SWIFT code of the bank associated with the routing number. + */ + swift_code: string | null; + } + + interface AchDebit { + /** + * Type of entity that holds the account. This can be either `individual` or `company`. + */ + account_holder_type: AchDebit.AccountHolderType | null; + + /** + * Name of the bank associated with the bank account. + */ + bank_name: string | null; + + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string | null; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string | null; + + /** + * Last four digits of the bank account number. + */ + last4: string | null; + + /** + * Routing transit number of the bank account. + */ + routing_number: string | null; + } + + namespace AchDebit { + type AccountHolderType = 'company' | 'individual'; + } + + interface AcssDebit { + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string | null; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string | null; + + /** + * Last four digits of the bank account number. + */ + last4: string | null; + + /** + * Routing transit number of the bank account. + */ + routing_number: string | null; + } + + interface Alipay {} + + interface AuBecsDebit { + /** + * Bank-State-Branch number of the bank account. + */ + bsb_number: string | null; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string | null; + + /** + * Last four digits of the bank account number. + */ + last4: string | null; + + /** + * ID of the mandate used to make this payment. + */ + mandate?: string; + } + + interface Bancontact { + /** + * Bank code of bank associated with the bank account. + */ + bank_code: string | null; + + /** + * Name of the bank associated with the bank account. + */ + bank_name: string | null; + + /** + * Bank Identifier Code of the bank associated with the bank account. + */ + bic: string | null; + + /** + * Last four characters of the IBAN. + */ + iban_last4: string | null; + + /** + * Preferred language of the Bancontact authorization page that the customer is redirected to. + * Can be one of `en`, `de`, `fr`, or `nl` + */ + preferred_language: Bancontact.PreferredLanguage | null; + + /** + * Owner's verified full name. Values are verified or provided by Bancontact directly + * (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + } + + namespace Bancontact { + type PreferredLanguage = 'de' | 'en' | 'fr' | 'nl'; + } + + interface Bitcoin { + address: string | null; + + amount: number | null; + + amount_charged: number | null; + + amount_received: number | null; + + amount_returned: number | null; + + refund_address: string | null; + } + + interface Card { + /** + * Card brand. Can be `amex`, `diners`, `discover`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + brand: string | null; + + /** + * Check results by Card networks on Card address and CVC at time of payment. + */ + checks: Card.Checks | null; + + /** + * Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + */ + country: string | null; + + /** + * Card description. (Only for internal use only and not typically available in standard API requests.) + */ + description?: string | null; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number | null; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number | null; + + /** + * Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. + */ + fingerprint?: string | null; + + /** + * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + */ + funding: string | null; + + /** + * Issuer identification number of the card. (Only for internal use only and not typically available in standard API requests.) + */ + iin?: string | null; + + /** + * Installment details for this payment (Mexico only). + * + * For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). + */ + installments: Card.Installments | null; + + /** + * Issuer bank name of the card. (Only for internal use only and not typically available in standard API requests.) + */ + issuer?: string | null; + + /** + * The last four digits of the card. + */ + last4: string | null; + + /** + * True if this payment was marked as MOTO and out of scope for SCA. + */ + moto?: boolean | null; + + /** + * Identifies which network this charge was processed on. Can be `amex`, `diners`, `discover`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + network: string | null; + + /** + * Populated if this transaction used 3D Secure authentication. + */ + three_d_secure: Card.ThreeDSecure | null; + + /** + * If this Card is part of a card wallet, this contains the details of the card wallet. + */ + wallet: Card.Wallet | null; + } + + namespace Card { + interface Checks { + /** + * If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + */ + address_line1_check: string | null; + + /** + * If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + */ + address_postal_code_check: string | null; + + /** + * If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + */ + cvc_check: string | null; + } + + interface Installments { + /** + * Installment plan selected for the payment. + */ + plan: Installments.Plan | null; + } + + namespace Installments { + interface Plan { + /** + * For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + */ + count: number | null; + + /** + * For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + * One of `month`. + */ + interval: 'month' | null; + + /** + * Type of installment plan, one of `fixed_count`. + */ + type: 'fixed_count'; + } + } + + interface ThreeDSecure { + /** + * Whether or not authentication was performed. 3D Secure will succeed without authentication when the card is not enrolled. + */ + authenticated: boolean; + + /** + * Whether or not 3D Secure succeeded. + */ + succeeded: boolean; + + /** + * The version of 3D Secure that was used for this payment. + */ + version: string; + } + + interface Wallet { + amex_express_checkout?: Wallet.AmexExpressCheckout; + + apple_pay?: Wallet.ApplePay; + + /** + * (For tokenized numbers only.) The last four digits of the device account number. + */ + dynamic_last4: string | null; + + google_pay?: Wallet.GooglePay; + + masterpass?: Wallet.Masterpass; + + samsung_pay?: Wallet.SamsungPay; + + /** + * The type of the card wallet, one of `amex_express_checkout`, `apple_pay`, `google_pay`, `masterpass`, `samsung_pay`, or `visa_checkout`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type. + */ + type: Wallet.Type; + + visa_checkout?: Wallet.VisaCheckout; + } + + namespace Wallet { + interface AmexExpressCheckout {} + + interface ApplePay {} + + interface GooglePay {} + + interface Masterpass { + /** + * Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + billing_address: Address | null; + + /** + * Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + email: string | null; + + /** + * Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + name: string | null; + + /** + * Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + shipping_address: Address | null; + } + + interface SamsungPay {} + + type Type = + | 'amex_express_checkout' + | 'apple_pay' + | 'google_pay' + | 'masterpass' + | 'samsung_pay' + | 'visa_checkout'; + + interface VisaCheckout { + /** + * Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + billing_address: Address | null; + + /** + * Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + email: string | null; + + /** + * Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + name: string | null; + + /** + * Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + shipping_address: Address | null; + } + } + } + + interface CardPresent { + /** + * Card brand. Can be `amex`, `diners`, `discover`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + brand: string | null; + + /** + * Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + */ + country: string | null; + + /** + * Authorization response cryptogram. + */ + emv_auth_data: string | null; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number | null; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number | null; + + /** + * Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. + */ + fingerprint: string | null; + + /** + * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + */ + funding: string | null; + + /** + * ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod. + */ + generated_card: string | null; + + /** + * The last four digits of the card. + */ + last4: string | null; + + /** + * Identifies which network this charge was processed on. Can be `amex`, `diners`, `discover`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + network: string | null; + + /** + * How were card details read in this transaction. Can be contact_emv, contactless_emv, magnetic_stripe_fallback, magnetic_stripe_track2, or contactless_magstripe_mode + */ + read_method: string | null; + + /** + * A collection of fields required to be displayed on receipts. Only required for EMV transactions. + */ + receipt: CardPresent.Receipt | null; + } + + namespace CardPresent { + interface Receipt { + /** + * EMV tag 9F26, cryptogram generated by the integrated circuit chip. + */ + application_cryptogram: string | null; + + /** + * Mnenomic of the Application Identifier. + */ + application_preferred_name: string | null; + + /** + * Identifier for this transaction. + */ + authorization_code: string | null; + + /** + * EMV tag 8A. A code returned by the card issuer. + */ + authorization_response_code: string | null; + + /** + * How the cardholder verified ownership of the card. + */ + cardholder_verification_method: string | null; + + /** + * EMV tag 84. Similar to the application identifier stored on the integrated circuit chip. + */ + dedicated_file_name: string | null; + + /** + * The outcome of a series of EMV functions performed by the card reader. + */ + terminal_verification_results: string | null; + + /** + * An indication of various EMV functions performed during the transaction. + */ + transaction_status_information: string | null; + } + } + + interface Eps { + /** + * Owner's verified full name. Values are verified or provided by EPS directly + * (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + } + + interface Giropay { + /** + * Bank code of bank associated with the bank account. + */ + bank_code: string | null; + + /** + * Name of the bank associated with the bank account. + */ + bank_name: string | null; + + /** + * Bank Identifier Code of the bank associated with the bank account. + */ + bic: string | null; + + /** + * Owner's verified full name. Values are verified or provided by Giropay directly + * (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + } + + interface Ideal { + /** + * The customer's bank. Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `rabobank`, `regiobank`, `sns_bank`, `triodos_bank`, or `van_lanschot`. + */ + bank: Ideal.Bank | null; + + /** + * The Bank Identifier Code of the customer's bank. + */ + bic: Ideal.Bic | null; + + /** + * Last four characters of the IBAN. + */ + iban_last4: string | null; + + /** + * Owner's verified full name. Values are verified or provided by iDEAL directly + * (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + } + + namespace Ideal { + type Bank = + | 'abn_amro' + | 'asn_bank' + | 'bunq' + | 'handelsbanken' + | 'ing' + | 'knab' + | 'moneyou' + | 'rabobank' + | 'regiobank' + | 'sns_bank' + | 'triodos_bank' + | 'van_lanschot'; + + type Bic = + | 'ABNANL2A' + | 'ASNBNL21' + | 'BUNQNL2A' + | 'FVLBNL22' + | 'HANDNL2A' + | 'INGBNL2A' + | 'KNABNL2H' + | 'MOYONL21' + | 'RABONL2U' + | 'RBRBNL21' + | 'SNSBNL2A' + | 'TRIONL2U'; + } + + interface Klarna {} + + interface Multibanco { + /** + * Entity number associated with this Multibanco payment. + */ + entity: string | null; + + /** + * Reference number associated with this Multibanco payment. + */ + reference: string | null; + } + + interface P24 { + /** + * Unique reference for this Przelewy24 payment. + */ + reference: string | null; + + /** + * Owner's verified full name. Values are verified or provided by Przelewy24 directly + * (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + } + + interface SepaCreditTransfer { + /** + * Name of the bank associated with the bank account. + */ + bank_name: string | null; + + /** + * Bank Identifier Code of the bank associated with the bank account. + */ + bic: string | null; + + /** + * IBAN of the bank account to transfer funds to. + */ + iban: string | null; + } + + interface SepaDebit { + /** + * Bank code of bank associated with the bank account. + */ + bank_code: string | null; + + /** + * Branch code of bank associated with the bank account. + */ + branch_code: string | null; + + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string | null; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string | null; + + /** + * Last four characters of the IBAN. + */ + last4: string | null; + + /** + * ID of the mandate used to make this payment. + */ + mandate: string | null; + } + + interface Sofort { + /** + * Bank code of bank associated with the bank account. + */ + bank_code: string | null; + + /** + * Name of the bank associated with the bank account. + */ + bank_name: string | null; + + /** + * Bank Identifier Code of the bank associated with the bank account. + */ + bic: string | null; + + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string | null; + + /** + * Last four characters of the IBAN. + */ + iban_last4: string | null; + + /** + * Owner's verified full name. Values are verified or provided by SOFORT directly + * (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + } + + interface StripeAccount {} + + interface Wechat {} + } + + interface Shipping { + address?: Address; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string | null; + + /** + * Recipient name. + */ + name?: string | null; + + /** + * Recipient phone (including extension). + */ + phone?: string | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string | null; + } + + interface TransferData { + /** + * The amount transferred to the destination account, if specified. By default, the entire charge amount is transferred to the destination account. + */ + amount: number | null; + + /** + * ID of an existing, connected Stripe account to transfer funds to if `transfer_data` was specified in the charge request. + */ + destination: string | Account; + } + } + + interface ChargeCreateParams { + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount?: number; + + application_fee?: number; + + /** + * A fee in %s that will be applied to the charge and transferred to the application owner's Stripe account. The request must be made with an OAuth key or the `Stripe-Account` header in order to take an application fee. For more information, see the application fees [documentation](https://stripe.com/docs/connect/direct-charges#collecting-fees). + */ + 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](#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. + */ + capture?: boolean; + + /** + * 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; + + /** + * The ID of an existing customer that will be charged in this request. + */ + customer?: string; + + /** + * An arbitrary string which you can attach to a `Charge` object. It is displayed when in the web interface alongside the charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the `description` of the charge(s) that they are describing. + */ + description?: string; + + destination?: ChargeCreateParams.Destination; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * The Stripe account ID for which these funds are intended. Automatically set if you use the `destination` parameter. For details, see [Creating Separate Charges and Transfers](https://stripe.com/docs/connect/charges-transfers#on-behalf-of). + */ + on_behalf_of?: string; + + /** + * The email address to which this charge's [receipt](https://stripe.com/docs/dashboard/receipts) will be sent. The receipt will not be sent until the charge is paid, and no receipts will be sent for test mode charges. If this charge is for a [Customer](https://stripe.com/docs/api/customers/object), the email address specified here will override the customer's email address. If `receipt_email` is specified for a charge in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails). + */ + receipt_email?: string; + + /** + * Shipping information for the charge. Helps prevent fraud on charges for physical goods. + */ + shipping?: ChargeCreateParams.Shipping; + + /** + * A payment source to be charged. This can be the ID of a [card](https://stripe.com/docs/api#cards) (i.e., credit or debit card), a [bank account](https://stripe.com/docs/api#bank_accounts), a [source](https://stripe.com/docs/api#sources), a [token](https://stripe.com/docs/api#tokens), or a [connected account](https://stripe.com/docs/connect/account-debits#charging-a-connected-account). For certain sources---namely, [cards](https://stripe.com/docs/api#cards), [bank accounts](https://stripe.com/docs/api#bank_accounts), and attached [sources](https://stripe.com/docs/api#sources)---you must also pass the ID of the associated customer. + */ + source?: string; + + /** + * For card charges, use `statement_descriptor_suffix` instead. Otherwise, you can use this value as the complete description of a charge on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor?: string; + + /** + * Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix?: string; + + /** + * An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. + */ + transfer_data?: ChargeCreateParams.TransferData; + + /** + * A string that identifies this transaction as part of a group. For details, see [Grouping transactions](https://stripe.com/docs/connect/charges-transfers#grouping-transactions). + */ + transfer_group?: string; + } + + namespace ChargeCreateParams { + interface Destination { + /** + * ID of an existing, connected Stripe account. + */ + account: string; + + /** + * The amount to transfer to the destination account without creating an `Application Fee` object. Cannot be combined with the `application_fee` parameter. Must be less than or equal to the charge amount. + */ + amount?: number; + } + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + + interface TransferData { + /** + * The amount transferred to the destination account, if specified. By default, the entire charge amount is transferred to the destination account. + */ + amount?: number; + + /** + * ID of an existing, connected Stripe account. + */ + destination: string; + } + } + + interface ChargeRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ChargeUpdateParams { + /** + * The ID of an existing customer that will be associated with this request. This field may only be updated if there is no existing associated customer with this charge. + */ + customer?: string; + + /** + * An arbitrary string which you can attach to a charge object. It is displayed when in the web interface alongside the charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the `description` of the charge(s) that they are describing. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs you can attach to a charge giving information about its riskiness. If you believe a charge is fraudulent, include a `user_report` key with a value of `fraudulent`. If you believe a charge is safe, include a `user_report` key with a value of `safe`. Stripe will use the information you send to improve our fraud detection algorithms. + */ + fraud_details?: ChargeUpdateParams.FraudDetails; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * This is the email address that the receipt for this charge will be sent to. If this field is updated, then a new email receipt will be sent to the updated address. + */ + receipt_email?: string; + + /** + * Shipping information for the charge. Helps prevent fraud on charges for physical goods. + */ + shipping?: ChargeUpdateParams.Shipping; + + /** + * A string that identifies this transaction as part of a group. `transfer_group` may only be provided if it has not been set. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers#grouping-transactions) for details. + */ + transfer_group?: string; + } + + namespace ChargeUpdateParams { + interface FraudDetails { + user_report: FraudDetails.UserReport | null; + } + + namespace FraudDetails { + type UserReport = 'fraudulent' | 'safe'; + } + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + } + + interface ChargeListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Only return charges for the customer specified by this customer ID. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return charges that were created by the PaymentIntent specified by this PaymentIntent ID. + */ + payment_intent?: string; + + /** + * Only return charges for this transfer group. + */ + transfer_group?: string; + } + + interface ChargeCaptureParams { + /** + * The amount to capture, which must be less than or equal to the original amount. Any additional amount will be automatically refunded. + */ + amount?: number; + + /** + * An application fee to add on to this charge. Can only be used with Stripe Connect. + */ + application_fee?: number; + + /** + * An application fee amount to add on to this charge, which must be less than or equal to the original amount. Can only be used with Stripe Connect. + */ + application_fee_amount?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The email address to send this charge's receipt to. This will override the previously-specified email address for this charge, if one was set. Receipts will not be sent in test mode. + */ + receipt_email?: string; + + /** + * For card charges, use `statement_descriptor_suffix` instead. Otherwise, you can use this value as the complete description of a charge on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor?: string; + + /** + * Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix?: string; + + /** + * An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. + */ + transfer_data?: ChargeCaptureParams.TransferData; + + /** + * A string that identifies this transaction as part of a group. `transfer_group` may only be provided if it has not been set. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers#grouping-transactions) for details. + */ + transfer_group?: string; + } + + namespace ChargeCaptureParams { + interface TransferData { + /** + * The amount transferred to the destination account, if specified. By default, the entire charge amount is transferred to the destination account. + */ + amount?: number; + } + } + + class ChargesResource { + /** + * To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won't actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully). + */ + create( + params?: ChargeCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. The same information is returned when creating or refunding the charge. + */ + retrieve( + id: string, + params?: ChargeRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: ChargeUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of charges you've previously created. The charges are returned in sorted order, with the most recent charges appearing first. + */ + list( + params?: ChargeListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * 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. + */ + capture( + id: string, + params?: ChargeCaptureParams, + options?: RequestOptions + ): Promise; + capture(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Checkout/Sessions.d.ts b/types/2019-12-03/Checkout/Sessions.d.ts new file mode 100644 index 0000000000..1b2c5a42d2 --- /dev/null +++ b/types/2019-12-03/Checkout/Sessions.d.ts @@ -0,0 +1,552 @@ +declare module 'stripe' { + namespace Stripe { + namespace Checkout { + /** + * The Session object. + */ + interface Session { + /** + * Unique identifier for the object. Used to pass to `redirectToCheckout` + * in Stripe.js. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'checkout.session'; + + /** + * The value (`auto` or `required`) for whether Checkout collected the + * customer's billing address. + */ + billing_address_collection: string | null; + + /** + * The URL the customer will be directed to if they decide to cancel payment and return to your website. + */ + cancel_url: string; + + /** + * A unique string to reference the Checkout Session. This can be a + * customer ID, a cart ID, or similar, and can be used to reconcile the + * session with your internal systems. + */ + client_reference_id: string | null; + + /** + * The ID of the customer for this session. + * For Checkout Sessions in `payment` or `subscription` mode, Checkout + * will create a new customer object based on information provided + * during the session unless an existing customer was provided when + * the session was created. + */ + customer: string | Customer | null; + + /** + * If provided, this value will be used when the Customer object is created. + * If not provided, customers will be asked to enter their email address. + * Use this parameter to prefill customer data if you already have an email + * on file. To access information about the customer once a session is + * complete, use the `customer` field. + */ + customer_email: string | null; + + /** + * The line items, plans, or SKUs purchased by the customer. + */ + display_items: Array | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The IETF language tag of the locale Checkout is displayed in. If blank or `auto`, the browser's locale is used. + */ + locale: Session.Locale | null; + + /** + * The mode of the Checkout Session, one of `payment`, `setup`, or `subscription`. + */ + mode: Session.Mode | null; + + /** + * The ID of the PaymentIntent for Checkout Sessions in `payment` mode. + */ + payment_intent: string | PaymentIntent | null; + + /** + * A list of the types of payment methods (e.g. card) this Checkout + * Session is allowed to accept. + */ + payment_method_types: Array; + + /** + * The ID of the SetupIntent for Checkout Sessions in `setup` mode. + */ + setup_intent: string | SetupIntent | null; + + /** + * Describes the type of transaction being performed by Checkout in order to customize + * relevant text on the page, such as the submit button. `submit_type` can only be + * specified on Checkout Sessions in `payment` mode, but not Checkout Sessions + * in `subscription` or `setup` mode. + */ + submit_type: Session.SubmitType | null; + + /** + * The ID of the subscription for Checkout Sessions in `subscription` mode. + */ + subscription: string | Subscription | null; + + /** + * The URL the customer will be directed to after the payment or + * subscription creation is successful. + */ + success_url: string; + } + + namespace Session { + interface DisplayItem { + /** + * Amount for the display item. + */ + 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; + + custom?: DisplayItem.Custom; + + plan?: Plan; + + /** + * Quantity of the display item being purchased. + */ + quantity?: number; + + sku?: Sku; + + /** + * The type of display item. One of `custom`, `plan` or `sku` + */ + type?: string; + } + + namespace DisplayItem { + interface Custom { + /** + * The description of the line item. + */ + description: string | null; + + /** + * The images of the line item. + */ + images: Array | null; + + /** + * The name of the line item. + */ + name: string; + } + } + + type Locale = + | 'auto' + | 'da' + | 'de' + | 'en' + | 'es' + | 'fi' + | 'fr' + | 'it' + | 'ja' + | 'ms' + | 'nb' + | 'nl' + | 'pl' + | 'pt' + | 'sv' + | 'zh'; + + type Mode = 'payment' | 'setup' | 'subscription'; + + type SubmitType = 'auto' | 'book' | 'donate' | 'pay'; + } + + interface SessionCreateParams { + /** + * The URL the customer will be directed to if they decide to cancel payment and return to your website. + */ + cancel_url: string; + + /** + * A list of the types of payment methods (e.g. card) this Checkout + * Session is allowed to accept. The only supported values today are `card` and `ideal`. + */ + payment_method_types: Array; + + /** + * The URL to which Stripe should send customers when payment or setup + * is complete. + * If you'd like access to the Checkout Session for the successful + * payment, read more about it in our guide on [fulfilling your payments + * with webhooks](/docs/payments/checkout/fulfillment#webhooks). + */ + success_url: string; + + /** + * Specify whether Checkout should collect the customer's billing address. + */ + billing_address_collection?: SessionCreateParams.BillingAddressCollection; + + /** + * A unique string to reference the Checkout Session. This can be a + * customer ID, a cart ID, or similar, and can be used to reconcile the + * session with your internal systems. + */ + client_reference_id?: string; + + /** + * ID of an existing customer, if one exists. Only supported for Checkout + * Sessions in `payment` or `subscription` mode, but not Checkout Sessions + * in `setup` mode. The email stored on the customer will be used to prefill + * the email field on the Checkout page. If the customer changes their email + * on the Checkout page, the Customer object will be updated with the new + * email. + * If blank for Checkout Sessions in `payment` or `subscription` mode, + * Checkout will create a new customer object based on information + * provided during the session. + */ + customer?: string; + + /** + * If provided, this value will be used when the Customer object is created. + * If not provided, customers will be asked to enter their email address. + * Use this parameter to prefill customer data if you already have an email + * on file. To access information about the customer once a session is + * complete, use the `customer` field. + */ + customer_email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A list of items the customer is purchasing. Use this parameter for + * one-time payments or adding invoice line items to a subscription (used + * in conjunction with `subscription_data`). + */ + line_items?: Array; + + /** + * The IETF language tag of the locale Checkout is displayed in. If blank or `auto`, the browser's locale is used. + */ + locale?: SessionCreateParams.Locale; + + /** + * The mode of the Checkout Session, one of `payment`, `setup`, or `subscription`. + */ + mode?: SessionCreateParams.Mode; + + /** + * A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. + */ + payment_intent_data?: SessionCreateParams.PaymentIntentData; + + /** + * A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in `setup` mode. + */ + setup_intent_data?: SessionCreateParams.SetupIntentData; + + /** + * Describes the type of transaction being performed by Checkout in order to customize + * relevant text on the page, such as the submit button. `submit_type` can only be + * specified on Checkout Sessions in `payment` mode, but not Checkout Sessions + * in `subscription` or `setup` mode. + */ + submit_type?: SessionCreateParams.SubmitType; + + /** + * A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode. + */ + subscription_data?: SessionCreateParams.SubscriptionData; + } + + namespace SessionCreateParams { + type BillingAddressCollection = 'auto' | 'required'; + + interface LineItem { + /** + * The amount to be collected per unit of the line item. + */ + 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; + + /** + * The description for the line item. + */ + description?: string; + + /** + * A list of images representing this line item. + */ + images?: Array; + + /** + * The name for the line item. + */ + name: string; + + /** + * The quantity of the line item being purchased. + */ + quantity: number; + } + + type Locale = + | 'auto' + | 'da' + | 'de' + | 'en' + | 'es' + | 'fi' + | 'fr' + | 'it' + | 'ja' + | 'ms' + | 'nb' + | 'nl' + | 'pl' + | 'pt' + | 'sv' + | 'zh'; + + type Mode = 'payment' | 'setup' | 'subscription'; + + interface PaymentIntentData { + /** + * The amount of the application fee (if any) that will be applied to the payment and transferred to the + * application owner's Stripe account. To use an application fee, the request must be made on + * behalf of another account, using the `Stripe-Account` header or an OAuth key. For more + * information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + application_fee_amount?: number; + + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: PaymentIntentData.CaptureMethod; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * The Stripe account ID for which these funds are intended. For details, + * see the PaymentIntents [use case for connected + * accounts](/docs/payments/connected-accounts). + */ + on_behalf_of?: string; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If present, the payment method used with this PaymentIntent can be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer, even after the transaction completes. + * + * For more, learn to [save card details after a payment](https://stripe.com/docs/payments/save-after-payment). + * + * Stripe uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by [SCA](https://stripe.com/docs/strong-customer-authentication), using `off_session` will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect [off-session payments](https://stripe.com/docs/payments/cards/charging-saved-cards#off-session-payments-with-saved-cards) for this customer. + */ + setup_future_usage?: PaymentIntentData.SetupFutureUsage; + + /** + * Shipping information for this payment. + */ + shipping?: PaymentIntentData.Shipping; + + /** + * Extra information about the payment. This will appear on your + * customer's statement when this payment succeeds in creating a charge. + */ + statement_descriptor?: string; + + /** + * The parameters used to automatically create a Transfer when the payment succeeds. + * For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + transfer_data?: PaymentIntentData.TransferData; + } + + namespace PaymentIntentData { + type CaptureMethod = 'automatic' | 'manual'; + + type SetupFutureUsage = 'off_session' | 'on_session'; + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + + interface TransferData { + /** + * If specified, successful charges will be attributed to the destination + * account for tax reporting, and the funds from charges will be transferred + * to the destination account. The ID of the resulting transfer will be + * returned on the successful charge's `transfer` field. + */ + destination: string; + } + } + + type PaymentMethodType = 'card' | 'ideal'; + + interface SetupIntentData { + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * The Stripe account for which the setup is intended. + */ + on_behalf_of?: string; + } + + type SubmitType = 'auto' | 'book' | 'donate' | 'pay'; + + interface SubscriptionData { + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. To use an application fee percent, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). + */ + application_fee_percent?: number; + + /** + * 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`. + */ + items: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Unix timestamp representing the end of the trial period the customer + * will get before being charged for the first time. Has to be at least + * 48 hours in the future. + */ + trial_end?: number; + + /** + * Indicates if a plan's `trial_period_days` should be applied to the + * subscription. Setting `trial_end` on `subscription_data` is preferred. + * Defaults to `false`. + */ + trial_from_plan?: boolean; + + /** + * Integer representing the number of trial period days before the + * customer is charged for the first time. Has to be at least 1. + */ + trial_period_days?: number; + } + + namespace SubscriptionData { + interface Item { + /** + * Plan ID for this item. + */ + plan: string; + + /** + * Quantity for this item. + */ + quantity?: number; + } + } + } + + interface SessionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class SessionsResource { + /** + * Creates a Session object. + */ + create( + params: SessionCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a Session object. + */ + retrieve( + id: string, + params?: SessionRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/ConnectCollectionTransfers.d.ts b/types/2019-12-03/ConnectCollectionTransfers.d.ts new file mode 100644 index 0000000000..c134cb4e9b --- /dev/null +++ b/types/2019-12-03/ConnectCollectionTransfers.d.ts @@ -0,0 +1,38 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The ConnectCollectionTransfer object. + */ + interface ConnectCollectionTransfer { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'connect_collection_transfer'; + + /** + * Amount transferred, in %s. + */ + 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; + + /** + * ID of the account that funds are being collected for. + */ + destination: string | Account; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + } + } +} diff --git a/types/2019-12-03/CountrySpecs.d.ts b/types/2019-12-03/CountrySpecs.d.ts new file mode 100644 index 0000000000..1af360dd3c --- /dev/null +++ b/types/2019-12-03/CountrySpecs.d.ts @@ -0,0 +1,116 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The CountrySpec object. + */ + interface CountrySpec { + /** + * Unique identifier for the object. Represented as the ISO country code for this country. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'country_spec'; + + /** + * The default currency for this country. This applies to both payment methods and bank accounts. + */ + default_currency: string; + + /** + * Currencies that can be accepted in the specific country (for transfers). + */ + supported_bank_account_currencies: { + [key: string]: Array; + }; + + /** + * Currencies that can be accepted in the specified country (for payments). + */ + supported_payment_currencies: Array; + + /** + * Payment methods available in the specified country. You may need to enable some payment methods (e.g., [ACH](https://stripe.com/docs/ach)) on your account before they appear in this list. The `stripe` payment method refers to [charging through your platform](https://stripe.com/docs/connect/destination-charges). + */ + supported_payment_methods: Array; + + /** + * Countries that can accept transfers from the specified country. + */ + supported_transfer_countries: Array; + + verification_fields: CountrySpec.VerificationFields; + } + + namespace CountrySpec { + interface VerificationFields { + company: VerificationFields.Company; + + individual: VerificationFields.Individual; + } + + namespace VerificationFields { + interface Company { + /** + * Additional fields which are only required for some users. + */ + additional: Array; + + /** + * Fields which every account must eventually provide. + */ + minimum: Array; + } + + interface Individual { + /** + * Additional fields which are only required for some users. + */ + additional: Array; + + /** + * Fields which every account must eventually provide. + */ + minimum: Array; + } + } + } + + interface CountrySpecRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CountrySpecListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class CountrySpecsResource { + /** + * Returns a Country Spec for a given Country code. + */ + retrieve( + id: string, + params?: CountrySpecRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Lists all Country Spec objects available in the API. + */ + list( + params?: CountrySpecListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Coupons.d.ts b/types/2019-12-03/Coupons.d.ts new file mode 100644 index 0000000000..393750a6d5 --- /dev/null +++ b/types/2019-12-03/Coupons.d.ts @@ -0,0 +1,258 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Coupon object. + */ + interface Coupon { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'coupon'; + + /** + * Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer. + */ + amount_off: number | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off. + */ + currency: string | null; + + deleted?: void; + + /** + * One of `forever`, `once`, and `repeating`. Describes how long a customer who applies this coupon will get the discount. + */ + duration: Coupon.Duration; + + /** + * If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`. + */ + duration_in_months: number | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. + */ + max_redemptions: number | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * Name of the coupon displayed to customers on for instance invoices or receipts. + */ + name: string | null; + + /** + * Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead. + */ + percent_off: number | null; + + /** + * Date after which the coupon can no longer be redeemed. + */ + redeem_by: number | null; + + /** + * Number of times this coupon has been applied to a customer. + */ + times_redeemed: number; + + /** + * Taking account of the above properties, whether this coupon can still be applied to a customer. + */ + valid: boolean; + } + + namespace Coupon { + type Duration = 'forever' | 'once' | 'repeating'; + } + + /** + * The DeletedCoupon object. + */ + interface DeletedCoupon { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'coupon'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface CouponCreateParams { + /** + * Specifies how long the discount will be in effect. Can be `forever`, `once`, or `repeating`. + */ + duration: CouponCreateParams.Duration; + + /** + * A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed). + */ + amount_off?: number; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed). + */ + currency?: string; + + /** + * Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect. + */ + duration_in_months?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Unique string of your choice that will be used to identify this coupon when applying it to a customer. This is often a specific code you'll give to your customer to use when signing up (e.g., `FALL25OFF`). If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you. + */ + id?: string; + + /** + * A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid. For example, you might have a 50% off coupon that the first 20 readers of your blog can use. + */ + max_redemptions?: number; + + /** + * A set of key-value pairs that you can attach to a coupon object. It can be useful for storing additional information about the coupon in a structured format. + */ + metadata?: MetadataParam; + + /** + * Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. + */ + name?: string; + + /** + * A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed). + */ + percent_off?: number; + + /** + * Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers. + */ + redeem_by?: number; + } + + namespace CouponCreateParams { + type Duration = 'forever' | 'once' | 'repeating'; + } + + interface CouponRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CouponUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to a coupon object. It can be useful for storing additional information about the coupon in a structured format. + */ + metadata?: MetadataParam; + + /** + * Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. + */ + name?: string; + } + + interface CouponListParams extends PaginationParams { + /** + * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CouponDeleteParams {} + + class CouponsResource { + /** + * You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly. + * + * A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it. + */ + create( + params: CouponCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the coupon with the given ID. + */ + retrieve( + id: string, + params?: CouponRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable. + */ + update( + id: string, + params?: CouponUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your coupons. + */ + list( + params?: CouponListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API. + */ + del( + id: string, + params?: CouponDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/CreditNotes.d.ts b/types/2019-12-03/CreditNotes.d.ts new file mode 100644 index 0000000000..4b3e7e3668 --- /dev/null +++ b/types/2019-12-03/CreditNotes.d.ts @@ -0,0 +1,347 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The CreditNote object. + */ + interface CreditNote { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'credit_note'; + + /** + * The integer amount in **%s** representing the total amount of the credit note, including tax. + */ + amount: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * ID of the customer. + */ + customer: string | Customer; + + /** + * Customer balance transaction related to this credit note. + */ + customer_balance_transaction: string | CustomerBalanceTransaction | null; + + /** + * ID of the invoice. + */ + invoice: string | Invoice; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Customer-facing text that appears on the credit note PDF. + */ + memo: string | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice. + */ + number: string; + + /** + * The link to download the PDF of the credit note. + */ + pdf: string; + + /** + * Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` + */ + reason: CreditNote.Reason | null; + + /** + * Refund related to this credit note. + */ + refund: string | Refund | null; + + /** + * Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). + */ + status: CreditNote.Status; + + /** + * Type of this credit note, one of `post_payment` or `pre_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid. + */ + type: CreditNote.Type; + + /** + * The time that the credit note was voided. + */ + voided_at: number | null; + } + + namespace CreditNote { + type Reason = + | 'duplicate' + | 'fraudulent' + | 'order_change' + | 'product_unsatisfactory'; + + type Status = 'issued' | 'void'; + + type Type = 'post_payment' | 'pre_payment'; + } + + interface CreditNoteCreateParams { + /** + * ID of the invoice. + */ + invoice: string; + + /** + * The integer amount in **%s** representing the total amount of the credit note. + */ + amount?: number; + + /** + * The integer amount in **%s** representing the amount to credit the customer's balance, which will be automatically applied to their next invoice. + */ + credit_amount?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The credit note's memo appears on the credit note PDF. + */ + memo?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The integer amount in **%s** representing the amount that is credited outside of Stripe. + */ + out_of_band_amount?: number; + + /** + * Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` + */ + reason?: CreditNoteCreateParams.Reason; + + /** + * ID of an existing refund to link this credit note to. + */ + refund?: string; + + /** + * The integer amount in **%s** representing the amount to refund. If set, a refund will be created for the charge associated with the invoice. + */ + refund_amount?: number; + } + + namespace CreditNoteCreateParams { + type Reason = + | 'duplicate' + | 'fraudulent' + | 'order_change' + | 'product_unsatisfactory'; + } + + interface CreditNoteRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CreditNoteUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Credit note memo. + */ + memo?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface CreditNoteListParams extends PaginationParams { + /** + * Only return credit notes for the customer specified by this customer ID. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return credit notes for the invoice specified by this invoice ID. + */ + invoice?: string; + } + + interface CreditNotePreviewParams { + /** + * ID of the invoice. + */ + invoice: string; + + /** + * The integer amount in **%s** representing the total amount of the credit note. + */ + amount?: number; + + /** + * The integer amount in **%s** representing the amount to credit the customer's balance, which will be automatically applied to their next invoice. + */ + credit_amount?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The credit note's memo appears on the credit note PDF. + */ + memo?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The integer amount in **%s** representing the amount that is credited outside of Stripe. + */ + out_of_band_amount?: number; + + /** + * Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` + */ + reason?: CreditNotePreviewParams.Reason; + + /** + * ID of an existing refund to link this credit note to. + */ + refund?: string; + + /** + * The integer amount in **%s** representing the amount to refund. If set, a refund will be created for the charge associated with the invoice. + */ + refund_amount?: number; + } + + namespace CreditNotePreviewParams { + type Reason = + | 'duplicate' + | 'fraudulent' + | 'order_change' + | 'product_unsatisfactory'; + } + + interface CreditNoteVoidCreditNoteParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class CreditNotesResource { + /** + * Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces + * its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result + * in any combination of the following: + * + * + * Refund: create a new refund (using refund_amount) or link an existing refund (using refund). + * Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized. + * Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount). + * + * + * For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total. + * + * You may issue multiple credit notes for an invoice. Each credit note will increment the invoice's pre_payment_credit_notes_amount + * or post_payment_credit_notes_amount depending on its status at the time of credit note creation. + */ + create( + params: CreditNoteCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the credit note object with the given identifier. + */ + retrieve( + id: string, + params?: CreditNoteRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates an existing credit note. + */ + update( + id: string, + params?: CreditNoteUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of credit notes. + */ + list( + params?: CreditNoteListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Get a preview of a credit note without creating it. + */ + preview( + params: CreditNotePreviewParams, + options?: RequestOptions + ): Promise; + + /** + * Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). + */ + voidCreditNote( + id: string, + params?: CreditNoteVoidCreditNoteParams, + options?: RequestOptions + ): Promise; + voidCreditNote(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/CustomerBalanceTransactions.d.ts b/types/2019-12-03/CustomerBalanceTransactions.d.ts new file mode 100644 index 0000000000..9945d5fb41 --- /dev/null +++ b/types/2019-12-03/CustomerBalanceTransactions.d.ts @@ -0,0 +1,144 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The CustomerBalanceTransaction object. + */ + interface CustomerBalanceTransaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'customer_balance_transaction'; + + /** + * The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's `balance`. + */ + amount: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The ID of the credit note (if any) related to the transaction. + */ + credit_note: string | CreditNote | 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; + + /** + * The ID of the customer the transaction belongs to. + */ + customer: string | Customer; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * The customer's `balance` after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice. + */ + ending_balance: number; + + /** + * The ID of the invoice (if any) related to the transaction. + */ + invoice: string | Invoice | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata | null; + + /** + * Transaction type: `adjustment`, `applied_to_invoice`, `credit_note`, `initial`, `invoice_too_large`, `invoice_too_small`, `unapplied_from_invoice`, or `unspent_receiver_credit`. See the [Customer Balance page](https://stripe.com/docs/billing/customer/balance#types) to learn more about transaction types. + */ + type: CustomerBalanceTransaction.Type; + } + + namespace CustomerBalanceTransaction { + type Type = + | 'adjustment' + | 'applied_to_invoice' + | 'credit_note' + | 'initial' + | 'invoice_too_large' + | 'invoice_too_small' + | 'migration' + | 'unapplied_from_invoice' + | 'unspent_receiver_credit'; + } + + interface CustomerBalanceTransactionCreateParams { + /** + * The integer amount in **%s** to apply to the customer's balance. Pass a negative amount to credit the customer's balance, and pass in a positive amount to debit the customer's balance. + */ + 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). If the customer's [`currency`](https://stripe.com/docs/api/customers/object#customer_object-currency) is set, this value must match it. If the customer's `currency` is not set, it will be updated to this value. + */ + currency: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + } + + interface CustomerBalanceTransactionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CustomerBalanceTransactionUpdateParams { + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + } + + interface CustomerBalanceTransactionListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } +} diff --git a/types/2019-12-03/CustomerSources.d.ts b/types/2019-12-03/CustomerSources.d.ts new file mode 100644 index 0000000000..931cf03da6 --- /dev/null +++ b/types/2019-12-03/CustomerSources.d.ts @@ -0,0 +1,161 @@ +declare module 'stripe' { + namespace Stripe { + interface CustomerSourceCreateParams { + /** + * Please refer to full [documentation](https://stripe.com/docs/api) instead. + */ + source: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to a card object. It can be useful for storing additional information about the card in a structured format. + */ + metadata?: MetadataParam; + } + + interface CustomerSourceRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CustomerSourceUpdateParams { + /** + * The name of the person or business that owns the bank account. + */ + account_holder_name?: string; + + /** + * The type of entity that holds the account. This can be either `individual` or `company`. + */ + account_holder_type?: CustomerSourceUpdateParams.AccountHolderType; + + /** + * City/District/Suburb/Town/Village. + */ + address_city?: string; + + /** + * Billing address country, if provided when creating card. + */ + address_country?: string; + + /** + * Address line 1 (Street address/PO Box/Company name). + */ + address_line1?: string; + + /** + * Address line 2 (Apartment/Suite/Unit/Building). + */ + address_line2?: string; + + /** + * State/County/Province/Region. + */ + address_state?: string; + + /** + * ZIP or postal code. + */ + address_zip?: string; + + /** + * Two digit number representing the card's expiration month. + */ + exp_month?: string; + + /** + * Four digit number representing the card's expiration year. + */ + exp_year?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + metadata?: MetadataParam; + + /** + * Cardholder name. + */ + name?: string; + + owner?: CustomerSourceUpdateParams.Owner; + } + + namespace CustomerSourceUpdateParams { + type AccountHolderType = 'company' | 'individual'; + + interface Owner { + /** + * Owner's address. + */ + address?: Owner.Address; + + /** + * Owner's email address. + */ + email?: string; + + /** + * Owner's full name. + */ + name?: string; + + /** + * Owner's phone number. + */ + phone?: string; + } + + namespace Owner { + interface Address { + city?: string; + + country?: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + } + + interface CustomerSourceListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Filter sources according to a particular object type. + */ + object?: string; + } + + interface CustomerSourceDeleteParams {} + + interface CustomerSourceVerifyParams { + /** + * Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. + */ + amounts?: Array; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } +} diff --git a/types/2019-12-03/Customers.d.ts b/types/2019-12-03/Customers.d.ts new file mode 100644 index 0000000000..245e9418ef --- /dev/null +++ b/types/2019-12-03/Customers.d.ts @@ -0,0 +1,780 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Customer object. + */ + interface Customer { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'customer'; + + /** + * The customer's address. + */ + address: Address | null; + + /** + * Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized. + */ + balance: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes. + */ + currency: string | null; + + /** + * ID of the default payment source for the customer. + * + * If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead. + */ + default_source: string | CustomerSource | null; + + deleted?: void; + + /** + * When the customer's latest invoice is billed by charging automatically, delinquent is true if the invoice's latest charge is failed. When the customer's latest invoice is billed by sending an invoice, delinquent is true if the invoice is not paid by its due date. + */ + delinquent: boolean | null; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * Describes the current discount active on the customer, if there is one. + */ + discount: Discount | null; + + /** + * The customer's email address. + */ + email: string | null; + + /** + * The prefix for the customer used to generate unique invoice numbers. + */ + invoice_prefix: string | null; + + invoice_settings: Customer.InvoiceSettings; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The customer's full name or business name. + */ + name: string | null; + + /** + * The customer's phone number. + */ + phone: string | null; + + /** + * The customer's preferred locales (languages), ordered by preference. + */ + preferred_locales: Array | null; + + /** + * Mailing and shipping address for the customer. Appears on invoices emailed to this customer. + */ + shipping: Customer.Shipping | null; + + /** + * The customer's payment sources, if any. + */ + sources: ApiList; + + /** + * The customer's current subscriptions, if any. + */ + subscriptions?: ApiList; + + /** + * Describes the customer's tax exemption status. One of `none`, `exempt`, or `reverse`. When set to `reverse`, invoice and receipt PDFs include the text **"Reverse charge"**. + */ + tax_exempt?: Customer.TaxExempt | null; + + /** + * The customer's tax IDs. + */ + tax_ids: ApiList; + } + + namespace Customer { + interface InvoiceSettings { + /** + * Default custom fields to be displayed on invoices for this customer. + */ + custom_fields: Array | null; + + /** + * ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. + */ + default_payment_method: string | PaymentMethod | null; + + /** + * Default footer to be displayed on invoices for this customer. + */ + footer: string | null; + } + + namespace InvoiceSettings { + interface CustomField { + /** + * The name of the custom field. + */ + name: string; + + /** + * The value of the custom field. + */ + value: string; + } + } + + interface Shipping { + address?: Address; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string | null; + + /** + * Recipient name. + */ + name?: string | null; + + /** + * Recipient phone (including extension). + */ + phone?: string | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string | null; + } + + type TaxExempt = 'exempt' | 'none' | 'reverse'; + } + + /** + * The DeletedCustomer object. + */ + interface DeletedCustomer { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'customer'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface CustomerCreateParams { + /** + * The customer's address. + */ + address?: AddressParam | ''; + + /** + * An integer amount in %s that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. + */ + balance?: number; + + coupon?: string; + + /** + * An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. + */ + description?: string; + + /** + * Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to *512 characters*. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers. + */ + invoice_prefix?: string; + + /** + * Default invoice settings for this customer. + */ + invoice_settings?: CustomerCreateParams.InvoiceSettings; + + /** + * A set of key-value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format. + */ + metadata?: MetadataParam; + + /** + * The customer's full name or business name. + */ + name?: string; + + payment_method?: string; + + /** + * The customer's phone number. + */ + phone?: string; + + /** + * Customer's preferred languages, ordered by preference. + */ + preferred_locales?: Array; + + /** + * The customer's shipping information. Appears on invoices emailed to this customer. + */ + shipping?: CustomerCreateParams.Shipping | null; + + source?: string; + + /** + * The customer's tax exemption. One of `none`, `exempt`, or `reverse`. + */ + tax_exempt?: CustomerCreateParams.TaxExempt | null; + + /** + * The customer's tax IDs. + */ + tax_id_data?: Array; + } + + namespace CustomerCreateParams { + interface InvoiceSettings { + /** + * Default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields. + */ + custom_fields?: InvoiceSettings.CustomFields | null; + + /** + * ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. + */ + default_payment_method?: string; + + /** + * Default footer to be displayed on invoices for this customer. + */ + footer?: string; + } + + namespace InvoiceSettings { + interface CustomFields { + /** + * The name of the custom field. This may be up to 30 characters. + */ + name: string; + + /** + * The value of the custom field. This may be up to 30 characters. + */ + value: string; + } + } + + interface Shipping { + /** + * Customer shipping address. + */ + address: AddressParam; + + /** + * Customer name. + */ + name: string; + + /** + * Customer phone (including extension). + */ + phone?: string; + } + + type TaxExempt = 'exempt' | 'none' | 'reverse'; + + interface TaxIdDatum { + /** + * Type of the tax ID, one of `au_abn`, `ch_vat`, `eu_vat`, `in_gst`, `mx_rfc`, `no_vat`, `nz_gst`, or `za_vat` + */ + type: TaxIdDatum.Type; + + /** + * Value of the tax ID. + */ + value: string; + } + + namespace TaxIdDatum { + type Type = + | 'au_abn' + | 'ch_vat' + | 'eu_vat' + | 'in_gst' + | 'mx_rfc' + | 'no_vat' + | 'nz_gst' + | 'za_vat'; + } + } + + interface CustomerRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CustomerUpdateParams { + /** + * The customer's address. + */ + address?: AddressParam | ''; + + /** + * An integer amount in %s that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. + */ + balance?: number; + + coupon?: string; + + /** + * If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) parameter. + * + * Provide the ID of a payment source already attached to this customer to make it this customer's default payment source. + * + * If you want to add a new payment source and make it the default, see the [source](https://stripe.com/docs/api/customers/update#update_customer-source) property. + */ + default_source?: string; + + /** + * An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. + */ + description?: string; + + /** + * Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to *512 characters*. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers. + */ + invoice_prefix?: string; + + /** + * Default invoice settings for this customer. + */ + invoice_settings?: CustomerUpdateParams.InvoiceSettings; + + /** + * A set of key-value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format. + */ + metadata?: MetadataParam; + + /** + * The customer's full name or business name. + */ + name?: string; + + /** + * The customer's phone number. + */ + phone?: string; + + /** + * Customer's preferred languages, ordered by preference. + */ + preferred_locales?: Array; + + /** + * The customer's shipping information. Appears on invoices emailed to this customer. + */ + shipping?: CustomerUpdateParams.Shipping | null; + + source?: string; + + /** + * The customer's tax exemption. One of `none`, `exempt`, or `reverse`. + */ + tax_exempt?: CustomerUpdateParams.TaxExempt | null; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. + */ + trial_end?: 'now' | number; + } + + namespace CustomerUpdateParams { + interface InvoiceSettings { + /** + * Default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields. + */ + custom_fields?: InvoiceSettings.CustomFields | null; + + /** + * ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. + */ + default_payment_method?: string; + + /** + * Default footer to be displayed on invoices for this customer. + */ + footer?: string; + } + + namespace InvoiceSettings { + interface CustomFields { + /** + * The name of the custom field. This may be up to 30 characters. + */ + name: string; + + /** + * The value of the custom field. This may be up to 30 characters. + */ + value: string; + } + } + + interface Shipping { + /** + * Customer shipping address. + */ + address: AddressParam; + + /** + * Customer name. + */ + name: string; + + /** + * Customer phone (including extension). + */ + phone?: string; + } + + type TaxExempt = 'exempt' | 'none' | 'reverse'; + } + + interface CustomerListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * A filter on the list based on the customer's `email` field. The value must be a string. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CustomerDeleteParams {} + + interface CustomerDeleteDiscountParams {} + + class CustomersResource { + /** + * Creates a new customer object. + */ + create( + params?: CustomerCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of an existing customer. You need only supply the unique customer identifier that was returned upon customer creation. + */ + retrieve( + id: string, + params?: CustomerRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the source parameter, that becomes the customer's active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the source parameter: for each of the customer's current subscriptions, if the subscription bills automatically and is in the past_due state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the default_source for a customer will not trigger this behavior. + * + * This request accepts mostly the same arguments as the customer creation call. + */ + update( + id: string, + params?: CustomerUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first. + */ + list( + params?: CustomerListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer. + */ + del( + id: string, + params?: CustomerDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + + /** + * Removes the currently applied discount on a customer. + */ + deleteDiscount( + id: string, + params?: CustomerDeleteDiscountParams, + options?: RequestOptions + ): Promise; + deleteDiscount( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Creates an immutable transaction that updates the customer's [balance](https://stripe.com/docs/api/customers/object#customer_object-balance). + */ + createBalanceTransaction( + id: string, + params: CustomerBalanceTransactionCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a specific transaction that updated the customer's [balance](https://stripe.com/docs/api/customers/object#customer_object-balance). + */ + retrieveBalanceTransaction( + customerId: string, + id: string, + params?: CustomerBalanceTransactionRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveBalanceTransaction( + customerId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Most customer balance transaction fields are immutable, but you may update its description and metadata. + */ + updateBalanceTransaction( + customerId: string, + id: string, + params?: CustomerBalanceTransactionUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of transactions that updated the customer's [balance](https://stripe.com/docs/api/customers/object#customer_object-balance). + */ + listBalanceTransactions( + id: string, + params?: CustomerBalanceTransactionListParams, + options?: RequestOptions + ): ApiListPromise; + listBalanceTransactions( + id: string, + options?: RequestOptions + ): ApiListPromise; + + /** + * When you create a new credit card, you must specify a customer or recipient on which to create it. + * + * If the card's owner has no default card, then the new card will become the default. + * However, if the owner already has a default, then it will not change. + * To change the default, you should [update the customer](https://stripe.com/docs/api#update_customer) to have a new default_source. + */ + createSource( + id: string, + params: CustomerSourceCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieve a specified source for a given customer. + */ + retrieveSource( + customerId: string, + id: string, + params?: CustomerSourceRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveSource( + customerId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Update a specified source for a given customer. + */ + updateSource( + customerId: string, + id: string, + params?: CustomerSourceUpdateParams, + options?: RequestOptions + ): Promise; + updateSource( + customerId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * List sources for a specified customer. + */ + listSources( + id: string, + params?: CustomerSourceListParams, + options?: RequestOptions + ): ApiListPromise; + listSources( + id: string, + options?: RequestOptions + ): ApiListPromise; + + /** + * Delete a specified source for a given customer. + */ + deleteSource( + customerId: string, + id: string, + params?: CustomerSourceDeleteParams, + options?: RequestOptions + ): Promise< + | CustomerSource + | DeletedAlipayAccount + | DeletedBankAccount + | DeletedBitcoinReceiver + | DeletedCard + >; + deleteSource( + customerId: string, + id: string, + options?: RequestOptions + ): Promise< + | CustomerSource + | DeletedAlipayAccount + | DeletedBankAccount + | DeletedBitcoinReceiver + | DeletedCard + >; + + /** + * Verify a specified bank account for a given customer. + */ + verifySource( + customerId: string, + id: string, + params?: CustomerSourceVerifyParams, + options?: RequestOptions + ): Promise; + verifySource( + customerId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Creates a new TaxID object for a customer. + */ + createTaxId( + id: string, + params: TaxIdCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the TaxID object with the given identifier. + */ + retrieveTaxId( + customerId: string, + id: string, + params?: TaxIdRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveTaxId( + customerId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of tax IDs for a customer. + */ + listTaxIds( + id: string, + params?: TaxIdListParams, + options?: RequestOptions + ): ApiListPromise; + listTaxIds(id: string, options?: RequestOptions): ApiListPromise; + + /** + * Deletes an existing TaxID object. + */ + deleteTaxId( + customerId: string, + id: string, + params?: TaxIdDeleteParams, + options?: RequestOptions + ): Promise; + deleteTaxId( + customerId: string, + id: string, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/Discounts.d.ts b/types/2019-12-03/Discounts.d.ts new file mode 100644 index 0000000000..1ea7d0afaa --- /dev/null +++ b/types/2019-12-03/Discounts.d.ts @@ -0,0 +1,49 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Discount object. + */ + interface Discount { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'discount'; + + coupon: Coupon; + + customer: string | Customer | DeletedCustomer | null; + + deleted?: void; + + /** + * If the coupon has a duration of `repeating`, the date that this discount will end. If the coupon has a duration of `once` or `forever`, this attribute will be null. + */ + end: number | null; + + /** + * Date that the coupon was applied. + */ + start: number; + + /** + * The subscription that this coupon is applied to, if it is applied to a particular subscription. + */ + subscription: string | null; + } + + /** + * The DeletedDiscount object. + */ + interface DeletedDiscount { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'discount'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + } +} diff --git a/types/2019-12-03/Disputes.d.ts b/types/2019-12-03/Disputes.d.ts new file mode 100644 index 0000000000..7b10b1f318 --- /dev/null +++ b/types/2019-12-03/Disputes.d.ts @@ -0,0 +1,434 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Dispute object. + */ + interface Dispute { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'dispute'; + + /** + * Disputed amount. Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed). + */ + amount: number; + + /** + * List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute. + */ + balance_transactions: Array; + + /** + * ID of the charge that was disputed. + */ + charge: string | Charge; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + evidence: Dispute.Evidence; + + evidence_details: Dispute.EvidenceDetails; + + /** + * If true, it is still possible to refund the disputed payment. Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute. + */ + is_charge_refundable: boolean; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * Network-dependent reason code for the dispute. + */ + network_reason_code?: string | null; + + /** + * ID of the PaymentIntent that was disputed. + */ + payment_intent: string | PaymentIntent | null; + + /** + * Reason given by cardholder for dispute. Possible values are `bank_cannot_process`, `check_returned`, `credit_not_processed`, `customer_initiated`, `debit_not_authorized`, `duplicate`, `fraudulent`, `general`, `incorrect_account_details`, `insufficient_funds`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`. Read more about [dispute reasons](https://stripe.com/docs/disputes/categories). + */ + reason: string; + + /** + * Current status of dispute. Possible values are `warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `charge_refunded`, `won`, or `lost`. + */ + status: Dispute.Status; + } + + namespace Dispute { + interface Evidence { + /** + * Any server or activity logs showing proof that the customer accessed or downloaded the purchased digital product. This information should include IP addresses, corresponding timestamps, and any detailed recorded activity. + */ + access_activity_log: string | null; + + /** + * The billing address provided by the customer. + */ + billing_address: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your subscription cancellation policy, as shown to the customer. + */ + cancellation_policy: string | File | null; + + /** + * An explanation of how and when the customer was shown your refund policy prior to purchase. + */ + cancellation_policy_disclosure: string | null; + + /** + * A justification for why the customer's subscription was not canceled. + */ + cancellation_rebuttal: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any communication with the customer that you feel is relevant to your case. Examples include emails proving that the customer received the product or service, or demonstrating their use of or satisfaction with the product or service. + */ + customer_communication: string | File | null; + + /** + * The email address of the customer. + */ + customer_email_address: string | null; + + /** + * The name of the customer. + */ + customer_name: string | null; + + /** + * The IP address that the customer used when making the purchase. + */ + customer_purchase_ip: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A relevant document or contract showing the customer's signature. + */ + customer_signature: string | File | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation for the prior charge that can uniquely identify the charge, such as a receipt, shipping label, work order, etc. This document should be paired with a similar document from the disputed payment that proves the two payments are separate. + */ + duplicate_charge_documentation: string | File | null; + + /** + * An explanation of the difference between the disputed charge versus the prior charge that appears to be a duplicate. + */ + duplicate_charge_explanation: string | null; + + /** + * The Stripe ID for the prior charge which appears to be a duplicate of the disputed charge. + */ + duplicate_charge_id: string | null; + + /** + * A description of the product or service that was sold. + */ + product_description: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any receipt or message sent to the customer notifying them of the charge. + */ + receipt: string | File | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your refund policy, as shown to the customer. + */ + refund_policy: string | File | null; + + /** + * Documentation demonstrating that the customer was shown your refund policy prior to purchase. + */ + refund_policy_disclosure: string | null; + + /** + * A justification for why the customer is not entitled to a refund. + */ + refund_refusal_explanation: string | null; + + /** + * The date on which the customer received or began receiving the purchased service, in a clear human-readable format. + */ + service_date: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a service was provided to the customer. This could include a copy of a signed contract, work order, or other form of written agreement. + */ + service_documentation: string | File | null; + + /** + * The address to which a physical product was shipped. You should try to include as complete address information as possible. + */ + shipping_address: string | null; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. If multiple carriers were used for this purchase, please separate them with commas. + */ + shipping_carrier: string | null; + + /** + * The date on which a physical product began its route to the shipping address, in a clear human-readable format. + */ + shipping_date: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a product was shipped to the customer at the same address the customer provided to you. This could include a copy of the shipment receipt, shipping label, etc. It should show the customer's full shipping address, if possible. + */ + shipping_documentation: string | File | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + shipping_tracking_number: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any additional evidence or statements. + */ + uncategorized_file: string | File | null; + + /** + * Any additional evidence or statements. + */ + uncategorized_text: string | null; + } + + interface EvidenceDetails { + /** + * Date by which evidence must be submitted in order to successfully challenge dispute. Will be null if the customer's bank or credit card company doesn't allow a response for this particular dispute. + */ + due_by: number | null; + + /** + * Whether evidence has been staged for this dispute. + */ + has_evidence: boolean; + + /** + * Whether the last evidence submission was submitted past the due date. Defaults to `false` if no evidence submissions have occurred. If `true`, then delivery of the latest evidence is *not* guaranteed. + */ + past_due: boolean; + + /** + * The number of times evidence has been submitted. Typically, you may only submit evidence once. + */ + submission_count: number; + } + + type Status = + | 'charge_refunded' + | 'lost' + | 'needs_response' + | 'under_review' + | 'warning_closed' + | 'warning_needs_response' + | 'warning_under_review' + | 'won'; + } + + interface DisputeRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface DisputeUpdateParams { + /** + * Evidence to upload, to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. The combined character count of all fields is limited to 150,000. + */ + evidence?: DisputeUpdateParams.Evidence; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to a dispute object. This can be useful for storing additional information about the dispute in a structured format. + */ + metadata?: MetadataParam; + + /** + * Whether to immediately submit evidence to the bank. If `false`, evidence is staged on the dispute. Staged evidence is visible in the API and Dashboard, and can be submitted to the bank by making another request with this attribute set to `true` (the default). + */ + submit?: boolean; + } + + namespace DisputeUpdateParams { + interface Evidence { + /** + * Has a maximum character count of 20,000. + */ + access_activity_log?: string; + + billing_address?: string; + + cancellation_policy?: string; + + /** + * Has a maximum character count of 20,000. + */ + cancellation_policy_disclosure?: string; + + /** + * Has a maximum character count of 20,000. + */ + cancellation_rebuttal?: string; + + customer_communication?: string; + + customer_email_address?: string; + + customer_name?: string; + + customer_purchase_ip?: string; + + customer_signature?: string; + + duplicate_charge_documentation?: string; + + /** + * Has a maximum character count of 20,000. + */ + duplicate_charge_explanation?: string; + + duplicate_charge_id?: string; + + /** + * Has a maximum character count of 20,000. + */ + product_description?: string; + + receipt?: string; + + refund_policy?: string; + + /** + * Has a maximum character count of 20,000. + */ + refund_policy_disclosure?: string; + + /** + * Has a maximum character count of 20,000. + */ + refund_refusal_explanation?: string; + + service_date?: string; + + service_documentation?: string; + + shipping_address?: string; + + shipping_carrier?: string; + + shipping_date?: string; + + shipping_documentation?: string; + + shipping_tracking_number?: string; + + uncategorized_file?: string; + + /** + * Has a maximum character count of 20,000. + */ + uncategorized_text?: string; + } + } + + interface DisputeListParams extends PaginationParams { + /** + * Only return disputes associated to the charge specified by this charge ID. + */ + charge?: string; + + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return disputes associated to the PaymentIntent specified by this PaymentIntent ID. + */ + payment_intent?: string; + } + + interface DisputeCloseParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class DisputesResource { + /** + * Retrieves the dispute with the given ID. + */ + retrieve( + id: string, + params?: DisputeRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * When you get a dispute, contacting your customer is always the best first step. If that doesn't work, you can submit evidence to help us resolve the dispute in your favor. You can do this in your [dashboard](https://dashboard.stripe.com/disputes), but if you prefer, you can use the API to submit evidence programmatically. + * + * Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute. To figure out which evidence fields to provide, see our [guide to dispute types](https://stripe.com/docs/disputes/categories). + */ + update( + id: string, + params?: DisputeUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your disputes. + */ + list( + params?: DisputeListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost. + * + * The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible. + */ + close( + id: string, + params?: DisputeCloseParams, + options?: RequestOptions + ): Promise; + close(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/EphemeralKeys.d.ts b/types/2019-12-03/EphemeralKeys.d.ts new file mode 100644 index 0000000000..7a6218f92b --- /dev/null +++ b/types/2019-12-03/EphemeralKeys.d.ts @@ -0,0 +1,83 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The EphemeralKey object. + */ + interface EphemeralKey { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'ephemeral_key'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Time at which the key will expire. Measured in seconds since the Unix epoch. + */ + expires: number; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The key's secret. You can use this value to make authorized requests to the Stripe API. + */ + secret?: string; + } + + interface EphemeralKeyCreateParams { + /** + * The ID of the Customer you'd like to modify using the resulting ephemeral key. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The ID of the Issuing Card you'd like to access using the resulting ephemeral key. + */ + issuing_card?: string; + } + + interface EphemeralKeyDeleteParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class EphemeralKeysResource { + /** + * Creates a short-lived API key for a given resource. + */ + create( + params?: EphemeralKeyCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Invalidates a short-lived API key for a given resource. + */ + del( + id: string, + params?: EphemeralKeyDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Events.d.ts b/types/2019-12-03/Events.d.ts new file mode 100644 index 0000000000..9f07752187 --- /dev/null +++ b/types/2019-12-03/Events.d.ts @@ -0,0 +1,139 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Event object. + */ + interface Event { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'event'; + + /** + * The connected account that originated the event. + */ + account?: string; + + /** + * The Stripe API version used to render `data`. *Note: This property is populated only for events on or after October 31, 2014*. + */ + api_version: string | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + data: Event.Data; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you've specified. + */ + pending_webhooks: number; + + /** + * Information on the API request that instigated the event. + */ + request: Event.Request | null; + + /** + * Description of the event (e.g., `invoice.created` or `charge.refunded`). + */ + type: string; + } + + namespace Event { + interface Data { + /** + * Object containing the API resource relevant to the event. For example, an `invoice.created` event will have a full [invoice object](#invoice_object) as the value of the object key. + */ + object: Data.Object; + + /** + * Object containing the names of the attributes that have changed, and their previous values (sent along only with *.updated events). + */ + previous_attributes?: Data.PreviousAttributes; + } + + namespace Data { + interface Object {} + + interface PreviousAttributes {} + } + + interface Request { + /** + * ID of the API request that caused the event. If null, the event was automatic (e.g., Stripe's automatic subscription handling). Request logs are available in the [dashboard](https://dashboard.stripe.com/logs), but currently not in the API. + */ + id: string | null; + + /** + * The idempotency key transmitted during the request, if any. *Note: This property is populated only for events on or after May 23, 2017*. + */ + idempotency_key: string | null; + } + } + + interface EventRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface EventListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Filter events by whether all webhooks were successfully delivered. If false, events which are still pending or have failed all delivery attempts to a webhook endpoint will be returned. + */ + delivery_success?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A string containing a specific event name, or group of events using * as a wildcard. The list will be filtered to include only events with a matching event property. + */ + type?: string; + + /** + * An array of up to 20 strings containing specific event names. The list will be filtered to include only events with a matching event property. You may pass either `type` or `types`, but not both. + */ + types?: Array; + } + + class EventsResource { + /** + * Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook. + */ + retrieve( + id: string, + params?: EventRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * List events, going back up to 30 days. Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://stripe.com/docs/api/events/object) api_version attribute (not according to your current Stripe API version or Stripe-Version header). + */ + list( + params?: EventListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/ExchangeRates.d.ts b/types/2019-12-03/ExchangeRates.d.ts new file mode 100644 index 0000000000..5276bce8a4 --- /dev/null +++ b/types/2019-12-03/ExchangeRates.d.ts @@ -0,0 +1,60 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The ExchangeRate object. + */ + interface ExchangeRate { + /** + * Unique identifier for the object. Represented as the three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) in lowercase. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'exchange_rate'; + + /** + * Hash where the keys are supported currencies and the values are the exchange rate at which the base id currency converts to the key currency. + */ + rates: { + [key: string]: number; + }; + } + + interface ExchangeRateRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ExchangeRateListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ExchangeRatesResource { + /** + * Retrieves the exchange rates from the given currency to every supported currency. + */ + retrieve( + id: string, + params?: ExchangeRateRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Returns a list of objects that contain the rates at which foreign currencies are converted to one another. Only shows the currencies for which Stripe supports. + */ + list( + params?: ExchangeRateListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/ExternalAccounts.d.ts b/types/2019-12-03/ExternalAccounts.d.ts new file mode 100644 index 0000000000..119d0939d4 --- /dev/null +++ b/types/2019-12-03/ExternalAccounts.d.ts @@ -0,0 +1,114 @@ +declare module 'stripe' { + namespace Stripe { + interface ExternalAccountCreateParams { + /** + * Please refer to full [documentation](https://stripe.com/docs/api) instead. + */ + external_account: string; + + /** + * When set to true, or if this is the first external account added in this currency, this account becomes the default external account for its currency. + */ + default_for_currency?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to an external account object. It can be useful for storing additional information about the external account in a structured format. + */ + metadata?: MetadataParam; + } + + interface ExternalAccountRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ExternalAccountUpdateParams { + /** + * The name of the person or business that owns the bank account. + */ + account_holder_name?: string; + + /** + * The type of entity that holds the account. This can be either `individual` or `company`. + */ + account_holder_type?: ExternalAccountUpdateParams.AccountHolderType | null; + + /** + * City/District/Suburb/Town/Village. + */ + address_city?: string; + + /** + * Billing address country, if provided when creating card. + */ + address_country?: string; + + /** + * Address line 1 (Street address/PO Box/Company name). + */ + address_line1?: string; + + /** + * Address line 2 (Apartment/Suite/Unit/Building). + */ + address_line2?: string; + + /** + * State/County/Province/Region. + */ + address_state?: string; + + /** + * ZIP or postal code. + */ + address_zip?: string; + + /** + * When set to true, this becomes the default external account for its currency. + */ + default_for_currency?: boolean; + + /** + * Two digit number representing the card's expiration month. + */ + exp_month?: string; + + /** + * Four digit number representing the card's expiration year. + */ + exp_year?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + metadata?: MetadataParam; + + /** + * Cardholder name. + */ + name?: string; + } + + namespace ExternalAccountUpdateParams { + type AccountHolderType = 'company' | 'individual'; + } + + interface ExternalAccountListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ExternalAccountDeleteParams {} + } +} diff --git a/types/2019-12-03/FeeRefunds.d.ts b/types/2019-12-03/FeeRefunds.d.ts new file mode 100644 index 0000000000..d681676778 --- /dev/null +++ b/types/2019-12-03/FeeRefunds.d.ts @@ -0,0 +1,91 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The FeeRefund object. + */ + interface FeeRefund { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'fee_refund'; + + /** + * Amount, in %s. + */ + amount: number; + + /** + * Balance transaction that describes the impact on your account balance. + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * ID of the application fee that was refunded. + */ + fee: string | ApplicationFee; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + } + + interface FeeRefundCreateParams { + /** + * A positive integer, in _%s_, representing how much of this fee to refund. Can refund only up to the remaining unrefunded amount of the fee. + */ + amount?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface FeeRefundRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface FeeRefundUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface FeeRefundListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } +} diff --git a/types/2019-12-03/FileLinks.d.ts b/types/2019-12-03/FileLinks.d.ts new file mode 100644 index 0000000000..1f25e85994 --- /dev/null +++ b/types/2019-12-03/FileLinks.d.ts @@ -0,0 +1,156 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The FileLink object. + */ + interface FileLink { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'file_link'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Whether this link is already expired. + */ + expired: boolean; + + /** + * Time at which the link expires. + */ + expires_at: number | null; + + /** + * The file object this link points to. + */ + file: string | File; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The publicly accessible URL to download the file. + */ + url: string | null; + } + + interface FileLinkCreateParams { + /** + * The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `pci_document`, `sigma_scheduled_query`, or `tax_document_user_upload`. + */ + file: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A future timestamp after which the link will no longer be usable. + */ + expires_at?: number; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + } + + interface FileLinkRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface FileLinkUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A future timestamp after which the link will no longer be usable, or `now` to expire the link immediately. + */ + expires_at?: 'now' | number | ''; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + } + + interface FileLinkListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Filter links by their expiration status. By default, all links are returned. + */ + expired?: boolean; + + /** + * Only return links for the given file. + */ + file?: string; + } + + class FileLinksResource { + /** + * Creates a new file link object. + */ + create( + params: FileLinkCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the file link with the given ID. + */ + retrieve( + id: string, + params?: FileLinkRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates an existing file link object. Expired links can no longer be updated. + */ + update( + id: string, + params?: FileLinkUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of file links. + */ + list( + params?: FileLinkListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Files.d.ts b/types/2019-12-03/Files.d.ts new file mode 100644 index 0000000000..150080c6a4 --- /dev/null +++ b/types/2019-12-03/Files.d.ts @@ -0,0 +1,123 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The File object. + */ + interface File { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'file'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * A filename for the file, suitable for saving to a filesystem. + */ + filename: string | null; + + links?: ApiList | null; + + /** + * The purpose of the file. Possible values are `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `identity_document`, `pci_document`, `sigma_scheduled_query`, or `tax_document_user_upload`. + */ + purpose: string; + + /** + * The size in bytes of the file object. + */ + size: number; + + /** + * A user friendly title for the document. + */ + title: string | null; + + /** + * The type of the file returned (e.g., `csv`, `pdf`, `jpg`, or `png`). + */ + type: string | null; + + /** + * The URL from which the file can be downloaded using your live secret API key. + */ + url: string | null; + } + + interface FileCreateParams {} + + interface FileRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface FileListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The file purpose to filter queries by. If none is provided, files will not be filtered by purpose. + */ + purpose?: FileListParams.Purpose; + } + + namespace FileListParams { + type Purpose = + | 'business_icon' + | 'business_logo' + | 'customer_signature' + | 'dispute_evidence' + | 'finance_report_run' + | 'identity_document' + | 'pci_document' + | 'sigma_scheduled_query' + | 'tax_document_user_upload'; + } + + class FilesResource { + /** + * To upload a file to Stripe, you'll need to send a request of type multipart/form-data. The request should contain the file you would like to upload, as well as the parameters for creating a file. + * + * All of Stripe's officially supported Client libraries should have support for sending multipart/form-data. + */ + create( + params?: FileCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of an existing file object. Supply the unique file ID from a file, and Stripe will return the corresponding file object. To access file contents, see the [File Upload Guide](https://stripe.com/docs/file-upload#download-file-contents). + */ + retrieve( + id: string, + params?: FileRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Returns a list of the files that your account has access to. The files are returned sorted by creation date, with the most recently created files appearing first. + */ + list( + params?: FileListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/InvoiceItems.d.ts b/types/2019-12-03/InvoiceItems.d.ts new file mode 100644 index 0000000000..0d93e74c41 --- /dev/null +++ b/types/2019-12-03/InvoiceItems.d.ts @@ -0,0 +1,379 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The InvoiceItem object. + */ + interface InvoiceItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'invoiceitem'; + + /** + * Amount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`. + */ + 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; + + /** + * The ID of the customer who will be billed when this invoice item is billed. + */ + customer: string | Customer | DeletedCustomer; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + date: number; + + deleted?: void; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * If true, discounts will apply to this invoice item. Always false for prorations. + */ + discountable: boolean; + + /** + * The ID of the invoice this invoice item belongs to. + */ + invoice: string | Invoice | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + period: InvoiceItem.Period; + + /** + * If the invoice item is a proration, the plan of the subscription that the proration was computed for. + */ + plan: Plan | null; + + /** + * Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. + */ + proration: boolean; + + /** + * Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for. + */ + quantity: number; + + /** + * The subscription that this invoice item has been created for, if any. + */ + subscription: string | Subscription | null; + + /** + * The subscription item that this invoice item has been created for, if any. + */ + subscription_item?: string; + + /** + * The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. + */ + tax_rates: Array | null; + + /** + * For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item. + */ + unified_proration?: boolean; + + /** + * Unit Amount (in the `currency` specified) of the invoice item. + */ + unit_amount: number | null; + + /** + * Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. + */ + unit_amount_decimal: string | null; + } + + namespace InvoiceItem { + interface Period { + /** + * End of the line item's billing period + */ + end: number; + + /** + * Start of the line item's billing period + */ + start: number; + } + } + + /** + * The DeletedInvoiceItem object. + */ + interface DeletedInvoiceItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'invoiceitem'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface InvoiceItemCreateParams { + /** + * 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; + + /** + * The ID of the customer who will be billed when this invoice item is billed. + */ + customer: string; + + /** + * The integer amount in **%s** of the charge to be applied to the upcoming invoice. Passing in a negative `amount` will reduce the `amount_due` on the invoice. + */ + amount?: number; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. + */ + description?: string; + + /** + * Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other invoice items. + */ + discountable?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming scheduled invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices. + */ + invoice?: string; + + /** + * A set of key-value pairs that you can attach to an invoice item object. It can be useful for storing additional information about the invoice item in a structured format. + */ + metadata?: MetadataParam; + + /** + * The period associated with this invoice item. + */ + period?: InvoiceItemCreateParams.Period; + + /** + * Non-negative integer. The quantity of units for the invoice item. + */ + quantity?: number; + + /** + * The ID of a subscription to add this invoice item to. When left blank, the invoice item will be be added to the next upcoming scheduled invoice. When set, scheduled invoices for subscriptions other than the specified subscription will ignore the invoice item. Use this when you want to express that an invoice item has been accrued within the context of a particular subscription. + */ + subscription?: string; + + /** + * The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. + */ + tax_rates?: Array; + + /** + * The integer unit amount in **%s** of the charge to be applied to the upcoming invoice. This `unit_amount` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount` will reduce the `amount_due` on the invoice. + */ + unit_amount?: number; + + /** + * Same as `unit_amount`, but accepts a decimal value with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + */ + unit_amount_decimal?: string; + } + + namespace InvoiceItemCreateParams { + interface Period { + /** + * The end of the period, which must be greater than or equal to the start. + */ + end: number; + + /** + * The start of the period. + */ + start: number; + } + } + + interface InvoiceItemRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface InvoiceItemUpdateParams { + /** + * The integer amount in **%s** of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer's account, pass a negative amount. + */ + amount?: number; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. + */ + description?: string; + + /** + * Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other invoice items. Cannot be set to true for prorations. + */ + discountable?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to an invoice item object. It can be useful for storing additional information about the invoice item in a structured format. + */ + metadata?: MetadataParam; + + /** + * The period associated with this invoice item. + */ + period?: InvoiceItemUpdateParams.Period; + + /** + * Non-negative integer. The quantity of units for the invoice item. + */ + quantity?: number; + + /** + * The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. Pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + + /** + * The integer unit amount in **%s** of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount. + */ + unit_amount?: number; + + /** + * Same as `unit_amount`, but accepts a decimal value with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + */ + unit_amount_decimal?: string; + } + + namespace InvoiceItemUpdateParams { + interface Period { + /** + * The end of the period, which must be greater than or equal to the start. + */ + end: number; + + /** + * The start of the period. + */ + start: number; + } + } + + interface InvoiceItemListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * The identifier of the customer whose invoice items to return. If none is provided, all invoice items will be returned. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return invoice items belonging to this invoice. If none is provided, all invoice items will be returned. If specifying an invoice, no customer identifier is needed. + */ + invoice?: string; + + /** + * Set to `true` to only show pending invoice items, which are not yet attached to any invoices. Set to `false` to only show invoice items already attached to invoices. If unspecified, no filter is applied. + */ + pending?: boolean; + } + + interface InvoiceItemDeleteParams {} + + class InvoiceItemsResource { + /** + * Creates an item to be added to a draft invoice. If no invoice is specified, the item will be on the next invoice created for the customer specified. + */ + create( + params: InvoiceItemCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the invoice item with the given ID. + */ + retrieve( + id: string, + params?: InvoiceItemRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it's attached to is closed. + */ + update( + id: string, + params?: InvoiceItemUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first. + */ + list( + params?: InvoiceItemListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they're not attached to invoices, or if it's attached to a draft invoice. + */ + del( + id: string, + params?: InvoiceItemDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/InvoiceLineItems.d.ts b/types/2019-12-03/InvoiceLineItems.d.ts new file mode 100644 index 0000000000..a06d24abdf --- /dev/null +++ b/types/2019-12-03/InvoiceLineItems.d.ts @@ -0,0 +1,356 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The InvoiceLineItem object. + */ + interface InvoiceLineItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'line_item'; + + /** + * The amount, in %s. + */ + 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * If true, discounts will apply to this line item. Always false for prorations. + */ + discountable: boolean; + + invoice_item?: string; + + /** + * Whether this is a test line item. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with `type=subscription` this will reflect the metadata of the subscription that caused the line item to be created. + */ + metadata: Metadata; + + period: InvoiceLineItem.Period; + + /** + * The plan of the subscription, if the line item is a subscription or a proration. + */ + plan: Plan | null; + + /** + * Whether this is a proration. + */ + proration: boolean; + + /** + * The quantity of the subscription, if the line item is a subscription or a proration. + */ + quantity: number | null; + + /** + * The subscription that the invoice item pertains to, if any. + */ + subscription: string | null; + + /** + * The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription. + */ + subscription_item?: string; + + /** + * The amount of tax calculated per tax rate for this line item + */ + tax_amounts?: Array | null; + + /** + * The tax rates which apply to the line item. + */ + tax_rates?: Array | null; + + /** + * A string identifying the type of the source of this line item, either an `invoiceitem` or a `subscription`. + */ + type: InvoiceLineItem.Type; + + /** + * For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item. + */ + unified_proration?: boolean; + } + + namespace InvoiceLineItem { + interface Period { + /** + * End of the line item's billing period + */ + end: number; + + /** + * Start of the line item's billing period + */ + start: number; + } + + interface TaxAmount { + /** + * The amount, in %s, of the tax. + */ + amount: number; + + /** + * Whether this tax amount is inclusive or exclusive. + */ + inclusive: boolean; + + /** + * The tax rate that was applied to get this tax amount. + */ + tax_rate: string | TaxRate; + } + + type Type = 'invoiceitem' | 'subscription'; + } + + interface InvoiceLineItemListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface InvoiceLineItemListUpcomingParams extends PaginationParams { + /** + * The code of the coupon to apply. If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. The invoice can be previewed without a coupon by passing this value as an empty string. + */ + coupon?: string; + + /** + * The identifier of the customer whose upcoming invoice you'd like to retrieve. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * List of invoice items to add or update in the upcoming invoice preview. + */ + invoice_items?: Array; + + /** + * The identifier of the unstarted schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. + */ + schedule?: string; + + /** + * The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a `subscription_items` is provided, you will preview creating a subscription with those items. If neither `subscription` nor `subscription_items` is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions. + */ + subscription?: string; + + /** + * For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. + */ + subscription_billing_cycle_anchor?: + | number + | InvoiceLineItemListUpcomingParams.SubscriptionBillingCycleAnchor; + + /** + * Timestamp indicating when the subscription should be scheduled to cancel. Will prorate if within the current period if `prorate=true` + */ + subscription_cancel_at?: number | ''; + + /** + * Boolean indicating whether this subscription should cancel at the end of the current period. + */ + subscription_cancel_at_period_end?: boolean; + + /** + * This simulates the subscription being canceled or expired immediately. + */ + subscription_cancel_now?: boolean; + + /** + * If provided, the invoice returned will preview updating or creating a subscription with these default tax rates. The default tax rates will apply to any line item that does not have `tax_rates` set. + */ + subscription_default_tax_rates?: Array | ''; + + /** + * List of subscription items, each with an attached plan. + */ + subscription_items?: Array< + InvoiceLineItemListUpcomingParams.SubscriptionItem + >; + + /** + * If previewing an update to a subscription, this decides whether the preview will show the result of applying prorations or not. If set, one of `subscription_items` or `subscription`, and one of `subscription_items` or `subscription_trial_end` are required. + */ + subscription_prorate?: boolean; + + /** + * If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period, and cannot be before the subscription was on its current plan. If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. Also, `subscription_proration` cannot be set to false. + */ + subscription_proration_date?: number; + + /** + * Date a subscription is intended to start (can be future or past) + */ + subscription_start_date?: number; + + /** + * If provided, the invoice returned will preview updating or creating a subscription with that tax percent. If set, one of `subscription_items` or `subscription` is required. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + subscription_tax_percent?: number; + + /** + * If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_items` or `subscription` is required. + */ + subscription_trial_end?: 'now' | number; + + /** + * Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `subscription_trial_end` is not allowed. + */ + subscription_trial_from_plan?: boolean; + } + + namespace InvoiceLineItemListUpcomingParams { + interface InvoiceItem { + /** + * The integer amount in **%s** of previewed invoice item. + */ + 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). Only applicable to new invoice items. + */ + currency?: string; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. + */ + description?: string; + + /** + * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except for negative invoice items. + */ + discountable?: boolean; + + /** + * The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice. + */ + invoiceitem?: string; + + /** + * A set of key-value pairs that you can attach to an invoice item object. It can be useful for storing additional information about the invoice item in a structured format. + */ + metadata?: MetadataParam; + + /** + * The period associated with this invoice item. + */ + period?: InvoiceItem.Period; + + /** + * Non-negative integer. The quantity of units for the invoice item. + */ + quantity?: number; + + tax_rates?: Array | ''; + + /** + * The integer unit amount in **%s** of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount. + */ + unit_amount?: number; + + /** + * Same as `unit_amount`, but accepts a decimal string with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + */ + unit_amount_decimal?: string; + } + + namespace InvoiceItem { + interface Period { + /** + * The end of the period, which must be greater than or equal to the start. + */ + end: number; + + /** + * The start of the period. + */ + start: number; + } + } + + type SubscriptionBillingCycleAnchor = 'now' | 'unchanged'; + + interface SubscriptionItem { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: SubscriptionItem.BillingThresholds | null; + + /** + * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + */ + clear_usage?: boolean; + + /** + * A flag that, if set to `true`, will delete the specified item. + */ + deleted?: boolean; + + /** + * Subscription item to update. + */ + id?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Plan ID for this item, as a string. + */ + plan?: string; + + /** + * Quantity for this item. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace SubscriptionItem { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + } + } + } +} diff --git a/types/2019-12-03/Invoices.d.ts b/types/2019-12-03/Invoices.d.ts new file mode 100644 index 0000000000..d72b924b52 --- /dev/null +++ b/types/2019-12-03/Invoices.d.ts @@ -0,0 +1,1159 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Invoice object. + */ + interface Invoice { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'invoice'; + + /** + * The country of the business associated with this invoice, most often the business creating the invoice. + */ + account_country: string | null; + + /** + * The public name of the business associated with this invoice, most often the business creating the invoice. + */ + account_name: string | null; + + /** + * Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the `amount_due` may be 0. If there is a positive `starting_balance` for the invoice (the customer owes money), the `amount_due` will also take that into account. The charge that gets generated for the invoice will be for the amount specified in `amount_due`. + */ + amount_due: number; + + /** + * The amount, in %s, that was paid. + */ + amount_paid: number; + + /** + * The amount remaining, in %s, that is due. + */ + amount_remaining: number; + + /** + * The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. + */ + application_fee_amount: number | null; + + /** + * Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. + */ + attempt_count: number; + + /** + * Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users. + */ + attempted: boolean; + + /** + * Controls whether Stripe will perform [automatic collection](https://stripe.com/docs/billing/invoices/workflow/#auto_advance) of the invoice. When `false`, the invoice's state will not automatically advance without an explicit action. + */ + auto_advance?: boolean; + + /** + * Indicates the reason why the invoice was created. `subscription_cycle` indicates an invoice created by a subscription advancing into a new period. `subscription_create` indicates an invoice created due to creating a subscription. `subscription_update` indicates an invoice created due to updating a subscription. `subscription` is set for all old invoices to indicate either a change to a subscription or a period advancement. `manual` is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The `upcoming` value is reserved for simulated invoices per the upcoming invoice endpoint. `subscription_threshold` indicates an invoice created due to a billing threshold being reached. + */ + billing_reason: Invoice.BillingReason | null; + + /** + * ID of the latest charge generated for this invoice, if any. + */ + charge: string | Charge | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. + */ + collection_method: Invoice.CollectionMethod | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * Custom fields displayed on the invoice. + */ + custom_fields: Array | null; + + customer: string | Customer | DeletedCustomer; + + /** + * The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_address: Address | null; + + /** + * The customer's email. Until the invoice is finalized, this field will equal `customer.email`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_email: string | null; + + /** + * The customer's name. Until the invoice is finalized, this field will equal `customer.name`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_name: string | null; + + /** + * The customer's phone number. Until the invoice is finalized, this field will equal `customer.phone`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_phone: string | null; + + /** + * The customer's shipping information. Until the invoice is finalized, this field will equal `customer.shipping`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_shipping: Invoice.CustomerShipping | null; + + /** + * The customer's tax exempt status. Until the invoice is finalized, this field will equal `customer.tax_exempt`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_tax_exempt: Invoice.CustomerTaxExempt | null; + + /** + * The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as `customer.tax_ids`. Once the invoice is finalized, this field will no longer be updated. + */ + customer_tax_ids?: Array | null; + + /** + * ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. + */ + default_payment_method: string | PaymentMethod | null; + + /** + * ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. + */ + default_source: string | CustomerSource | null; + + /** + * The tax rates applied to this invoice, if any. + */ + default_tax_rates: Array | null; + + deleted?: void; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard. + */ + description: string | null; + + discount: Discount | null; + + /** + * The date on which payment for this invoice is due. This value will be `null` for invoices where `collection_method=charge_automatically`. + */ + due_date: number | null; + + /** + * Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null. + */ + ending_balance: number | null; + + /** + * Footer displayed on the invoice. + */ + footer: string | null; + + /** + * The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null. + */ + hosted_invoice_url?: string | null; + + /** + * The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null. + */ + invoice_pdf?: string | null; + + /** + * The individual line items that make up the invoice. `lines` is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any. + */ + lines: ApiList; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata | null; + + /** + * The time at which payment will next be attempted. This value will be `null` for invoices where `collection_method=send_invoice`. + */ + next_payment_attempt: number | null; + + /** + * A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. + */ + number: string | null; + + /** + * Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance. + */ + paid: boolean; + + /** + * The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. + */ + payment_intent: string | PaymentIntent | null; + + /** + * End of the usage period during which invoice items were added to this invoice. + */ + period_end: number; + + /** + * Start of the usage period during which invoice items were added to this invoice. + */ + period_start: number; + + /** + * Total amount of all post-payment credit notes issued for this invoice. + */ + post_payment_credit_notes_amount: number; + + /** + * Total amount of all pre-payment credit notes issued for this invoice. + */ + pre_payment_credit_notes_amount: number; + + /** + * This is the transaction number that appears on email receipts sent for this invoice. + */ + receipt_number: string | null; + + /** + * Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. + */ + starting_balance: number; + + /** + * Extra information about an invoice for the customer's credit card statement. + */ + statement_descriptor: string | null; + + /** + * The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview) + */ + status: Invoice.Status | null; + + status_transitions: Invoice.StatusTransitions; + + /** + * The subscription that this invoice was prepared for, if any. + */ + subscription: string | Subscription | null; + + /** + * Only set for upcoming invoices that preview prorations. The time used to calculate prorations. + */ + subscription_proration_date?: number; + + /** + * Total of all subscriptions, invoice items, and prorations on the invoice before any discount or tax is applied. + */ + subtotal: number; + + /** + * The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. + */ + tax: number | null; + + /** + * This percentage of the subtotal has been added to the total amount of the invoice, including invoice line items and discounts. This field is inherited from the subscription's `tax_percent` field, but can be changed before the invoice is paid. This field defaults to null. + */ + tax_percent: number | null; + + threshold_reason?: Invoice.ThresholdReason; + + /** + * Total after discounts and taxes. + */ + total: number; + + /** + * The aggregate amounts calculated per tax rate for all line items. + */ + total_tax_amounts: Array | null; + + /** + * If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. + */ + transfer_data?: Invoice.TransferData | null; + + /** + * The time at which webhooks for this invoice were successfully delivered (if the invoice had no webhooks to deliver, this will match `created`). Invoice payment is delayed until webhooks are delivered, or until all webhook delivery attempts have been exhausted. + */ + webhooks_delivered_at: number | null; + } + + namespace Invoice { + type BillingReason = + | 'automatic_pending_invoice_item_invoice' + | 'manual' + | 'subscription' + | 'subscription_create' + | 'subscription_cycle' + | 'subscription_threshold' + | 'subscription_update' + | 'upcoming'; + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface CustomField { + /** + * The name of the custom field. + */ + name: string; + + /** + * The value of the custom field. + */ + value: string; + } + + interface CustomerShipping { + address?: Address; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string | null; + + /** + * Recipient name. + */ + name?: string | null; + + /** + * Recipient phone (including extension). + */ + phone?: string | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string | null; + } + + type CustomerTaxExempt = 'exempt' | 'none' | 'reverse'; + + interface CustomerTaxId { + /** + * The type of the tax ID, one of `au_abn`, `ch_vat`, `eu_vat`, `in_gst`, `mx_rfc`, `no_vat`, `nz_gst`, `unknown`, or `za_vat` + */ + type: CustomerTaxId.Type; + + /** + * The value of the tax ID. + */ + value: string | null; + } + + namespace CustomerTaxId { + type Type = + | 'au_abn' + | 'ch_vat' + | 'eu_vat' + | 'in_gst' + | 'mx_rfc' + | 'no_vat' + | 'nz_gst' + | 'unknown' + | 'za_vat'; + } + + type Status = + | 'deleted' + | 'draft' + | 'open' + | 'paid' + | 'uncollectible' + | 'void'; + + interface StatusTransitions { + /** + * The time that the invoice draft was finalized. + */ + finalized_at: number | null; + + /** + * The time that the invoice was marked uncollectible. + */ + marked_uncollectible_at: number | null; + + /** + * The time that the invoice was paid. + */ + paid_at: number | null; + + /** + * The time that the invoice was voided. + */ + voided_at: number | null; + } + + interface ThresholdReason { + /** + * The total invoice amount threshold boundary if it triggered the threshold invoice. + */ + amount_gte: number | null; + + /** + * Indicates which line items triggered a threshold invoice. + */ + item_reasons: Array; + } + + namespace ThresholdReason { + interface ItemReason { + /** + * The IDs of the line items that triggered the threshold invoice. + */ + line_item_ids: Array; + + /** + * The quantity threshold boundary that applied to the given line item. + */ + usage_gte: number; + } + } + + interface TotalTaxAmount { + /** + * The amount, in %s, of the tax. + */ + amount: number; + + /** + * Whether this tax amount is inclusive or exclusive. + */ + inclusive: boolean; + + /** + * The tax rate that was applied to get this tax amount. + */ + tax_rate: string | TaxRate; + } + + interface TransferData { + /** + * The account (if any) where funds from the payment will be transferred to upon payment success. + */ + destination: string | Account; + } + } + + /** + * The DeletedInvoice object. + */ + interface DeletedInvoice { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'invoice'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface InvoiceCreateParams { + customer: string; + + /** + * A fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#invoices). + */ + application_fee_amount?: number; + + /** + * Controls whether Stripe will perform [automatic collection](https://stripe.com/docs/billing/invoices/workflow/#auto_advance) of the invoice. When `false`, the invoice's state will not automatically advance without an explicit action. + */ + auto_advance?: boolean; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. Defaults to `charge_automatically`. + */ + collection_method?: InvoiceCreateParams.CollectionMethod; + + /** + * A list of up to 4 custom fields to be displayed on the invoice. + */ + custom_fields?: InvoiceCreateParams.CustomFields | null; + + /** + * The number of days from when the invoice is created until it is due. Valid only for invoices where `collection_method=send_invoice`. + */ + days_until_due?: number; + + /** + * ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. + */ + default_source?: string; + + /** + * The tax rates that will apply to any line item that does not have `tax_rates` set. + */ + default_tax_rates?: Array; + + description?: string; + + /** + * The date on which payment for this invoice is due. Valid only for invoices where `collection_method=send_invoice`. + */ + due_date?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Footer to be displayed on the invoice. + */ + footer?: string; + + metadata?: MetadataParam; + + /** + * Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. + */ + statement_descriptor?: string; + + /** + * The ID of the subscription to invoice, if any. If not set, the created invoice will include all pending invoice items for the customer. If set, the created invoice will only include pending invoice items for that subscription and pending invoice items not associated with any subscription. The subscription's billing cycle and regular subscription events won't be affected. + */ + subscription?: string; + + /** + * The percent tax rate applied to the invoice, represented as a decimal number. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + tax_percent?: number; + + /** + * If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. This will be unset if you POST an empty value. + */ + transfer_data?: InvoiceCreateParams.TransferData; + } + + namespace InvoiceCreateParams { + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface CustomFields { + /** + * The name of the custom field. This may be up to 30 characters. + */ + name: string; + + /** + * The value of the custom field. This may be up to 30 characters. + */ + value: string; + } + + interface TransferData { + /** + * ID of an existing, connected Stripe account. + */ + destination: string; + } + } + + interface InvoiceRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface InvoiceUpdateParams { + /** + * A fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#invoices). + */ + application_fee_amount?: number; + + /** + * Controls whether Stripe will perform [automatic collection](https://stripe.com/docs/billing/invoices/workflow/#auto_advance) of the invoice. + */ + auto_advance?: boolean; + + /** + * Either `charge_automatically` or `send_invoice`. This field can be updated only on `draft` invoices. + */ + collection_method?: InvoiceUpdateParams.CollectionMethod; + + /** + * A list of up to 4 custom fields to be displayed on the invoice. If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. Pass an empty string to remove previously-defined fields. + */ + custom_fields?: InvoiceUpdateParams.CustomFields | null; + + /** + * The number of days from which the invoice is created until it is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices. + */ + days_until_due?: number; + + /** + * ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. + */ + default_source?: string; + + /** + * The tax rates that will apply to any line item that does not have `tax_rates` set. Pass an empty string to remove previously-defined tax rates. + */ + default_tax_rates?: Array | ''; + + description?: string; + + /** + * The date on which payment for this invoice is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices. + */ + due_date?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Footer to be displayed on the invoice. + */ + footer?: string; + + metadata?: MetadataParam; + + /** + * Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. + */ + statement_descriptor?: string; + + /** + * The percent tax rate applied to the invoice, represented as a non-negative decimal number (with at most four decimal places) between 0 and 100. To unset a previously-set value, pass an empty string. This field can be updated only on `draft` invoices. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + tax_percent?: number | ''; + + /** + * If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. This will be unset if you POST an empty value. + */ + transfer_data?: InvoiceUpdateParams.TransferData | null; + } + + namespace InvoiceUpdateParams { + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface CustomFields { + /** + * The name of the custom field. This may be up to 30 characters. + */ + name: string; + + /** + * The value of the custom field. This may be up to 30 characters. + */ + value: string; + } + + interface TransferData { + /** + * ID of an existing, connected Stripe account. + */ + destination: string; + } + } + + interface InvoiceListParams extends PaginationParams { + /** + * The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`. + */ + collection_method?: InvoiceListParams.CollectionMethod; + + created?: RangeQueryParam | number; + + /** + * Only return invoices for the customer specified by this customer ID. + */ + customer?: string; + + due_date?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview) + */ + status?: InvoiceListParams.Status; + + /** + * Only return invoices for the subscription specified by this subscription ID. + */ + subscription?: string; + } + + namespace InvoiceListParams { + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + type Status = 'draft' | 'open' | 'paid' | 'uncollectible' | 'void'; + } + + interface InvoiceDeleteParams {} + + interface InvoiceFinalizeInvoiceParams { + /** + * Controls whether Stripe will perform [automatic collection](https://stripe.com/docs/billing/invoices/workflow/#auto_advance) of the invoice. When `false`, the invoice's state will not automatically advance without an explicit action. + */ + auto_advance?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface InvoiceMarkUncollectibleParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface InvoicePayParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * In cases where the source used to pay the invoice has insufficient funds, passing `forgive=true` controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. This effectively forgives the difference between the amount available on the source and the amount due. + * + * Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the right amount. An example for this case is with ACH Credit Transfers and wires: if the amount wired is less than the amount due by a small amount, you might want to forgive the difference. + */ + forgive?: boolean; + + /** + * Indicates if a customer is on or off-session while an invoice payment is attempted. + */ + off_session?: boolean; + + /** + * Boolean representing whether an invoice is paid outside of Stripe. This will result in no charge being made. + */ + paid_out_of_band?: boolean; + + /** + * A PaymentMethod to be charged. The PaymentMethod must be the ID of a PaymentMethod belonging to the customer associated with the invoice being paid. + */ + payment_method?: string; + + /** + * A payment source to be charged. The source must be the ID of a source belonging to the customer associated with the invoice being paid. + */ + source?: string; + } + + interface InvoiceRetrieveUpcomingParams { + /** + * The code of the coupon to apply. If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. The invoice can be previewed without a coupon by passing this value as an empty string. + */ + coupon?: string; + + /** + * The identifier of the customer whose upcoming invoice you'd like to retrieve. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * List of invoice items to add or update in the upcoming invoice preview. + */ + invoice_items?: Array; + + /** + * The identifier of the unstarted schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. + */ + schedule?: string; + + /** + * The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a `subscription_items` is provided, you will preview creating a subscription with those items. If neither `subscription` nor `subscription_items` is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions. + */ + subscription?: string; + + /** + * For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. + */ + subscription_billing_cycle_anchor?: + | number + | InvoiceRetrieveUpcomingParams.SubscriptionBillingCycleAnchor; + + /** + * Timestamp indicating when the subscription should be scheduled to cancel. Will prorate if within the current period if `prorate=true` + */ + subscription_cancel_at?: number | ''; + + /** + * Boolean indicating whether this subscription should cancel at the end of the current period. + */ + subscription_cancel_at_period_end?: boolean; + + /** + * This simulates the subscription being canceled or expired immediately. + */ + subscription_cancel_now?: boolean; + + /** + * If provided, the invoice returned will preview updating or creating a subscription with these default tax rates. The default tax rates will apply to any line item that does not have `tax_rates` set. + */ + subscription_default_tax_rates?: Array | ''; + + /** + * List of subscription items, each with an attached plan. + */ + subscription_items?: Array< + InvoiceRetrieveUpcomingParams.SubscriptionItem + >; + + /** + * If previewing an update to a subscription, this decides whether the preview will show the result of applying prorations or not. If set, one of `subscription_items` or `subscription`, and one of `subscription_items` or `subscription_trial_end` are required. + */ + subscription_prorate?: boolean; + + /** + * If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period, and cannot be before the subscription was on its current plan. If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. Also, `subscription_proration` cannot be set to false. + */ + subscription_proration_date?: number; + + /** + * Date a subscription is intended to start (can be future or past) + */ + subscription_start_date?: number; + + /** + * If provided, the invoice returned will preview updating or creating a subscription with that tax percent. If set, one of `subscription_items` or `subscription` is required. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + subscription_tax_percent?: number; + + /** + * If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_items` or `subscription` is required. + */ + subscription_trial_end?: 'now' | number; + + /** + * Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `subscription_trial_end` is not allowed. + */ + subscription_trial_from_plan?: boolean; + } + + namespace InvoiceRetrieveUpcomingParams { + interface InvoiceItem { + /** + * The integer amount in **%s** of previewed invoice item. + */ + 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). Only applicable to new invoice items. + */ + currency?: string; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. + */ + description?: string; + + /** + * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except for negative invoice items. + */ + discountable?: boolean; + + /** + * The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice. + */ + invoiceitem?: string; + + /** + * A set of key-value pairs that you can attach to an invoice item object. It can be useful for storing additional information about the invoice item in a structured format. + */ + metadata?: MetadataParam; + + /** + * The period associated with this invoice item. + */ + period?: InvoiceItem.Period; + + /** + * Non-negative integer. The quantity of units for the invoice item. + */ + quantity?: number; + + tax_rates?: Array | ''; + + /** + * The integer unit amount in **%s** of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount. + */ + unit_amount?: number; + + /** + * Same as `unit_amount`, but accepts a decimal string with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + */ + unit_amount_decimal?: string; + } + + namespace InvoiceItem { + interface Period { + /** + * The end of the period, which must be greater than or equal to the start. + */ + end: number; + + /** + * The start of the period. + */ + start: number; + } + } + + type SubscriptionBillingCycleAnchor = 'now' | 'unchanged'; + + interface SubscriptionItem { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: SubscriptionItem.BillingThresholds | null; + + /** + * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + */ + clear_usage?: boolean; + + /** + * A flag that, if set to `true`, will delete the specified item. + */ + deleted?: boolean; + + /** + * Subscription item to update. + */ + id?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Plan ID for this item, as a string. + */ + plan?: string; + + /** + * Quantity for this item. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace SubscriptionItem { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + } + } + + interface InvoiceSendInvoiceParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface InvoiceVoidInvoiceParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class InvoicesResource { + /** + * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in all pending invoice items on that customer, including prorations. + */ + create( + params: InvoiceCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the invoice with the given ID. + */ + retrieve( + id: string, + params?: InvoiceRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Draft invoices are fully editable. Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized), + * monetary values, as well as collection_method, become uneditable. + * + * If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on, + * sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass + * auto_advance=false. + */ + update( + id: string, + params?: InvoiceUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first. + */ + list( + params?: InvoiceListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Permanently deletes a draft invoice. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized, it must be [voided](https://stripe.com/docs/api#void_invoice). + */ + del( + id: string, + params?: InvoiceDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method. + */ + finalizeInvoice( + id: string, + params?: InvoiceFinalizeInvoiceParams, + options?: RequestOptions + ): Promise; + finalizeInvoice(id: string, options?: RequestOptions): Promise; + + /** + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes. + */ + markUncollectible( + id: string, + params?: InvoiceMarkUncollectibleParams, + options?: RequestOptions + ): Promise; + markUncollectible(id: string, options?: RequestOptions): Promise; + + /** + * Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so. + */ + pay( + id: string, + params?: InvoicePayParams, + options?: RequestOptions + ): Promise; + pay(id: string, options?: RequestOptions): Promise; + + /** + * At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discount that is applicable to the customer. + * + * Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount. + * + * You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a proration_date parameter when doing the actual subscription update. The value passed in should be the same as the subscription_proration_date returned on the upcoming invoice resource. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_proration_date on the upcoming invoice resource. + */ + retrieveUpcoming( + params?: InvoiceRetrieveUpcomingParams, + options?: RequestOptions + ): Promise; + retrieveUpcoming(options?: RequestOptions): Promise; + + /** + * Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email. + * + * Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event. + */ + sendInvoice( + id: string, + params?: InvoiceSendInvoiceParams, + options?: RequestOptions + ): Promise; + sendInvoice(id: string, options?: RequestOptions): Promise; + + /** + * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. + */ + voidInvoice( + id: string, + params?: InvoiceVoidInvoiceParams, + options?: RequestOptions + ): Promise; + voidInvoice(id: string, options?: RequestOptions): Promise; + + /** + * When retrieving an invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + */ + listLineItems( + id: string, + params?: InvoiceLineItemListParams, + options?: RequestOptions + ): ApiListPromise; + listLineItems( + id: string, + options?: RequestOptions + ): ApiListPromise; + + /** + * When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + */ + listUpcomingLineItems( + params?: InvoiceLineItemListUpcomingParams, + options?: RequestOptions + ): ApiListPromise; + listUpcomingLineItems( + options?: RequestOptions + ): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/IssuerFraudRecords.d.ts b/types/2019-12-03/IssuerFraudRecords.d.ts new file mode 100644 index 0000000000..6d84a63538 --- /dev/null +++ b/types/2019-12-03/IssuerFraudRecords.d.ts @@ -0,0 +1,98 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The IssuerFraudRecord object. + */ + interface IssuerFraudRecord { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuer_fraud_record'; + + /** + * An IFR is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an IFR, in order to avoid receiving a dispute later. + */ + actionable: boolean; + + /** + * ID of the charge this issuer fraud record is for, optionally expanded. + */ + charge: string | Charge; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The type of fraud labelled by the issuer. One of `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `made_with_lost_card`, `made_with_stolen_card`, `misc`, `unauthorized_use_of_card`. + */ + fraud_type: string; + + /** + * If true, the associated charge is subject to [liability shift](https://stripe.com/docs/sources/three-d-secure#disputed-payments). + */ + has_liability_shift: boolean; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The timestamp at which the card issuer posted the issuer fraud record. + */ + post_date: number; + } + + interface IssuerFraudRecordRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface IssuerFraudRecordListParams extends PaginationParams { + /** + * Only return issuer fraud records for the charge specified by this charge ID. + */ + charge?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class IssuerFraudRecordsResource { + /** + * Retrieves the details of an issuer fraud record that has previously been created. + * + * Please refer to the [issuer fraud record](https://stripe.com/docs/api#issuer_fraud_record_object) object reference for more details. + */ + retrieve( + id: string, + params?: IssuerFraudRecordRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of issuer fraud records. + */ + list( + params?: IssuerFraudRecordListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Issuing/Authorizations.d.ts b/types/2019-12-03/Issuing/Authorizations.d.ts new file mode 100644 index 0000000000..2b26b4ecd1 --- /dev/null +++ b/types/2019-12-03/Issuing/Authorizations.d.ts @@ -0,0 +1,402 @@ +declare module 'stripe' { + namespace Stripe { + namespace Issuing { + /** + * The Authorization object. + */ + interface Authorization { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuing.authorization'; + + /** + * Whether the authorization has been approved. + */ + approved: boolean; + + /** + * How the card details were provided. + */ + authorization_method: Authorization.AuthorizationMethod; + + /** + * The amount that has been authorized. This will be `0` when the object is created, and increase after it has been approved. + */ + authorized_amount: number; + + /** + * The currency that was presented to the cardholder for the authorization. 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). + */ + authorized_currency: string; + + balance_transactions: Array; + + card: Issuing.Card; + + /** + * The cardholder to whom this authorization belongs. + */ + cardholder: string | Issuing.Cardholder | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The amount the authorization is expected to be in `held_currency`. When Stripe holds funds from you, this is the amount reserved for the authorization. This will be `0` when the object is created, and increase after it has been approved. For multi-currency transactions, `held_amount` can be used to determine the expected exchange rate. + */ + held_amount: number; + + /** + * The currency of the [held amount](https://stripe.com/docs/api#issuing_authorization_object-held_amount). This will always be the card currency. + */ + held_currency: string; + + is_held_amount_controllable: boolean; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + merchant_data: Authorization.MerchantData; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The amount the user is requesting to be authorized. This field will only be non-zero during an `issuing.authorization.request` webhook. + */ + pending_authorized_amount: number; + + /** + * The additional amount Stripe will hold if the authorization is approved. This field will only be non-zero during an `issuing.authorization.request` webhook. + */ + pending_held_amount: number; + + request_history: Array; + + /** + * The current status of the authorization in its lifecycle. + */ + status: Authorization.Status; + + transactions: Array; + + verification_data: Authorization.VerificationData; + + /** + * What, if any, digital wallet was used for this authorization. One of `apple_pay`, `google_pay`, or `samsung_pay`. + */ + wallet_provider: string | null; + } + + namespace Authorization { + type AuthorizationMethod = + | 'chip' + | 'contactless' + | 'keyed_in' + | 'online' + | 'swipe'; + + interface MerchantData { + /** + * A categorization of the seller's type of business. See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. + */ + category: string; + + /** + * City where the seller is located + */ + city: string | null; + + /** + * Country where the seller is located + */ + country: string | null; + + /** + * Name of the seller + */ + name: string | null; + + /** + * Identifier assigned to the seller by the card brand + */ + network_id: string; + + /** + * Postal code where the seller is located + */ + postal_code: string | null; + + /** + * State where the seller is located + */ + state: string | null; + + /** + * The url an online purchase was made from + */ + url: string | null; + } + + interface RequestHistory { + /** + * Whether this request was approved. + */ + approved: boolean; + + /** + * The amount that was authorized at the time of this request + */ + authorized_amount: number; + + /** + * The currency that was presented to the cardholder for the authorization. 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). + */ + authorized_currency: string; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The amount Stripe held from your account to fund the authorization, if the request was approved + */ + held_amount: number; + + /** + * The currency of the [held amount](https://stripe.com/docs/api#issuing_authorization_object-held_amount) + */ + held_currency: string; + + /** + * The reason for the approval or decline. + */ + reason: RequestHistory.Reason; + + /** + * When an authorization is declined due to `authorization_controls`, this array contains details about the authorization controls that were violated. Otherwise, it is empty. + */ + violated_authorization_controls: Array< + RequestHistory.ViolatedAuthorizationControl + >; + } + + namespace RequestHistory { + type Reason = + | 'account_compliance_disabled' + | 'account_inactive' + | 'authentication_failed' + | 'authorization_controls' + | 'card_active' + | 'card_inactive' + | 'cardholder_inactive' + | 'cardholder_verification_required' + | 'insufficient_funds' + | 'not_allowed' + | 'suspected_fraud' + | 'webhook_approved' + | 'webhook_declined' + | 'webhook_timeout'; + + interface ViolatedAuthorizationControl { + /** + * Entity which the authorization control acts on. One of `account`, `card`, or `cardholder`. + */ + entity: ViolatedAuthorizationControl.Entity; + + /** + * Name of the authorization control. One of `allowed_categories`, `blocked_categories`, `max_amount`, `max_approvals`, or `spending_limits`. + */ + name: ViolatedAuthorizationControl.Name; + } + + namespace ViolatedAuthorizationControl { + type Entity = 'account' | 'card' | 'cardholder'; + + type Name = + | 'allowed_categories' + | 'blocked_categories' + | 'max_amount' + | 'max_approvals' + | 'spending_limits'; + } + } + + type Status = 'closed' | 'pending' | 'reversed'; + + interface VerificationData { + /** + * Whether the cardholder provided an address first line and if it matched the cardholder's `billing.address.line1`. One of `match`, `mismatch`, or `not_provided`. + */ + address_line1_check: string; + + /** + * Whether the cardholder provided a zip (or postal code) and if it matched the cardholder's `billing.address.postal_code`. One of `match`, `mismatch`, or `not_provided`. + */ + address_zip_check: string; + + /** + * One of `exempt`, `failure`, `none`, or `success`. + */ + authentication: string; + + /** + * Whether the cardholder provided a CVC and if it matched Stripe's record. One of `match`, `mismatch`, or `not_provided`. + */ + cvc_check: string; + } + } + + interface AuthorizationRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface AuthorizationUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam | ''; + } + + interface AuthorizationListParams extends PaginationParams { + /** + * Only return issuing transactions that belong to the given card. + */ + card?: string; + + /** + * Only return authorizations belonging to the given cardholder. + */ + cardholder?: string; + + /** + * Only return authorizations that were created during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return authorizations with the given status. One of `pending`, `closed`, or `reversed`. + */ + status?: AuthorizationListParams.Status; + } + + namespace AuthorizationListParams { + type Status = 'closed' | 'pending' | 'reversed'; + } + + interface AuthorizationApproveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * If the authorization's `is_held_amount_controllable` property is `true`, you may provide this value to control how much to hold for the authorization. Must be positive (use [`decline`](https://stripe.com/docs/api/issuing/authorizations/decline) to decline an authorization request). + */ + held_amount?: number; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam | ''; + } + + interface AuthorizationDeclineParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam | ''; + } + + class AuthorizationsResource { + /** + * Retrieves an Issuing Authorization object. + */ + retrieve( + id: string, + params?: AuthorizationRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified Issuing Authorization object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: AuthorizationUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Issuing Authorization objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: AuthorizationListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Approves a pending Issuing Authorization object. + */ + approve( + id: string, + params?: AuthorizationApproveParams, + options?: RequestOptions + ): Promise; + approve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Declines a pending Issuing Authorization object. + */ + decline( + id: string, + params?: AuthorizationDeclineParams, + options?: RequestOptions + ): Promise; + decline( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/Issuing/CardDetails.d.ts b/types/2019-12-03/Issuing/CardDetails.d.ts new file mode 100644 index 0000000000..057ae69912 --- /dev/null +++ b/types/2019-12-03/Issuing/CardDetails.d.ts @@ -0,0 +1,37 @@ +declare module 'stripe' { + namespace Stripe { + namespace Issuing { + /** + * The CardDetails object. + */ + interface CardDetails { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuing.card_details'; + + card: Issuing.Card; + + /** + * The CVC number for the card. + */ + cvc: string; + + /** + * The expiration month of the card. + */ + exp_month: number; + + /** + * The expiration year of the card. + */ + exp_year: number; + + /** + * The card number. + */ + number: string; + } + } + } +} diff --git a/types/2019-12-03/Issuing/Cardholders.d.ts b/types/2019-12-03/Issuing/Cardholders.d.ts new file mode 100644 index 0000000000..5529f4bfee --- /dev/null +++ b/types/2019-12-03/Issuing/Cardholders.d.ts @@ -0,0 +1,3356 @@ +declare module 'stripe' { + namespace Stripe { + namespace Issuing { + /** + * The Cardholder object. + */ + interface Cardholder { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuing.cardholder'; + + /** + * Spending rules that give you some control over how this cardholder's cards can be used. Refer to our [authorizations](https://stripe.com/docs/issuing/authorizations) documentation for more details. + */ + authorization_controls: Cardholder.AuthorizationControls | null; + + billing: Cardholder.Billing; + + /** + * Additional information about a `business_entity` cardholder. + */ + company: Cardholder.Company | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The cardholder's email address. + */ + email: string | null; + + /** + * Additional information about an `individual` cardholder. + */ + individual: Cardholder.Individual | null; + + /** + * Whether or not this cardholder is the default cardholder. + */ + is_default: boolean; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The cardholder's name. This will be printed on cards issued to them. + */ + name: string; + + /** + * The cardholder's phone number. + */ + phone_number: string | null; + + requirements: Cardholder.Requirements; + + /** + * Specifies whether to permit authorizations on this cardholder's cards. + */ + status: Cardholder.Status; + + /** + * One of `individual` or `business_entity`. + */ + type: Cardholder.Type; + } + + namespace Cardholder { + interface AuthorizationControls { + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this cardholder's cards. + */ + allowed_categories: Array< + AuthorizationControls.AllowedCategory + > | null; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this cardholder's cards. + */ + blocked_categories: Array< + AuthorizationControls.BlockedCategory + > | null; + + /** + * Limit the spending with rules based on time intervals and categories. + */ + spending_limits: Array | null; + + /** + * Currency for the amounts within spending_limits. + */ + spending_limits_currency: string | null; + } + + namespace AuthorizationControls { + type AllowedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type BlockedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + interface SpendingLimit { + /** + * Maximum amount allowed to spend per time interval. + */ + amount: number; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) on which to apply the spending limit. Leave this blank to limit all charges. + */ + categories: Array | null; + + /** + * The time interval or event with which to apply this spending limit towards. + */ + interval: SpendingLimit.Interval; + } + + namespace SpendingLimit { + type Category = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type Interval = + | 'all_time' + | 'daily' + | 'monthly' + | 'per_authorization' + | 'weekly' + | 'yearly'; + } + } + + interface Billing { + address: Address; + + name: string | null; + } + + interface Company { + /** + * Whether the company's business ID number was provided. + */ + tax_id_provided: boolean; + } + + interface Individual { + /** + * The date of birth of this cardholder. + */ + dob: Individual.Dob | null; + + /** + * The first name of this cardholder. + */ + first_name: string; + + /** + * The last name of this cardholder. + */ + last_name: string; + + /** + * Government-issued ID document for this cardholder. + */ + verification: Individual.Verification | null; + } + + namespace Individual { + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number | null; + + /** + * The month of birth, between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year of birth. + */ + year: number | null; + } + + interface Verification { + /** + * An identifying document, either a passport or local ID card. + */ + document: Verification.Document | null; + } + + namespace Verification { + interface Document { + /** + * The back of a document returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + back: string | File | null; + + /** + * The front of a document returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + front: string | File | null; + } + } + } + + interface Requirements { + /** + * If `disabled_reason` is present, all cards will decline authorizations with `cardholder_verification_required` reason. + */ + disabled_reason: Requirements.DisabledReason | null; + + /** + * If not empty, this field contains the list of fields that need to be collected in order to verify and re-enabled the cardholder. + */ + past_due: Array | null; + } + + namespace Requirements { + type DisabledReason = 'listed' | 'rejected.listed' | 'under_review'; + + type PastDue = + | 'individual.dob.day' + | 'individual.dob.month' + | 'individual.dob.year' + | 'individual.first_name' + | 'individual.last_name' + | 'individual.verification.document'; + } + + type Status = 'active' | 'blocked' | 'inactive'; + + type Type = 'business_entity' | 'individual'; + } + + interface CardholderCreateParams { + /** + * The cardholder's billing address. + */ + billing: CardholderCreateParams.Billing; + + /** + * The cardholder's name. This will be printed on cards issued to them. + */ + name: string; + + /** + * One of `individual` or `business_entity`. + */ + type: CardholderCreateParams.Type; + + /** + * Spending rules that give you control over how your cardholders can make charges. Refer to our [authorizations](https://stripe.com/docs/issuing/authorizations) documentation for more details. + */ + authorization_controls?: CardholderCreateParams.AuthorizationControls; + + /** + * Additional information about a `business_entity` cardholder. + */ + company?: CardholderCreateParams.Company; + + /** + * The cardholder's email address. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Additional information about an `individual` cardholder. + */ + individual?: CardholderCreateParams.Individual; + + /** + * Specifies whether to set this as the default cardholder. + */ + is_default?: boolean; + + metadata?: MetadataParam; + + /** + * The cardholder's phone number. This will be transformed to [E.164](https://en.wikipedia.org/wiki/E.164) if it is not provided in that format already. + */ + phone_number?: string; + + /** + * Specifies whether to permit authorizations on this cardholder's cards. Defaults to `active`. + */ + status?: CardholderCreateParams.Status; + } + + namespace CardholderCreateParams { + interface AuthorizationControls { + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this card. + */ + allowed_categories?: Array; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this card. + */ + blocked_categories?: Array; + + /** + * Limit the spending with rules based on time intervals and categories. + */ + spending_limits?: Array; + + /** + * Currency for your spending limits. Defaults to your merchant country's currency. + */ + spending_limits_currency?: string; + } + + namespace AuthorizationControls { + type AllowedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type BlockedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + interface SpendingLimit { + /** + * Maximum amount allowed to spend per time interval. + */ + amount: number; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) on which to apply the spending limit. Leave this blank to limit all charges. + */ + categories?: Array; + + /** + * The time interval with which to apply this spending limit towards. + */ + interval: SpendingLimit.Interval; + } + + namespace SpendingLimit { + type Category = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type Interval = + | 'all_time' + | 'daily' + | 'monthly' + | 'per_authorization' + | 'weekly' + | 'yearly'; + } + } + + interface Billing { + address: Billing.Address; + + /** + * Deprecated param. Passing value for this param is simply discarded. It will be removed in the next client library major version + */ + name?: string; + } + + namespace Billing { + interface Address { + city: string; + + country: string; + + line1: string; + + line2?: string; + + postal_code: string; + + state?: string; + } + } + + interface Company { + /** + * The entity's business ID number. + */ + tax_id?: string; + } + + interface Individual { + /** + * The date of birth of this cardholder. + */ + dob?: Individual.Dob; + + /** + * The first name of this cardholder. + */ + first_name: string; + + /** + * The last name of this cardholder. + */ + last_name: string; + + /** + * Government-issued ID document for this cardholder. + */ + verification?: Individual.Verification; + } + + namespace Individual { + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Verification { + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + front?: string; + } + } + } + + type Status = 'active' | 'inactive'; + + type Type = 'business_entity' | 'individual'; + } + + interface CardholderRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CardholderUpdateParams { + /** + * Spending rules that give you some control over how your cards can be used. Refer to our [authorizations](https://stripe.com/docs/issuing/authorizations) documentation for more details. + */ + authorization_controls?: CardholderUpdateParams.AuthorizationControls; + + /** + * The cardholder's billing address. + */ + billing?: CardholderUpdateParams.Billing; + + /** + * Additional information about a `business_entity` cardholder. + */ + company?: CardholderUpdateParams.Company; + + /** + * The cardholder's email address. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Additional information about an `individual` cardholder. + */ + individual?: CardholderUpdateParams.Individual; + + /** + * Specifies whether to set this as the default cardholder. + */ + is_default?: boolean; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The cardholder's phone number. + */ + phone_number?: string; + + /** + * Specifies whether to permit authorizations on this cardholder's cards. + */ + status?: CardholderUpdateParams.Status; + } + + namespace CardholderUpdateParams { + interface AuthorizationControls { + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this card. + */ + allowed_categories?: Array; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this card. + */ + blocked_categories?: Array; + + /** + * Limit the spending with rules based on time intervals and categories. + */ + spending_limits?: Array; + + /** + * Currency for your spending limits. Defaults to your merchant country's currency. + */ + spending_limits_currency?: string; + } + + namespace AuthorizationControls { + type AllowedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type BlockedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + interface SpendingLimit { + /** + * Maximum amount allowed to spend per time interval. + */ + amount: number; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) on which to apply the spending limit. Leave this blank to limit all charges. + */ + categories?: Array; + + /** + * The time interval with which to apply this spending limit towards. + */ + interval: SpendingLimit.Interval; + } + + namespace SpendingLimit { + type Category = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type Interval = + | 'all_time' + | 'daily' + | 'monthly' + | 'per_authorization' + | 'weekly' + | 'yearly'; + } + } + + interface Billing { + address: Billing.Address; + + /** + * Deprecated param. Passing value for this param is simply discarded. It will be removed in the next client library major version + */ + name?: string; + } + + namespace Billing { + interface Address { + city: string; + + country: string; + + line1: string; + + line2?: string; + + postal_code: string; + + state?: string; + } + } + + interface Company { + /** + * The entity's business ID number. + */ + tax_id?: string; + } + + interface Individual { + /** + * The date of birth of this cardholder. + */ + dob?: Individual.Dob; + + /** + * The first name of this cardholder. + */ + first_name: string; + + /** + * The last name of this cardholder. + */ + last_name: string; + + /** + * Government-issued ID document for this cardholder. + */ + verification?: Individual.Verification; + } + + namespace Individual { + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Verification { + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + front?: string; + } + } + } + + type Status = 'active' | 'inactive'; + } + + interface CardholderListParams extends PaginationParams { + /** + * Only return cardholders that were created during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Only return cardholders that have the given email address. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return the default cardholder. + */ + is_default?: boolean; + + /** + * Only return cardholders that have the given phone number. + */ + phone_number?: string; + + /** + * Only return cardholders that have the given status. One of `active`, `inactive`, or `blocked`. + */ + status?: CardholderListParams.Status; + + /** + * Only return cardholders that have the given type. One of `individual` or `business_entity`. + */ + type?: CardholderListParams.Type; + } + + namespace CardholderListParams { + type Status = 'active' | 'blocked' | 'inactive'; + + type Type = 'business_entity' | 'individual'; + } + + class CardholdersResource { + /** + * Creates a new Issuing Cardholder object that can be issued cards. + */ + create( + params: CardholderCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves an Issuing Cardholder object. + */ + retrieve( + id: string, + params?: CardholderRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified Issuing Cardholder object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: CardholderUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Issuing Cardholder objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: CardholderListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/Issuing/Cards.d.ts b/types/2019-12-03/Issuing/Cards.d.ts new file mode 100644 index 0000000000..0c7477b650 --- /dev/null +++ b/types/2019-12-03/Issuing/Cards.d.ts @@ -0,0 +1,3188 @@ +declare module 'stripe' { + namespace Stripe { + namespace Issuing { + /** + * The Card object. + */ + interface Card { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuing.card'; + + authorization_controls: Card.AuthorizationControls; + + /** + * The brand of the card. + */ + brand: string; + + /** + * The [Cardholder](https://stripe.com/docs/api#issuing_cardholder_object) object to which the card belongs. + */ + cardholder: Issuing.Cardholder | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * The expiration month of the card. + */ + exp_month: number; + + /** + * The expiration year of the card. + */ + exp_year: number; + + /** + * The last 4 digits of the card number. + */ + last4: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The name of the cardholder, printed on the card. + */ + name: string; + + /** + * Metadata about the PIN on the card. + */ + pin: Card.Pin | null; + + /** + * The card this card replaces, if any. + */ + replacement_for: string | Issuing.Card | null; + + /** + * The reason why the previous card needed to be replaced. + */ + replacement_reason: Card.ReplacementReason | null; + + /** + * Where and how the card will be shipped. + */ + shipping: Card.Shipping | null; + + /** + * Whether authorizations can be approved on this card. + */ + status: Card.Status; + + /** + * The type of the card. + */ + type: Card.Type; + } + + namespace Card { + interface AuthorizationControls { + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this card. + */ + allowed_categories: Array< + AuthorizationControls.AllowedCategory + > | null; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this card. + */ + blocked_categories: Array< + AuthorizationControls.BlockedCategory + > | null; + + /** + * The currency of the card. See [max_amount](https://stripe.com/docs/api#issuing_card_object-authorization_controls-max_amount) + */ + currency: string | null; + + /** + * Maximum count of approved authorizations on this card. Counts all authorizations retroactively. + */ + max_approvals: number | null; + + /** + * Limit the spending with rules based on time intervals and categories. + */ + spending_limits: Array | null; + + /** + * Currency for the amounts within spending_limits. Locked to the currency of the card. + */ + spending_limits_currency: string | null; + } + + namespace AuthorizationControls { + type AllowedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type BlockedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + interface SpendingLimit { + /** + * Maximum amount allowed to spend per time interval. + */ + amount: number; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) on which to apply the spending limit. Leave this blank to limit all charges. + */ + categories: Array | null; + + /** + * The time interval or event with which to apply this spending limit towards. + */ + interval: SpendingLimit.Interval; + } + + namespace SpendingLimit { + type Category = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type Interval = + | 'all_time' + | 'daily' + | 'monthly' + | 'per_authorization' + | 'weekly' + | 'yearly'; + } + } + + interface Pin { + /** + * Wether the PIN will be accepted or not. + */ + status: Pin.Status; + } + + namespace Pin { + type Status = 'active' | 'blocked'; + } + + type ReplacementReason = 'damage' | 'expiration' | 'loss' | 'theft'; + + interface Shipping { + address: Address; + + /** + * The delivery company that shipped a card. + */ + carrier: Shipping.Carrier | null; + + /** + * A unix timestamp representing a best estimate of when the card will be delivered. + */ + eta: number | null; + + /** + * Recipient name. + */ + name: string; + + /** + * Deprecated field. It always return null and will be removed in the next client library major version + */ + phone: string | null; + + /** + * The delivery status of the card. + */ + status: Shipping.Status | null; + + /** + * A tracking number for a card shipment. + */ + tracking_number: string | null; + + /** + * A link to the shipping carrier's site where you can view detailed information about a card shipment. + */ + tracking_url: string | null; + + /** + * Packaging options. + */ + type: Shipping.Type; + } + + namespace Shipping { + type Carrier = 'fedex' | 'usps'; + + type Status = + | 'canceled' + | 'delivered' + | 'failure' + | 'pending' + | 'returned' + | 'shipped'; + + type Type = 'bulk' | 'individual'; + } + + type Status = 'active' | 'canceled' | 'inactive' | 'lost' | 'stolen'; + + type Type = 'physical' | 'virtual'; + } + + interface CardCreateParams { + /** + * The currency for the card. This currently must be `usd`. + */ + currency: string; + + /** + * The type of card to issue. Possible values are `physical` or `virtual`. + */ + type: string | CardCreateParams.Type; + + /** + * Spending rules that give you some control over how your cards can be used. Refer to our [authorizations](https://stripe.com/docs/issuing/authorizations) documentation for more details. + */ + authorization_controls?: CardCreateParams.AuthorizationControls; + + /** + * The [Cardholder](https://stripe.com/docs/api#issuing_cardholder_object) object with which the card will be associated. + */ + cardholder?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + metadata?: MetadataParam; + + /** + * The card this is meant to be a replacement for (if any). + */ + replacement_for?: string; + + /** + * If `replacement_for` is specified, this should indicate why that card is being replaced. + */ + replacement_reason?: CardCreateParams.ReplacementReason; + + /** + * The address where the card will be shipped. + */ + shipping?: CardCreateParams.Shipping; + + /** + * Whether authorizations can be approved on this card. Defaults to `inactive`. + */ + status?: CardCreateParams.Status; + } + + namespace CardCreateParams { + interface AuthorizationControls { + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this card. + */ + allowed_categories?: Array; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this card. + */ + blocked_categories?: Array; + + /** + * Maximum count of approved authorizations on this card. Counts all authorizations retroactively. + */ + max_approvals?: number; + + /** + * Limit the spending with rules based on time intervals and categories. + */ + spending_limits?: Array; + } + + namespace AuthorizationControls { + type AllowedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type BlockedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + interface SpendingLimit { + /** + * Maximum amount allowed to spend per time interval. + */ + amount: number; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) on which to apply the spending limit. Leave this blank to limit all charges. + */ + categories?: Array; + + /** + * The time interval with which to apply this spending limit towards. + */ + interval: SpendingLimit.Interval; + } + + namespace SpendingLimit { + type Category = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type Interval = + | 'all_time' + | 'daily' + | 'monthly' + | 'per_authorization' + | 'weekly' + | 'yearly'; + } + } + + type ReplacementReason = 'damage' | 'expiration' | 'loss' | 'theft'; + + interface Shipping { + address: Shipping.Address; + + name: string; + + /** + * Packaging options. + */ + type?: string | Shipping.Type; + } + + namespace Shipping { + interface Address { + city: string; + + country: string; + + line1: string; + + line2?: string; + + postal_code: string; + + state?: string; + } + + type Type = 'bulk' | 'individual'; + } + + type Status = 'active' | 'inactive'; + + type Type = 'physical' | 'virtual'; + } + + interface CardRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CardUpdateParams { + /** + * Spending rules that give you some control over how your cards can be used. Refer to our [authorizations](https://stripe.com/docs/issuing/authorizations) documentation for more details. + */ + authorization_controls?: CardUpdateParams.AuthorizationControls; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + metadata?: MetadataParam | ''; + + /** + * Whether authorizations can be approved on this card. + */ + status?: CardUpdateParams.Status; + } + + namespace CardUpdateParams { + interface AuthorizationControls { + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this card. + */ + allowed_categories?: Array; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this card. + */ + blocked_categories?: Array; + + /** + * Maximum count of approved authorizations on this card. Counts all authorizations retroactively. + */ + max_approvals?: number; + + /** + * Limit the spending with rules based on time intervals and categories. + */ + spending_limits?: Array; + } + + namespace AuthorizationControls { + type AllowedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type BlockedCategory = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + interface SpendingLimit { + /** + * Maximum amount allowed to spend per time interval. + */ + amount: number; + + /** + * Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) on which to apply the spending limit. Leave this blank to limit all charges. + */ + categories?: Array; + + /** + * The time interval with which to apply this spending limit towards. + */ + interval: SpendingLimit.Interval; + } + + namespace SpendingLimit { + type Category = + | 'ac_refrigeration_repair' + | 'accounting_bookkeeping_services' + | 'advertising_services' + | 'agricultural_cooperative' + | 'airlines_air_carriers' + | 'airports_flying_fields' + | 'ambulance_services' + | 'amusement_parks_carnivals' + | 'antique_reproductions' + | 'antique_shops' + | 'aquariums' + | 'architectural_surveying_services' + | 'art_dealers_and_galleries' + | 'artists_supply_and_craft_shops' + | 'auto_and_home_supply_stores' + | 'auto_body_repair_shops' + | 'auto_paint_shops' + | 'auto_service_shops' + | 'automated_cash_disburse' + | 'automated_fuel_dispensers' + | 'automobile_associations' + | 'automotive_parts_and_accessories_stores' + | 'automotive_tire_stores' + | 'bail_and_bond_payments' + | 'bakeries' + | 'bands_orchestras' + | 'barber_and_beauty_shops' + | 'betting_casino_gambling' + | 'bicycle_shops' + | 'billiard_pool_establishments' + | 'boat_dealers' + | 'boat_rentals_and_leases' + | 'book_stores' + | 'books_periodicals_and_newspapers' + | 'bowling_alleys' + | 'bus_lines' + | 'business_secretarial_schools' + | 'buying_shopping_services' + | 'cable_satellite_and_other_pay_television_and_radio' + | 'camera_and_photographic_supply_stores' + | 'candy_nut_and_confectionery_stores' + | 'car_and_truck_dealers_new_used' + | 'car_and_truck_dealers_used_only' + | 'car_rental_agencies' + | 'car_washes' + | 'carpentry_services' + | 'carpet_upholstery_cleaning' + | 'caterers' + | 'charitable_and_social_service_organizations_fundraising' + | 'chemicals_and_allied_products' + | 'child_care_services' + | 'childrens_and_infants_wear_stores' + | 'chiropodists_podiatrists' + | 'chiropractors' + | 'cigar_stores_and_stands' + | 'civic_social_fraternal_associations' + | 'cleaning_and_maintenance' + | 'clothing_rental' + | 'colleges_universities' + | 'commercial_equipment' + | 'commercial_footwear' + | 'commercial_photography_art_and_graphics' + | 'commuter_transport_and_ferries' + | 'computer_network_services' + | 'computer_programming' + | 'computer_repair' + | 'computer_software_stores' + | 'computers_peripherals_and_software' + | 'concrete_work_services' + | 'construction_materials' + | 'consulting_public_relations' + | 'correspondence_schools' + | 'cosmetic_stores' + | 'counseling_services' + | 'country_clubs' + | 'courier_services' + | 'court_costs' + | 'credit_reporting_agencies' + | 'cruise_lines' + | 'dairy_products_stores' + | 'dance_hall_studios_schools' + | 'dating_escort_services' + | 'dentists_orthodontists' + | 'department_stores' + | 'detective_agencies' + | 'digital_goods_applications' + | 'digital_goods_games' + | 'digital_goods_large_volume' + | 'digital_goods_media' + | 'direct_marketing_catalog_merchant' + | 'direct_marketing_combination_catalog_and_retail_merchant' + | 'direct_marketing_inbound_telemarketing' + | 'direct_marketing_insurance_services' + | 'direct_marketing_other' + | 'direct_marketing_outbound_telemarketing' + | 'direct_marketing_subscription' + | 'direct_marketing_travel' + | 'discount_stores' + | 'doctors' + | 'door_to_door_sales' + | 'drapery_window_covering_and_upholstery_stores' + | 'drinking_places' + | 'drug_stores_and_pharmacies' + | 'drugs_drug_proprietaries_and_druggist_sundries' + | 'dry_cleaners' + | 'durable_goods' + | 'duty_free_stores' + | 'eating_places_restaurants' + | 'educational_services' + | 'electric_razor_stores' + | 'electrical_parts_and_equipment' + | 'electrical_services' + | 'electronics_repair_shops' + | 'electronics_stores' + | 'elementary_secondary_schools' + | 'employment_temp_agencies' + | 'equipment_rental' + | 'exterminating_services' + | 'family_clothing_stores' + | 'fast_food_restaurants' + | 'financial_institutions' + | 'fines_government_administrative_entities' + | 'fireplace_fireplace_screens_and_accessories_stores' + | 'floor_covering_stores' + | 'florists' + | 'florists_supplies_nursery_stock_and_flowers' + | 'freezer_and_locker_meat_provisioners' + | 'fuel_dealers_non_automotive' + | 'funeral_services_crematories' + | 'furniture_home_furnishings_and_equipment_stores_except_appliances' + | 'furniture_repair_refinishing' + | 'furriers_and_fur_shops' + | 'general_services' + | 'gift_card_novelty_and_souvenir_shops' + | 'glass_paint_and_wallpaper_stores' + | 'glassware_crystal_stores' + | 'golf_courses_public' + | 'government_services' + | 'grocery_stores_supermarkets' + | 'hardware_equipment_and_supplies' + | 'hardware_stores' + | 'health_and_beauty_spas' + | 'hearing_aids_sales_and_supplies' + | 'heating_plumbing_a_c' + | 'hobby_toy_and_game_shops' + | 'home_supply_warehouse_stores' + | 'hospitals' + | 'hotels_motels_and_resorts' + | 'household_appliance_stores' + | 'industrial_supplies' + | 'information_retrieval_services' + | 'insurance_default' + | 'insurance_underwriting_premiums' + | 'intra_company_purchases' + | 'jewelry_stores_watches_clocks_and_silverware_stores' + | 'landscaping_services' + | 'laundries' + | 'laundry_cleaning_services' + | 'legal_services_attorneys' + | 'luggage_and_leather_goods_stores' + | 'lumber_building_materials_stores' + | 'manual_cash_disburse' + | 'marinas_service_and_supplies' + | 'masonry_stonework_and_plaster' + | 'massage_parlors' + | 'medical_and_dental_labs' + | 'medical_dental_ophthalmic_and_hospital_equipment_and_supplies' + | 'medical_services' + | 'membership_organizations' + | 'mens_and_boys_clothing_and_accessories_stores' + | 'mens_womens_clothing_stores' + | 'metal_service_centers' + | 'miscellaneous' + | 'miscellaneous_apparel_and_accessory_shops' + | 'miscellaneous_auto_dealers' + | 'miscellaneous_business_services' + | 'miscellaneous_food_stores' + | 'miscellaneous_general_merchandise' + | 'miscellaneous_general_services' + | 'miscellaneous_home_furnishing_specialty_stores' + | 'miscellaneous_publishing_and_printing' + | 'miscellaneous_recreation_services' + | 'miscellaneous_repair_shops' + | 'miscellaneous_specialty_retail' + | 'mobile_home_dealers' + | 'motion_picture_theaters' + | 'motor_freight_carriers_and_trucking' + | 'motor_homes_dealers' + | 'motor_vehicle_supplies_and_new_parts' + | 'motorcycle_shops_and_dealers' + | 'motorcycle_shops_dealers' + | 'music_stores_musical_instruments_pianos_and_sheet_music' + | 'news_dealers_and_newsstands' + | 'non_fi_money_orders' + | 'non_fi_stored_value_card_purchase_load' + | 'nondurable_goods' + | 'nurseries_lawn_and_garden_supply_stores' + | 'nursing_personal_care' + | 'office_and_commercial_furniture' + | 'opticians_eyeglasses' + | 'optometrists_ophthalmologist' + | 'orthopedic_goods_prosthetic_devices' + | 'osteopaths' + | 'package_stores_beer_wine_and_liquor' + | 'paints_varnishes_and_supplies' + | 'parking_lots_garages' + | 'passenger_railways' + | 'pawn_shops' + | 'pet_shops_pet_food_and_supplies' + | 'petroleum_and_petroleum_products' + | 'photo_developing' + | 'photographic_photocopy_microfilm_equipment_and_supplies' + | 'photographic_studios' + | 'picture_video_production' + | 'piece_goods_notions_and_other_dry_goods' + | 'plumbing_heating_equipment_and_supplies' + | 'political_organizations' + | 'postal_services_government_only' + | 'precious_stones_and_metals_watches_and_jewelry' + | 'professional_services' + | 'public_warehousing_and_storage' + | 'quick_copy_repro_and_blueprint' + | 'railroads' + | 'real_estate_agents_and_managers_rentals' + | 'record_stores' + | 'recreational_vehicle_rentals' + | 'religious_goods_stores' + | 'religious_organizations' + | 'roofing_siding_sheet_metal' + | 'secretarial_support_services' + | 'security_brokers_dealers' + | 'service_stations' + | 'sewing_needlework_fabric_and_piece_goods_stores' + | 'shoe_repair_hat_cleaning' + | 'shoe_stores' + | 'small_appliance_repair' + | 'snowmobile_dealers' + | 'special_trade_services' + | 'specialty_cleaning' + | 'sporting_goods_stores' + | 'sporting_recreation_camps' + | 'sports_and_riding_apparel_stores' + | 'sports_clubs_fields' + | 'stamp_and_coin_stores' + | 'stationary_office_supplies_printing_and_writing_paper' + | 'stationery_stores_office_and_school_supply_stores' + | 'swimming_pools_sales' + | 't_ui_travel_germany' + | 'tailors_alterations' + | 'tax_payments_government_agencies' + | 'tax_preparation_services' + | 'taxicabs_limousines' + | 'telecommunication_equipment_and_telephone_sales' + | 'telecommunication_services' + | 'telegraph_services' + | 'tent_and_awning_shops' + | 'testing_laboratories' + | 'theatrical_ticket_agencies' + | 'timeshares' + | 'tire_retreading_and_repair' + | 'tolls_bridge_fees' + | 'tourist_attractions_and_exhibits' + | 'towing_services' + | 'trailer_parks_campgrounds' + | 'transportation_services' + | 'travel_agencies_tour_operators' + | 'truck_stop_iteration' + | 'truck_utility_trailer_rentals' + | 'typesetting_plate_making_and_related_services' + | 'typewriter_stores' + | 'u_s_federal_government_agencies_or_departments' + | 'uniforms_commercial_clothing' + | 'used_merchandise_and_secondhand_stores' + | 'utilities' + | 'variety_stores' + | 'veterinary_services' + | 'video_amusement_game_supplies' + | 'video_game_arcades' + | 'video_tape_rental_stores' + | 'vocational_trade_schools' + | 'watch_jewelry_repair' + | 'welding_repair' + | 'wholesale_clubs' + | 'wig_and_toupee_stores' + | 'wires_money_orders' + | 'womens_accessory_and_specialty_shops' + | 'womens_ready_to_wear_stores' + | 'wrecking_and_salvage_yards'; + + type Interval = + | 'all_time' + | 'daily' + | 'monthly' + | 'per_authorization' + | 'weekly' + | 'yearly'; + } + } + + type Status = 'active' | 'canceled' | 'inactive' | 'lost' | 'stolen'; + } + + interface CardListParams extends PaginationParams { + /** + * Only return cards belonging to the Cardholder with the provided ID. + */ + cardholder?: string; + + /** + * Only return cards that were issued during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Only return cards that have the given expiration month. + */ + exp_month?: number; + + /** + * Only return cards that have the given expiration year. + */ + exp_year?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return cards that have the given last four digits. + */ + last4?: string; + + /** + * Only return cards that have the given name. + */ + name?: string; + + /** + * Only return cards whose full card number matches that of this card source ID. + */ + source?: string; + + /** + * Only return cards that have the given status. One of `active`, `inactive`, `canceled`, `lost`, or `stolen`. + */ + status?: CardListParams.Status; + + /** + * Only return cards that have the given type. One of `virtual` or `physical`. + */ + type?: CardListParams.Type; + } + + namespace CardListParams { + type Status = 'active' | 'canceled' | 'inactive' | 'lost' | 'stolen'; + + type Type = 'physical' | 'virtual'; + } + + interface CardRetrieveDetailsParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class CardsResource { + /** + * Creates an Issuing Card object. + */ + create( + params: CardCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves an Issuing Card object. + */ + retrieve( + id: string, + params?: CardRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified Issuing Card object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: CardUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Issuing Card objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: CardListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * For virtual cards only. Retrieves an Issuing card_details object that contains [the sensitive details](https://stripe.com/docs/issuing/cards/management#virtual-card-info) of a virtual card. + */ + retrieveDetails( + id: string, + params?: CardRetrieveDetailsParams, + options?: RequestOptions + ): Promise; + retrieveDetails( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/Issuing/Disputes.d.ts b/types/2019-12-03/Issuing/Disputes.d.ts new file mode 100644 index 0000000000..de165f2beb --- /dev/null +++ b/types/2019-12-03/Issuing/Disputes.d.ts @@ -0,0 +1,255 @@ +declare module 'stripe' { + namespace Stripe { + namespace Issuing { + /** + * The Dispute object. + */ + interface Dispute { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuing.dispute'; + + /** + * Disputed amount. Usually the amount of the `disputed_transaction`, but can differ (usually because of currency fluctuation or because only part of the order is disputed). + */ + amount: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The currency the `disputed_transaction` was made in. + */ + currency: string; + + /** + * The transaction being disputed. + */ + disputed_transaction: string | Issuing.Transaction; + + evidence: Dispute.Evidence; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs 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: Metadata; + + /** + * Reason for this dispute. One of `other` or `fraudulent`. + */ + reason: string; + + /** + * Current status of dispute. One of `lost`, `under_review`, `unsubmitted`, or `won`. + */ + status: Dispute.Status; + } + + namespace Dispute { + interface Evidence { + /** + * Evidence to support a fraudulent dispute. This will only be present if your dispute's `reason` is `fraudulent`. + */ + fraudulent: Evidence.Fraudulent | null; + + /** + * Evidence to support an uncategorized dispute. This will only be present if your dispute's `reason` is `other`. + */ + other: Evidence.Other | null; + } + + namespace Evidence { + interface Fraudulent { + /** + * Brief freeform text explaining why you are disputing this transaction. + */ + dispute_explanation: string | null; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional file evidence supporting your dispute. + */ + uncategorized_file: string | File | null; + } + + interface Other { + /** + * Brief freeform text explaining why you are disputing this transaction. + */ + dispute_explanation: string; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional file evidence supporting your dispute. + */ + uncategorized_file: string | File | null; + } + } + + type Status = 'lost' | 'under_review' | 'unsubmitted' | 'won'; + } + + interface DisputeCreateParams { + /** + * The ID of the issuing transaction to create a dispute for. + */ + disputed_transaction: string; + + /** + * The reason for the dispute. One of `other` or `fraudulent`. + */ + reason: DisputeCreateParams.Reason; + + /** + * Amount to dispute, defaults to full value, given in the currency the transaction was made in. + */ + amount?: number; + + /** + * A hash containing all the evidence related to the dispute. This should have a single key, equal to the provided `reason`, mapping to an appropriate evidence object. + */ + evidence?: DisputeCreateParams.Evidence; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + namespace DisputeCreateParams { + interface Evidence { + /** + * Evidence to support a fraudulent dispute. Only provide this if your dispute's `reason` is `fraudulent`. + */ + fraudulent?: Evidence.Fraudulent; + + /** + * Evidence to support an uncategorized dispute. Only provide this if your dispute's `reason` is `other`. + */ + other?: Evidence.Other; + } + + namespace Evidence { + interface Fraudulent { + /** + * Brief freeform text explaining why you are disputing this transaction. + */ + dispute_explanation: string; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional file evidence supporting your dispute. + */ + uncategorized_file?: string; + } + + interface Other { + /** + * Brief freeform text explaining why you are disputing this transaction. + */ + dispute_explanation: string; + + /** + * (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional file evidence supporting your dispute. + */ + uncategorized_file?: string; + } + } + + type Reason = 'fraudulent' | 'other'; + } + + interface DisputeRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface DisputeUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface DisputeListParams extends PaginationParams { + /** + * Only return issuing disputes that were created during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Only return issuing disputes for the given transaction. + */ + disputed_transaction?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class DisputesResource { + /** + * Creates an Issuing Dispute object. + */ + create( + params: DisputeCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves an Issuing Dispute object. + */ + retrieve( + id: string, + params?: DisputeRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified Issuing Dispute object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: DisputeUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Issuing Dispute objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: DisputeListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/Issuing/Transactions.d.ts b/types/2019-12-03/Issuing/Transactions.d.ts new file mode 100644 index 0000000000..27397f6741 --- /dev/null +++ b/types/2019-12-03/Issuing/Transactions.d.ts @@ -0,0 +1,209 @@ +declare module 'stripe' { + namespace Stripe { + namespace Issuing { + /** + * The Transaction object. + */ + interface Transaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'issuing.transaction'; + + /** + * The amount of this transaction in your currency. This is the amount that your balance will be updated by. + */ + amount: number; + + /** + * The `Authorization` object that led to this transaction. + */ + authorization: string | Issuing.Authorization | null; + + balance_transaction: string | BalanceTransaction | null; + + /** + * The card used to make this transaction. + */ + card: string | Issuing.Card; + + /** + * The cardholder to whom this transaction belongs. + */ + cardholder: string | Issuing.Cardholder | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + dispute: string | Issuing.Dispute | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The amount that the merchant will receive, denominated in `merchant_currency`. It will be different from `amount` if the merchant is taking payment in a different currency. + */ + merchant_amount: number; + + /** + * The currency with which the merchant is taking payment. + */ + merchant_currency: string; + + merchant_data: Transaction.MerchantData; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The nature of the transaction. + */ + type: Transaction.Type; + } + + namespace Transaction { + interface MerchantData { + /** + * A categorization of the seller's type of business. See our [merchant categories guide](https://stripe.com/docs/issuing/merchant-categories) for a list of possible values. + */ + category: string; + + /** + * City where the seller is located + */ + city: string | null; + + /** + * Country where the seller is located + */ + country: string | null; + + /** + * Name of the seller + */ + name: string | null; + + /** + * Identifier assigned to the seller by the card brand + */ + network_id: string; + + /** + * Postal code where the seller is located + */ + postal_code: string | null; + + /** + * State where the seller is located + */ + state: string | null; + + /** + * The url an online purchase was made from + */ + url: string | null; + } + + type Type = + | 'capture' + | 'cash_withdrawal' + | 'dispute' + | 'dispute_loss' + | 'refund' + | 'refund_reversal'; + } + + interface TransactionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TransactionUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + metadata?: MetadataParam | ''; + } + + interface TransactionListParams extends PaginationParams { + /** + * Only return issuing transactions that belong to the given card. + */ + card?: string; + + /** + * Only return authorizations belonging to the given cardholder. + */ + cardholder?: string; + + /** + * Only return transactions that were created during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Only return transactions that originate from a given dispute. + */ + dispute?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class TransactionsResource { + /** + * Retrieves an Issuing Transaction object. + */ + retrieve( + id: string, + params?: TransactionRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified Issuing Transaction object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: TransactionUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Issuing Transaction objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: TransactionListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/LoginLinks.d.ts b/types/2019-12-03/LoginLinks.d.ts new file mode 100644 index 0000000000..8fecfa9f6a --- /dev/null +++ b/types/2019-12-03/LoginLinks.d.ts @@ -0,0 +1,35 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The LoginLink object. + */ + interface LoginLink { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'login_link'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The URL for the login link. + */ + url: string; + } + + interface LoginLinkCreateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Where to redirect the user after they log out of their dashboard. + */ + redirect_url?: string; + } + } +} diff --git a/types/2019-12-03/Mandates.d.ts b/types/2019-12-03/Mandates.d.ts new file mode 100644 index 0000000000..4555cdb56d --- /dev/null +++ b/types/2019-12-03/Mandates.d.ts @@ -0,0 +1,152 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Mandate object. + */ + interface Mandate { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'mandate'; + + customer_acceptance: Mandate.CustomerAcceptance; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + multi_use?: Mandate.MultiUse; + + /** + * ID of the payment method associated with this mandate. + */ + payment_method: string | PaymentMethod; + + payment_method_details: Mandate.PaymentMethodDetails; + + single_use?: Mandate.SingleUse; + + /** + * The status of the Mandate, one of `active`, `inactive`, or `pending`. The Mandate can be used to initiate a payment only if status=active. + */ + status: Mandate.Status; + + /** + * The type of the mandate, one of `multi_use` or `single_use` + */ + type: Mandate.Type; + } + + namespace Mandate { + interface CustomerAcceptance { + /** + * The time at which the customer accepted the Mandate. + */ + accepted_at: number | null; + + offline?: CustomerAcceptance.Offline; + + online?: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. One of `online` or `offline`. + */ + type: CustomerAcceptance.Type; + } + + namespace CustomerAcceptance { + interface Offline {} + + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address: string | null; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent: string | null; + } + + type Type = 'offline' | 'online'; + } + + interface MultiUse {} + + interface PaymentMethodDetails { + au_becs_debit?: PaymentMethodDetails.AuBecsDebit; + + card?: PaymentMethodDetails.Card; + + sepa_debit?: PaymentMethodDetails.SepaDebit; + + /** + * The type of the payment method associated with this mandate. An additional hash is included on `payment_method_details` with a name matching this value. It contains mandate information specific to the payment method. + */ + type: string; + } + + namespace PaymentMethodDetails { + interface AuBecsDebit { + url: string; + } + + interface Card {} + + interface SepaDebit { + /** + * The unique reference of the mandate. + */ + reference: string; + + /** + * The URL of the mandate. This URL generally contains sensitive information about the customer and should be shared with them exclusively. + */ + url: string; + } + } + + interface SingleUse { + /** + * On a single use mandate, the amount of the payment. + */ + amount: number; + + /** + * On a single use mandate, the currency of the payment. + */ + currency: string; + } + + type Status = 'active' | 'inactive' | 'pending'; + + type Type = 'multi_use' | 'single_use'; + } + + interface MandateRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class MandatesResource { + /** + * Retrieves a Mandate object. + */ + retrieve( + id: string, + params?: MandateRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/OrderItems.d.ts b/types/2019-12-03/OrderItems.d.ts new file mode 100644 index 0000000000..6277f590ff --- /dev/null +++ b/types/2019-12-03/OrderItems.d.ts @@ -0,0 +1,43 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The OrderItem object. + */ + interface OrderItem { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'order_item'; + + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the line item. + */ + 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; + + /** + * Description of the line item, meant to be displayable to the user (e.g., `"Express shipping"`). + */ + description: string; + + /** + * The ID of the associated object for this line item. Expandable if not null (e.g., expandable to a SKU). + */ + parent: string | Sku | null; + + /** + * A positive integer representing the number of instances of `parent` that are included in this order item. Applicable/present only if `type` is `sku`. + */ + quantity: number | null; + + /** + * The type of line item. One of `sku`, `tax`, `shipping`, or `discount`. + */ + type: string; + } + } +} diff --git a/types/2019-12-03/OrderReturns.d.ts b/types/2019-12-03/OrderReturns.d.ts new file mode 100644 index 0000000000..5f95335ffa --- /dev/null +++ b/types/2019-12-03/OrderReturns.d.ts @@ -0,0 +1,98 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The OrderReturn object. + */ + interface OrderReturn { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'order_return'; + + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the returned line item. + */ + amount: number; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * The items included in this order return. + */ + items: Array; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The order that this return includes items from. + */ + order: string | Order | null; + + /** + * The ID of the refund issued for this return. + */ + refund: string | Refund | null; + } + + interface OrderReturnRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface OrderReturnListParams extends PaginationParams { + /** + * Date this return was created. + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The order to retrieve returns for. + */ + order?: string; + } + + class OrderReturnsResource { + /** + * Retrieves the details of an existing order return. Supply the unique order ID from either an order return creation request or the order return list, and Stripe will return the corresponding order information. + */ + retrieve( + id: string, + params?: OrderReturnRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Returns a list of your order returns. The returns are returned sorted by creation date, with the most recently created return appearing first. + */ + list( + params?: OrderReturnListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Orders.d.ts b/types/2019-12-03/Orders.d.ts new file mode 100644 index 0000000000..b53a566fd6 --- /dev/null +++ b/types/2019-12-03/Orders.d.ts @@ -0,0 +1,528 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Order object. + */ + interface Order { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'order'; + + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order. + */ + amount: number; + + amount_returned: number | null; + + /** + * ID of the Connect Application that created the order. + */ + application: string | null; + + application_fee: number | null; + + /** + * The ID of the payment used to pay for the order. Present if the order status is `paid`, `fulfilled`, or `refunded`. + */ + charge: string | Charge | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * The customer used for the order. + */ + customer: string | Customer | DeletedCustomer | null; + + /** + * The email address of the customer placing the order. + */ + email: string | null; + + external_coupon_code?: string; + + /** + * List of items constituting the order. An order can have up to 25 items. + */ + items: Array; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + returns: ApiList | null; + + /** + * The shipping method that is currently selected for this order, if any. If present, it is equal to one of the `id`s of shipping methods in the `shipping_methods` array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method. + */ + selected_shipping_method: string | null; + + /** + * The shipping address for the order. Present if the order is for goods to be shipped. + */ + shipping: Order.Shipping | null; + + /** + * A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it. + */ + shipping_methods: Array | null; + + /** + * Current order status. One of `created`, `paid`, `canceled`, `fulfilled`, or `returned`. More details in the [Orders Guide](https://stripe.com/docs/orders/guide#understanding-order-statuses). + */ + status: string; + + /** + * The timestamps at which the order status was updated. + */ + status_transitions: Order.StatusTransitions | null; + + updated: number | null; + + /** + * The user's order ID if it is different from the Stripe order ID. + */ + upstream_id?: string; + } + + namespace Order { + interface Shipping { + address?: Address; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string | null; + + /** + * Recipient name. + */ + name?: string | null; + + /** + * Recipient phone (including extension). + */ + phone?: string | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string | null; + } + + interface ShippingMethod { + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the line item. + */ + 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; + + /** + * The estimated delivery date for the given shipping method. Can be either a specific date or a range. + */ + delivery_estimate: ShippingMethod.DeliveryEstimate | null; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string; + + /** + * Unique identifier for the object. + */ + id: string; + } + + namespace ShippingMethod { + interface DeliveryEstimate { + /** + * If `type` is `"exact"`, `date` will be the expected delivery date in the format YYYY-MM-DD. + */ + date?: string; + + /** + * If `type` is `"range"`, `earliest` will be be the earliest delivery date in the format YYYY-MM-DD. + */ + earliest?: string; + + /** + * If `type` is `"range"`, `latest` will be the latest delivery date in the format YYYY-MM-DD. + */ + latest?: string; + + /** + * The type of estimate. Must be either `"range"` or `"exact"`. + */ + type: string; + } + } + + interface StatusTransitions { + canceled: number | null; + + fulfiled: number | null; + + paid: number | null; + + returned: number | null; + } + } + + interface OrderCreateParams { + /** + * 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; + + /** + * A coupon code that represents a discount to be applied to this order. Must be one-time duration and in same currency as the order. An order can have multiple coupons. + */ + coupon?: string; + + /** + * The ID of an existing customer to use for this order. If provided, the customer email and shipping address will be used to create the order. Subsequently, the customer will also be charged to pay the order. If `email` or `shipping` are also provided, they will override the values retrieved from the customer object. + */ + customer?: string; + + /** + * The email address of the customer placing the order. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * List of items constituting the order. An order can have up to 25 items. + */ + items?: Array; + + /** + * A set of key-value pairs that you can attach to an order object. Limited to 500 characters. Metadata can be useful for storing additional information about the order in a structured format. + */ + metadata?: MetadataParam; + + /** + * Shipping address for the order. Required if any of the SKUs are for products that have `shippable` set to true. + */ + shipping?: OrderCreateParams.Shipping; + } + + namespace OrderCreateParams { + interface Item { + amount?: number; + + currency?: string; + + description?: string; + + /** + * The ID of the SKU being ordered. + */ + parent?: string; + + /** + * The quantity of this order item. When type is `sku`, this is the number of instances of the SKU to be ordered. + */ + quantity?: number; + + type?: Item.Type; + } + + namespace Item { + type Type = 'discount' | 'shipping' | 'sku' | 'tax'; + } + + interface Shipping { + /** + * Customer shipping address. + */ + address: AddressParam; + + /** + * Customer name. + */ + name: string; + + /** + * Customer phone (including extension). + */ + phone?: string; + } + } + + interface OrderRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface OrderUpdateParams { + /** + * A coupon code that represents a discount to be applied to this order. Must be one-time duration and in same currency as the order. An order can have multiple coupons. + */ + coupon?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to a product object. It can be useful for storing additional information about the order in a structured format. + */ + metadata?: MetadataParam; + + /** + * The shipping method to select for fulfilling this order. If specified, must be one of the `id`s of a shipping method in the `shipping_methods` array. If specified, will overwrite the existing selected shipping method, updating `items` as necessary. + */ + selected_shipping_method?: string; + + /** + * Tracking information once the order has been fulfilled. + */ + shipping?: OrderUpdateParams.Shipping; + + /** + * Current order status. One of `created`, `paid`, `canceled`, `fulfilled`, or `returned`. More detail in the [Orders Guide](https://stripe.com/docs/orders/guide#understanding-order-statuses). + */ + status?: OrderUpdateParams.Status; + } + + namespace OrderUpdateParams { + interface Shipping { + /** + * The name of the carrier like `USPS`, `UPS`, or `FedEx`. + */ + carrier: string; + + /** + * The tracking number provided by the carrier. + */ + tracking_number: string; + } + + type Status = 'canceled' | 'created' | 'fulfilled' | 'paid' | 'returned'; + } + + interface OrderListParams extends PaginationParams { + /** + * Date this order was created. + */ + created?: RangeQueryParam | number; + + /** + * Only return orders for the given customer. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return orders with the given IDs. + */ + ids?: Array; + + /** + * Only return orders that have the given status. One of `created`, `paid`, `fulfilled`, or `refunded`. + */ + status?: string; + + /** + * Filter orders based on when they were paid, fulfilled, canceled, or returned. + */ + status_transitions?: OrderListParams.StatusTransitions; + + /** + * Only return orders with the given upstream order IDs. + */ + upstream_ids?: Array; + } + + namespace OrderListParams { + interface StatusTransitions { + /** + * Date this order was canceled. + */ + canceled?: RangeQueryParam | number; + + /** + * Date this order was fulfilled. + */ + fulfilled?: RangeQueryParam | number; + + /** + * Date this order was paid. + */ + paid?: RangeQueryParam | number; + + /** + * Date this order was returned. + */ + returned?: RangeQueryParam | number; + } + } + + interface OrderPayParams { + application_fee?: number; + + /** + * The ID of an existing customer that will be charged for this order. If no customer was attached to the order at creation, either `source` or `customer` is required. Otherwise, the specified customer will be charged instead of the one attached to the order. + */ + customer?: string; + + /** + * The email address of the customer placing the order. Required if not previously specified for the order. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to an order object. Limited to 500 characters. Metadata can be useful for storing additional information about the order in a structured format. + */ + metadata?: MetadataParam; + + /** + * A [Token](https://stripe.com/docs/api#tokens)'s or a [Source](https://stripe.com/docs/api#sources)'s ID, as returned by [Elements](https://stripe.com/docs/elements). If no customer was attached to the order at creation, either `source` or `customer is required. Otherwise, the specified source will be charged intead of the customer attached to the order. + */ + source?: string; + } + + interface OrderReturnOrderParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * List of items to return. + */ + items?: OrderReturnOrderParams.Items | null; + } + + namespace OrderReturnOrderParams { + interface Items { + /** + * The amount (price) for this order item to return. + */ + amount?: number; + + /** + * If returning a `tax` item, use description to disambiguate which one to return. + */ + description?: string; + + /** + * The ID of the SKU, tax, or shipping item being returned. + */ + parent?: string; + + /** + * When type is `sku`, this is the number of instances of the SKU to be returned. + */ + quantity?: number; + + /** + * The type of this order item. Must be `sku`, `tax`, or `shipping`. + */ + type?: Items.Type; + } + + namespace Items { + type Type = 'discount' | 'shipping' | 'sku' | 'tax'; + } + } + + class OrdersResource { + /** + * Creates a new order object. + */ + create( + params: OrderCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information. + */ + retrieve( + id: string, + params?: OrderRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: OrderUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first. + */ + list( + params?: OrderListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Pay an order by providing a source to create a payment. + */ + pay( + id: string, + params?: OrderPayParams, + options?: RequestOptions + ): Promise; + pay(id: string, options?: RequestOptions): Promise; + + /** + * Return all or part of an order. The order must have a status of paid or fulfilled before it can be returned. Once all items have been returned, the order will become canceled or returned depending on which status the order started in. + */ + returnOrder( + id: string, + params?: OrderReturnOrderParams, + options?: RequestOptions + ): Promise; + returnOrder(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/PaymentIntents.d.ts b/types/2019-12-03/PaymentIntents.d.ts new file mode 100644 index 0000000000..60841f1567 --- /dev/null +++ b/types/2019-12-03/PaymentIntents.d.ts @@ -0,0 +1,1387 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The PaymentIntent object. + */ + interface PaymentIntent { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'payment_intent'; + + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount: number; + + /** + * Amount that can be captured from this PaymentIntent. + */ + amount_capturable: number; + + /** + * Amount that was collected by this PaymentIntent. + */ + amount_received: number; + + /** + * ID of the Connect application that created the PaymentIntent. + */ + application: string | Application | null; + + /** + * The amount of the application fee (if any) for the resulting payment. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + application_fee_amount: number | null; + + /** + * Populated when `status` is `canceled`, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch. + */ + canceled_at: number | null; + + /** + * Reason for cancellation of this PaymentIntent, either user-provided (`duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`) or generated by Stripe internally (`failed_invoice`, `void_invoice`, or `automatic`). + */ + cancellation_reason: PaymentIntent.CancellationReason | null; + + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method: PaymentIntent.CaptureMethod; + + /** + * Charges that were created by this PaymentIntent, if any. + */ + charges: ApiList; + + /** + * The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key. + * + * The client secret can be used to complete a payment from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret. + * + * Refer to our docs to [accept a payment](https://stripe.com/docs/payments/accept-a-payment) and learn about how `client_secret` should be handled. + */ + client_secret: string | null; + + confirmation_method: PaymentIntent.ConfirmationMethod; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * ID of the Customer this PaymentIntent belongs to, if one exists. + * + * If present, payment methods used with this PaymentIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this PaymentIntent. + */ + customer: string | Customer | DeletedCustomer | null; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * ID of the invoice that created this PaymentIntent, if it exists. + */ + invoice: string | Invoice | null; + + /** + * The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason. + */ + last_payment_error: PaymentIntent.LastPaymentError | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. For more information, see the [documentation](https://stripe.com/docs/payments/payment-intents/creating-payment-intents#storing-information-in-metadata). + */ + metadata: Metadata; + + /** + * If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source. + */ + next_action: PaymentIntent.NextAction | null; + + /** + * The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + on_behalf_of: string | Account | null; + + /** + * ID of the payment method used in this PaymentIntent. + */ + payment_method: string | PaymentMethod | null; + + /** + * Payment-method-specific configuration for this PaymentIntent. + */ + payment_method_options: PaymentIntent.PaymentMethodOptions | null; + + /** + * The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. + */ + payment_method_types: Array; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email: string | null; + + /** + * ID of the review associated with this PaymentIntent, if any. + */ + review: string | Review | null; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If present, the payment method used with this PaymentIntent can be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer, even after the transaction completes. + * + * For more, learn to [save card details after a payment](https://stripe.com/docs/payments/save-after-payment). + * + * Stripe uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by [SCA](https://stripe.com/docs/strong-customer-authentication), using `off_session` will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect [off-session payments](https://stripe.com/docs/payments/cards/charging-saved-cards#off-session-payments-with-saved-cards) for this customer. + */ + setup_future_usage: PaymentIntent.SetupFutureUsage | null; + + /** + * Shipping information for this PaymentIntent. + */ + shipping: PaymentIntent.Shipping | null; + + /** + * This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. + */ + source: + | string + | CustomerSource + | DeletedAlipayAccount + | DeletedBankAccount + | DeletedBitcoinReceiver + | DeletedCard + | null; + + /** + * For non-card charges, you can use this value as the complete description that appears on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor: string | null; + + /** + * Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix: string | null; + + /** + * Status of this PaymentIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `requires_capture`, `canceled`, or `succeeded`. Read more about each PaymentIntent [status](https://stripe.com/docs/payments/intents#intent-statuses). + */ + status: PaymentIntent.Status; + + /** + * The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + transfer_data: PaymentIntent.TransferData | null; + + /** + * A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + transfer_group: string | null; + } + + namespace PaymentIntent { + type CancellationReason = + | 'abandoned' + | 'automatic' + | 'duplicate' + | 'failed_invoice' + | 'fraudulent' + | 'requested_by_customer' + | 'void_invoice'; + + type CaptureMethod = 'automatic' | 'manual'; + + type ConfirmationMethod = 'automatic' | 'manual'; + + interface LastPaymentError { + /** + * For card errors, the ID of the failed charge. + */ + charge?: string; + + /** + * For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported. + */ + code?: string; + + /** + * For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one. + */ + decline_code?: string; + + /** + * A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported. + */ + doc_url?: string; + + /** + * A human-readable message providing more details about the error. For card errors, these messages can be shown to your users. + */ + message?: string; + + /** + * If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. + */ + param?: string; + + payment_intent?: PaymentIntent; + + payment_method?: PaymentMethod; + + setup_intent?: SetupIntent; + + source?: CustomerSource; + + /** + * The type of error returned. One of `api_connection_error`, `api_error`, `authentication_error`, `card_error`, `idempotency_error`, `invalid_request_error`, or `rate_limit_error` + */ + type: LastPaymentError.Type; + } + + namespace LastPaymentError { + type Type = + | 'api_connection_error' + | 'api_error' + | 'authentication_error' + | 'card_error' + | 'idempotency_error' + | 'invalid_request_error' + | 'rate_limit_error'; + } + + interface NextAction { + redirect_to_url?: NextAction.RedirectToUrl; + + /** + * Type of the next action to perform, one of `redirect_to_url` or `use_stripe_sdk`. + */ + type: string; + + /** + * When confirming a PaymentIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js. + */ + use_stripe_sdk?: NextAction.UseStripeSdk; + } + + namespace NextAction { + interface RedirectToUrl { + /** + * If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. + */ + return_url: string | null; + + /** + * The URL you must redirect your customer to in order to authenticate the payment. + */ + url: string | null; + } + + interface UseStripeSdk {} + } + + interface PaymentMethodOptions { + card?: PaymentMethodOptions.Card; + } + + namespace PaymentMethodOptions { + interface Card { + /** + * Installment details for this payment (Mexico only). + * + * For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). + */ + installments: Card.Installments | null; + + /** + * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + */ + request_three_d_secure: Card.RequestThreeDSecure | null; + } + + namespace Card { + interface Installments { + /** + * Installment plans that may be selected for this PaymentIntent. + */ + available_plans: Array | null; + + /** + * Whether Installments are enabled for this PaymentIntent. + */ + enabled: boolean; + + /** + * Installment plan selected for this PaymentIntent. + */ + plan: Installments.Plan | null; + } + + namespace Installments { + interface AvailablePlan { + /** + * For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + */ + count: number | null; + + /** + * For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + * One of `month`. + */ + interval: 'month' | null; + + /** + * Type of installment plan, one of `fixed_count`. + */ + type: 'fixed_count'; + } + + interface Plan { + /** + * For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + */ + count: number | null; + + /** + * For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + * One of `month`. + */ + interval: 'month' | null; + + /** + * Type of installment plan, one of `fixed_count`. + */ + type: 'fixed_count'; + } + } + + type RequestThreeDSecure = 'any' | 'automatic' | 'challenge_only'; + } + } + + type SetupFutureUsage = 'off_session' | 'on_session'; + + interface Shipping { + address?: Address; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string | null; + + /** + * Recipient name. + */ + name?: string | null; + + /** + * Recipient phone (including extension). + */ + phone?: string | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string | null; + } + + type Status = + | 'canceled' + | 'processing' + | 'requires_action' + | 'requires_capture' + | 'requires_confirmation' + | 'requires_payment_method' + | 'succeeded'; + + interface TransferData { + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount?: number; + + /** + * The account (if any) the payment will be attributed to for tax + * reporting, and where funds from the payment will be transferred to upon + * payment success. + */ + destination: string | Account; + } + } + + interface PaymentIntentCreateParams { + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + 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; + + /** + * The amount of the application fee (if any) that will be applied to the + * payment and transferred to the application owner's Stripe account. For + * more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + application_fee_amount?: number; + + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: PaymentIntentCreateParams.CaptureMethod; + + /** + * Set to `true` to attempt to [confirm](https://stripe.com/docs/api/payment_intents/confirm) this PaymentIntent immediately. This parameter defaults to `false`. When creating and confirming a PaymentIntent at the same time, parameters available in the [confirm](https://stripe.com/docs/api/payment_intents/confirm) API may also be provided. + */ + confirm?: boolean; + + confirmation_method?: PaymentIntentCreateParams.ConfirmationMethod; + + /** + * ID of the Customer this PaymentIntent belongs to, if one exists. + * + * If present, payment methods used with this PaymentIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this PaymentIntent. + */ + customer?: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * ID of the mandate to be used for this payment. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). + */ + mandate?: string; + + /** + * This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). + */ + mandate_data?: PaymentIntentCreateParams.MandateData; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Set to `true` to indicate that the customer is not in your checkout flow during this payment attempt, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and [charge them later](https://stripe.com/docs/payments/cards/charging-saved-cards). This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). + */ + off_session?: boolean | PaymentIntentCreateParams.OffSession; + + /** + * The Stripe account ID for which these funds are intended. For details, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + on_behalf_of?: string; + + /** + * ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) object) to attach to this PaymentIntent. + * + * If neither the `payment_method` parameter nor the `source` parameter are provided with `confirm=true`, `source` will be automatically populated with `customer.default_source` to improve the migration experience for users of the Charges API. We recommend that you explicitly provide the `payment_method` going forward. + */ + payment_method?: string; + + /** + * Payment-method-specific configuration for this PaymentIntent. + */ + payment_method_options?: PaymentIntentCreateParams.PaymentMethodOptions; + + /** + * The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. If this is not provided, defaults to ["card"]. + */ + payment_method_types?: Array; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string; + + /** + * The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). + */ + return_url?: string; + + /** + * If the PaymentIntent has a `payment_method` and a `customer` or if you're attaching a payment method to the PaymentIntent in this request, you can pass `save_payment_method=true` to save the payment method to the customer. Defaults to `false`. + * + * If the payment method is already saved to a customer, this does nothing. If this type of payment method cannot be saved to a customer, the request will error. + * + * _Note that saving a payment method using this parameter does not guarantee that the payment method can be charged._ To ensure that only payment methods which can be charged are saved to a customer, you can [manually save](https://stripe.com/docs/api/customers/create#create_customer-source) the payment method in response to the [`payment_intent.succeeded` webhook](https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded). + */ + save_payment_method?: boolean; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If present, the payment method used with this PaymentIntent can be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer, even after the transaction completes. + * + * For more, learn to [save card details after a payment](https://stripe.com/docs/payments/save-after-payment). + * + * Stripe uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by [SCA](https://stripe.com/docs/strong-customer-authentication), using `off_session` will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect [off-session payments](https://stripe.com/docs/payments/cards/charging-saved-cards#off-session-payments-with-saved-cards) for this customer. + */ + setup_future_usage?: PaymentIntentCreateParams.SetupFutureUsage; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: PaymentIntentCreateParams.Shipping; + + /** + * This is a legacy field that will be removed in the future. It is the ID of the Source object to attach to this PaymentIntent. Please use the `payment_method` field instead, which also supports Cards and [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) objects.If neither the `payment_method` parameter nor the `source` parameter are provided with `confirm=true`, this field will be automatically populated with `customer.default_source` to improve the migration experience for users of the Charges API. We recommend that you explicitly provide the `source` or `payment_method` parameter going forward. + */ + source?: string; + + /** + * For non-card charges, you can use this value as the complete description that appears on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor?: string; + + /** + * Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix?: string; + + /** + * The parameters used to automatically create a Transfer when the payment succeeds. + * For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + transfer_data?: PaymentIntentCreateParams.TransferData; + + /** + * A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + transfer_group?: string; + + /** + * Set to `true` only when using manual confirmation and the iOS or Android SDKs to handle additional authentication steps. + */ + use_stripe_sdk?: boolean; + } + + namespace PaymentIntentCreateParams { + type CaptureMethod = 'automatic' | 'manual'; + + type ConfirmationMethod = 'automatic' | 'manual'; + + interface MandateData { + /** + * This hash contains details about the customer acceptance of the Mandate. + */ + customer_acceptance: MandateData.CustomerAcceptance; + } + + namespace MandateData { + interface CustomerAcceptance { + /** + * The time at which the customer accepted the Mandate. + */ + accepted_at?: number; + + /** + * If this is a Mandate accepted offline, this hash contains details about the offline acceptance. + */ + offline?: CustomerAcceptance.Offline; + + /** + * If this is a Mandate accepted online, this hash contains details about the online acceptance. + */ + online?: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. One of `online` or `offline`. + */ + type: CustomerAcceptance.Type; + } + + namespace CustomerAcceptance { + interface Offline {} + + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address: string; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent: string; + } + + type Type = 'offline' | 'online'; + } + } + + type OffSession = 'one_off' | 'recurring'; + + interface PaymentMethodOptions { + /** + * Configuration for any card payments attempted on this PaymentIntent. + */ + card?: PaymentMethodOptions.Card; + } + + namespace PaymentMethodOptions { + interface Card { + /** + * Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + * + * For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). + */ + installments?: Card.Installments; + + /** + * When specified, this parameter indicates that a transaction will be marked + * as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This + * parameter can only be provided during confirmation. + */ + moto?: boolean; + + /** + * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + */ + request_three_d_secure?: Card.RequestThreeDSecure; + } + + namespace Card { + interface Installments { + /** + * Setting to true enables installments for this PaymentIntent. + * This will cause the response to contain a list of available installment plans. + * Setting to false will prevent any selected plan from applying to a charge. + */ + enabled?: boolean; + + /** + * The selected installment plan to use for this payment attempt. + * This parameter can only be provided during confirmation. + */ + plan?: Installments.Plan | null; + } + + namespace Installments { + interface Plan { + /** + * For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + */ + count: number; + + /** + * For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + * One of `month`. + */ + interval: 'month'; + + /** + * Type of installment plan, one of `fixed_count`. + */ + type: 'fixed_count'; + } + } + + type RequestThreeDSecure = 'any' | 'automatic'; + } + } + + type SetupFutureUsage = 'off_session' | 'on_session'; + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + + interface TransferData { + /** + * The amount that will be transferred automatically when a charge succeeds. + * The amount is capped at the total transaction amount and if no amount is set, + * the full amount is transferred. + * + * If you intend to collect a fee and you need a more robust reporting experience, using + * [application_fee_amount](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-application_fee_amount) + * might be a better fit for your integration. + */ + amount?: number; + + /** + * If specified, successful charges will be attributed to the destination + * account for tax reporting, and the funds from charges will be transferred + * to the destination account. The ID of the resulting transfer will be + * returned on the successful charge's `transfer` field. + */ + destination: string; + } + } + + interface PaymentIntentRetrieveParams { + /** + * The client secret of the PaymentIntent. Required if a publishable key is used to retrieve the source. + */ + client_secret?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PaymentIntentUpdateParams { + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount?: number; + + /** + * The amount of the application fee (if any) for the resulting payment. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + application_fee_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; + + /** + * ID of the Customer this PaymentIntent belongs to, if one exists. + * + * If present, payment methods used with this PaymentIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this PaymentIntent. + */ + customer?: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) object) to attach to this PaymentIntent. + */ + payment_method?: string; + + /** + * The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. + */ + payment_method_types?: Array; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string | ''; + + /** + * If the PaymentIntent has a `payment_method` and a `customer` or if you're attaching a payment method to the PaymentIntent in this request, you can pass `save_payment_method=true` to save the payment method to the customer. Defaults to `false`. + * + * If the payment method is already saved to a customer, this does nothing. If this type of payment method cannot be saved to a customer, the request will error. + * + * _Note that saving a payment method using this parameter does not guarantee that the payment method can be charged._ To ensure that only payment methods which can be charged are saved to a customer, you can [manually save](https://stripe.com/docs/api/customers/create#create_customer-source) the payment method in response to the [`payment_intent.succeeded` webhook](https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded). + */ + save_payment_method?: boolean; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If present, the payment method used with this PaymentIntent can be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer, even after the transaction completes. + * + * Use `on_session` if you intend to only reuse the payment method when your customer is present in your checkout flow. Use `off_session` if your customer may or may not be in your checkout flow. + * + * Stripe uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by [SCA](https://stripe.com/docs/strong-customer-authentication), using `off_session` will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect [off-session payments](https://stripe.com/docs/payments/cards/charging-saved-cards#off-session-payments-with-saved-cards) for this customer. + * + * If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. + */ + setup_future_usage?: PaymentIntentUpdateParams.SetupFutureUsage | null; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: PaymentIntentUpdateParams.Shipping | null; + + /** + * This is a legacy field that will be removed in the future. It is the ID of the Source object to attach to this PaymentIntent. Please use the `payment_method` field instead, which also supports Cards and [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) objects. + */ + source?: string; + + /** + * For non-card charges, you can use this value as the complete description that appears on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor?: string; + + /** + * Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix?: string; + + /** + * The parameters used to automatically create a Transfer when the payment succeeds. For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + transfer_data?: PaymentIntentUpdateParams.TransferData; + + /** + * A string that identifies the resulting payment as part of a group. `transfer_group` may only be provided if it has not been set. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. + */ + transfer_group?: string; + } + + namespace PaymentIntentUpdateParams { + type SetupFutureUsage = 'off_session' | 'on_session'; + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + + interface TransferData { + /** + * The amount that will be transferred automatically when a charge succeeds. + */ + amount?: number; + } + } + + interface PaymentIntentListParams extends PaginationParams { + /** + * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + */ + created?: RangeQueryParam | number; + + /** + * Only return PaymentIntents for the customer specified by this customer ID. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PaymentIntentCancelParams { + /** + * Reason for canceling this PaymentIntent. Possible values are `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned` + */ + cancellation_reason?: PaymentIntentCancelParams.CancellationReason; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace PaymentIntentCancelParams { + type CancellationReason = + | 'abandoned' + | 'duplicate' + | 'fraudulent' + | 'requested_by_customer'; + } + + interface PaymentIntentCaptureParams { + /** + * The amount to capture from the PaymentIntent, which must be less than or equal to the original amount. Any additional amount will be automatically refunded. Defaults to the full `amount_capturable` if not provided. + */ + amount_to_capture?: number; + + /** + * The amount of the application fee (if any) that will be applied to the + * payment and transferred to the application owner's Stripe account. For + * more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + application_fee_amount?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * For non-card charges, you can use this value as the complete description that appears on your customers' statements. Must contain at least one letter, maximum 22 characters. + */ + statement_descriptor?: string; + + /** + * Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + */ + statement_descriptor_suffix?: string; + + /** + * The parameters used to automatically create a Transfer when the payment + * is captured. For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + */ + transfer_data?: PaymentIntentCaptureParams.TransferData; + } + + namespace PaymentIntentCaptureParams { + interface TransferData { + /** + * The amount that will be transferred automatically when a charge succeeds. + */ + amount?: number; + } + } + + interface PaymentIntentConfirmParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * ID of the mandate to be used for this payment. + */ + mandate?: string; + + /** + * This hash contains details about the Mandate to create + */ + mandate_data?: + | PaymentIntentConfirmParams.MandateData1 + | PaymentIntentConfirmParams.MandateData2; + + /** + * Set to `true` to indicate that the customer is not in your checkout flow during this payment attempt, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and [charge them later](https://stripe.com/docs/payments/cards/charging-saved-cards). + */ + off_session?: boolean | PaymentIntentConfirmParams.OffSession; + + /** + * ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) object) to attach to this PaymentIntent. + */ + payment_method?: string; + + /** + * Payment-method-specific configuration for this PaymentIntent. + */ + payment_method_options?: PaymentIntentConfirmParams.PaymentMethodOptions; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string | ''; + + /** + * The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. + * If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. + * This parameter is only used for cards and other redirect-based payment methods. + */ + return_url?: string; + + /** + * If the PaymentIntent has a `payment_method` and a `customer` or if you're attaching a payment method to the PaymentIntent in this request, you can pass `save_payment_method=true` to save the payment method to the customer. Defaults to `false`. + * + * If the payment method is already saved to a customer, this does nothing. If this type of payment method cannot be saved to a customer, the request will error. + * + * _Note that saving a payment method using this parameter does not guarantee that the payment method can be charged._ To ensure that only payment methods which can be charged are saved to a customer, you can [manually save](https://stripe.com/docs/api/customers/create#create_customer-source) the payment method in response to the [`payment_intent.succeeded` webhook](https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded). + */ + save_payment_method?: boolean; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If present, the payment method used with this PaymentIntent can be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer, even after the transaction completes. + * + * Use `on_session` if you intend to only reuse the payment method when your customer is present in your checkout flow. Use `off_session` if your customer may or may not be in your checkout flow. + * + * Stripe uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by [SCA](https://stripe.com/docs/strong-customer-authentication), using `off_session` will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect [off-session payments](https://stripe.com/docs/payments/cards/charging-saved-cards#off-session-payments-with-saved-cards) for this customer. + * + * If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. + */ + setup_future_usage?: PaymentIntentConfirmParams.SetupFutureUsage | null; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: PaymentIntentConfirmParams.Shipping | null; + + /** + * This is a legacy field that will be removed in the future. It is the ID of the Source object to attach to this PaymentIntent. Please use the `payment_method` field instead, which also supports Cards and [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) objects. + */ + source?: string; + + /** + * Set to `true` only when using manual confirmation and the iOS or Android SDKs to handle additional authentication steps. + */ + use_stripe_sdk?: boolean; + } + + namespace PaymentIntentConfirmParams { + interface MandateData1 { + /** + * This hash contains details about the customer acceptance of the Mandate. + */ + customer_acceptance: MandateData1.CustomerAcceptance; + } + + namespace MandateData1 { + interface CustomerAcceptance { + /** + * The time at which the customer accepted the Mandate. + */ + accepted_at?: number; + + /** + * If this is a Mandate accepted offline, this hash contains details about the offline acceptance. + */ + offline?: CustomerAcceptance.Offline; + + /** + * If this is a Mandate accepted online, this hash contains details about the online acceptance. + */ + online?: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. One of `online` or `offline`. + */ + type: CustomerAcceptance.Type; + } + + namespace CustomerAcceptance { + interface Offline {} + + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address: string; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent: string; + } + + type Type = 'offline' | 'online'; + } + } + interface MandateData2 { + /** + * This hash contains details about the customer acceptance of the Mandate. + */ + customer_acceptance: MandateData2.CustomerAcceptance; + } + + namespace MandateData2 { + interface CustomerAcceptance { + /** + * If this is a Mandate accepted online, this hash contains details about the online acceptance. + */ + online: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. + */ + type: 'online'; + } + + namespace CustomerAcceptance { + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address?: string; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent?: string; + } + } + } + + type OffSession = 'one_off' | 'recurring'; + + interface PaymentMethodOptions { + /** + * Configuration for any card payments attempted on this PaymentIntent. + */ + card?: PaymentMethodOptions.Card; + } + + namespace PaymentMethodOptions { + interface Card { + /** + * Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + * + * For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). + */ + installments?: Card.Installments; + + /** + * When specified, this parameter indicates that a transaction will be marked + * as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This + * parameter can only be provided during confirmation. + */ + moto?: boolean; + + /** + * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + */ + request_three_d_secure?: Card.RequestThreeDSecure; + } + + namespace Card { + interface Installments { + /** + * Setting to true enables installments for this PaymentIntent. + * This will cause the response to contain a list of available installment plans. + * Setting to false will prevent any selected plan from applying to a charge. + */ + enabled?: boolean; + + /** + * The selected installment plan to use for this payment attempt. + * This parameter can only be provided during confirmation. + */ + plan?: Installments.Plan | null; + } + + namespace Installments { + interface Plan { + /** + * For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card. + */ + count: number; + + /** + * For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card. + * One of `month`. + */ + interval: 'month'; + + /** + * Type of installment plan, one of `fixed_count`. + */ + type: 'fixed_count'; + } + } + + type RequestThreeDSecure = 'any' | 'automatic'; + } + } + + type SetupFutureUsage = 'off_session' | 'on_session'; + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + } + + class PaymentIntentsResource { + /** + * Creates a PaymentIntent object. + * + * After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm) + * to continue the payment. You can read more about the different payment flows + * available via the Payment Intents API [here](https://stripe.com/docs/payments/payment-intents). + * + * When confirm=true is used during creation, it is equivalent to creating + * and confirming the PaymentIntent in the same call. You may use any parameters + * available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when confirm=true + * is supplied. + */ + create( + params: PaymentIntentCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of a PaymentIntent that has previously been created. + * + * Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string. + * + * When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the [payment intent](https://stripe.com/docs/api#payment_intent_object) object reference for more details. + */ + retrieve( + id: string, + params?: PaymentIntentRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates properties on a PaymentIntent object without confirming. + * + * Depending on which properties you update, you may need to confirm the + * PaymentIntent again. For example, updating the payment_method will + * always require you to confirm the PaymentIntent again. If you prefer to + * update and confirm at the same time, we recommend updating properties via + * the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead. + */ + update( + id: string, + params?: PaymentIntentUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of PaymentIntents. + */ + list( + params?: PaymentIntentListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * A PaymentIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, 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. + */ + cancel( + id: string, + params?: PaymentIntentCancelParams, + options?: RequestOptions + ): Promise; + cancel(id: string, options?: RequestOptions): Promise; + + /** + * 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. + * + * Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later). + */ + capture( + id: string, + params?: PaymentIntentCaptureParams, + options?: RequestOptions + ): Promise; + capture(id: string, options?: RequestOptions): Promise; + + /** + * Confirm that your customer intends to pay with current or provided + * payment method. Upon confirmation, the PaymentIntent will attempt to initiate + * a payment. + * + * If the selected payment method requires additional authentication steps, the + * PaymentIntent will transition to the requires_action status and + * suggest additional actions via next_action. If payment fails, + * the PaymentIntent will transition to the requires_payment_method status. If + * payment succeeds, the PaymentIntent will transition to the succeeded + * status (or requires_capture, if capture_method is set to manual). + * + * If the confirmation_method is automatic, payment may be attempted + * using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) + * and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret). + * After next_actions are handled by the client, no additional + * confirmation is required to complete the payment. + * + * If the confirmation_method is manual, all payment attempts must be + * initiated using a secret key. + * If any actions are required for the payment, the PaymentIntent will + * return to the requires_confirmation state + * after those actions are completed. Your server needs to then + * explicitly re-confirm the PaymentIntent to initiate the next payment + * attempt. Read the [expanded documentation](https://stripe.com/docs/payments/payment-intents/web-manual) + * to learn more about manual confirmation. + */ + confirm( + id: string, + params?: PaymentIntentConfirmParams, + options?: RequestOptions + ): Promise; + confirm(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/PaymentMethods.d.ts b/types/2019-12-03/PaymentMethods.d.ts new file mode 100644 index 0000000000..fac23e3424 --- /dev/null +++ b/types/2019-12-03/PaymentMethods.d.ts @@ -0,0 +1,684 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The PaymentMethod object. + */ + interface PaymentMethod { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'payment_method'; + + au_becs_debit?: PaymentMethod.AuBecsDebit; + + billing_details: PaymentMethod.BillingDetails; + + card?: PaymentMethod.Card; + + card_present?: PaymentMethod.CardPresent; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. + */ + customer: string | Customer | null; + + ideal?: PaymentMethod.Ideal; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + sepa_debit?: PaymentMethod.SepaDebit; + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. + */ + type: PaymentMethod.Type; + } + + namespace PaymentMethod { + interface AuBecsDebit { + bsb_number: string | null; + + fingerprint: string | null; + + last4: string | null; + } + + interface BillingDetails { + /** + * Billing address. + */ + address: Address | null; + + /** + * Email address. + */ + email: string | null; + + /** + * Full name. + */ + name: string | null; + + /** + * Billing phone number (including extension). + */ + phone: string | null; + } + + interface Card { + /** + * Card brand. Can be `amex`, `diners`, `discover`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + brand: string; + + /** + * Checks on Card address and CVC if provided. + */ + checks: Card.Checks | null; + + /** + * Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + */ + country: string | null; + + /** + * Card description. (Only for internal use only and not typically available in standard API requests.) + */ + description?: string | null; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number; + + /** + * Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. + */ + fingerprint?: string | null; + + /** + * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + */ + funding: string; + + /** + * Issuer identification number of the card. (Only for internal use only and not typically available in standard API requests.) + */ + iin?: string | null; + + /** + * Issuer bank name of the card. (Only for internal use only and not typically available in standard API requests.) + */ + issuer?: string | null; + + /** + * The last four digits of the card. + */ + last4: string; + + /** + * Contains details on how this Card maybe be used for 3D Secure authentication. + */ + three_d_secure_usage: Card.ThreeDSecureUsage | null; + + /** + * If this Card is part of a card wallet, this contains the details of the card wallet. + */ + wallet: Card.Wallet | null; + } + + namespace Card { + interface Checks { + /** + * If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + */ + address_line1_check: string | null; + + /** + * If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + */ + address_postal_code_check: string | null; + + /** + * If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + */ + cvc_check: string | null; + } + + interface ThreeDSecureUsage { + /** + * Whether 3D Secure is supported on this card. + */ + supported: boolean; + } + + interface Wallet { + amex_express_checkout?: Wallet.AmexExpressCheckout; + + apple_pay?: Wallet.ApplePay; + + /** + * (For tokenized numbers only.) The last four digits of the device account number. + */ + dynamic_last4: string | null; + + google_pay?: Wallet.GooglePay; + + masterpass?: Wallet.Masterpass; + + samsung_pay?: Wallet.SamsungPay; + + /** + * The type of the card wallet, one of `amex_express_checkout`, `apple_pay`, `google_pay`, `masterpass`, `samsung_pay`, or `visa_checkout`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type. + */ + type: Wallet.Type; + + visa_checkout?: Wallet.VisaCheckout; + } + + namespace Wallet { + interface AmexExpressCheckout {} + + interface ApplePay {} + + interface GooglePay {} + + interface Masterpass { + /** + * Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + billing_address: Address | null; + + /** + * Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + email: string | null; + + /** + * Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + name: string | null; + + /** + * Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + shipping_address: Address | null; + } + + interface SamsungPay {} + + type Type = + | 'amex_express_checkout' + | 'apple_pay' + | 'google_pay' + | 'masterpass' + | 'samsung_pay' + | 'visa_checkout'; + + interface VisaCheckout { + /** + * Owner's verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + billing_address: Address | null; + + /** + * Owner's verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + email: string | null; + + /** + * Owner's verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + name: string | null; + + /** + * Owner's verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + shipping_address: Address | null; + } + } + } + + interface CardPresent {} + + interface Ideal { + /** + * The customer's bank, if provided. Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `rabobank`, `regiobank`, `sns_bank`, `triodos_bank`, or `van_lanschot`. + */ + bank: Ideal.Bank | null; + + /** + * The Bank Identifier Code of the customer's bank, if the bank was provided. + */ + bic: Ideal.Bic | null; + } + + namespace Ideal { + type Bank = + | 'abn_amro' + | 'asn_bank' + | 'bunq' + | 'handelsbanken' + | 'ing' + | 'knab' + | 'moneyou' + | 'rabobank' + | 'regiobank' + | 'sns_bank' + | 'triodos_bank' + | 'van_lanschot'; + + type Bic = + | 'ABNANL2A' + | 'ASNBNL21' + | 'BUNQNL2A' + | 'FVLBNL22' + | 'HANDNL2A' + | 'INGBNL2A' + | 'KNABNL2H' + | 'MOYONL21' + | 'RABONL2U' + | 'RBRBNL21' + | 'SNSBNL2A' + | 'TRIONL2U'; + } + + interface SepaDebit { + /** + * Bank code of bank associated with the bank account. + */ + bank_code: string | null; + + /** + * Branch code of bank associated with the bank account. + */ + branch_code: string | null; + + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string | null; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string | null; + + /** + * Last four characters of the IBAN. + */ + last4: string | null; + } + + type Type = + | 'au_becs_debit' + | 'card' + | 'card_present' + | 'ideal' + | 'sepa_debit'; + } + + interface PaymentMethodCreateParams { + /** + * If this is a `au_becs_debit` PaymentMethod, this hash contains details about the bank account. + */ + au_becs_debit?: PaymentMethodCreateParams.AuBecsDebit; + + /** + * Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. + */ + billing_details?: PaymentMethodCreateParams.BillingDetails; + + /** + * If this is a `card` PaymentMethod, this hash contains the user's card details. For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`. When creating with a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance). We strongly recommend using Stripe.js instead of interacting with this API directly. + */ + card?: PaymentMethodCreateParams.Card1 | PaymentMethodCreateParams.Card2; + + /** + * The `Customer` to whom the original PaymentMethod is attached. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method. + */ + ideal?: PaymentMethodCreateParams.Ideal; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * The PaymentMethod to share. + */ + payment_method?: string; + + /** + * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. + */ + sepa_debit?: PaymentMethodCreateParams.SepaDebit; + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. Required unless `payment_method` is specified (see the [Cloning PaymentMethods](https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods) guide) + */ + type?: PaymentMethodCreateParams.Type; + } + + namespace PaymentMethodCreateParams { + interface AuBecsDebit { + account_number: string; + + bsb_number: string; + } + + interface BillingDetails { + /** + * Billing address. + */ + address?: BillingDetails.Address; + + /** + * Email address. + */ + email?: string; + + /** + * Full name. + */ + name?: string; + + /** + * Billing phone number (including extension). + */ + phone?: string; + } + + namespace BillingDetails { + interface Address { + city?: string; + + country?: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + + interface Card1 { + /** + * The card's CVC. It is highly recommended to always include this value. + */ + cvc?: string; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number; + + /** + * The card number, as a string without any separators. + */ + number: string; + } + interface Card2 { + token: string; + } + + interface Ideal { + /** + * The customer's bank. + */ + bank?: Ideal.Bank; + } + + namespace Ideal { + type Bank = + | 'abn_amro' + | 'asn_bank' + | 'bunq' + | 'handelsbanken' + | 'ing' + | 'knab' + | 'moneyou' + | 'rabobank' + | 'regiobank' + | 'sns_bank' + | 'triodos_bank' + | 'van_lanschot'; + } + + interface SepaDebit { + iban: string; + } + + type Type = + | 'au_becs_debit' + | 'card' + | 'card_present' + | 'ideal' + | 'sepa_debit'; + } + + interface PaymentMethodRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PaymentMethodUpdateParams { + /** + * Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. + */ + billing_details?: PaymentMethodUpdateParams.BillingDetails; + + card?: PaymentMethodUpdateParams.Card; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + sepa_debit?: PaymentMethodUpdateParams.SepaDebit; + } + + namespace PaymentMethodUpdateParams { + interface BillingDetails { + /** + * Billing address. + */ + address?: BillingDetails.Address; + + /** + * Email address. + */ + email?: string; + + /** + * Full name. + */ + name?: string; + + /** + * Billing phone number (including extension). + */ + phone?: string; + } + + namespace BillingDetails { + interface Address { + city?: string; + + country?: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + + interface Card { + /** + * Two-digit number representing the card's expiration month. + */ + exp_month?: number; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year?: number; + } + + interface SepaDebit {} + } + + interface PaymentMethodListParams extends PaginationParams { + /** + * The ID of the customer whose PaymentMethods will be retrieved. + */ + customer: string; + + /** + * A required filter on the list, based on the object `type` field. + */ + type: PaymentMethodListParams.Type; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace PaymentMethodListParams { + type Type = 'card' | 'card_present' | 'ideal' | 'sepa_debit'; + } + + interface PaymentMethodAttachParams { + /** + * The ID of the customer to which to attach the PaymentMethod. + */ + customer: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PaymentMethodDetachParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class PaymentMethodsResource { + /** + * Creates a PaymentMethod object. Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js. + */ + create( + params?: PaymentMethodCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves a PaymentMethod object. + */ + retrieve( + id: string, + params?: PaymentMethodRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. + */ + update( + id: string, + params?: PaymentMethodUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of PaymentMethods for a given Customer + */ + list( + params: PaymentMethodListParams, + options?: RequestOptions + ): ApiListPromise; + + /** + * Attaches a PaymentMethod object to a Customer. + * + * To use this PaymentMethod as the default for invoice or subscription payments, + * set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method), + * on the Customer to the PaymentMethod's ID. + */ + attach( + id: string, + params: PaymentMethodAttachParams, + options?: RequestOptions + ): Promise; + + /** + * Detaches a PaymentMethod object from a Customer. + */ + detach( + id: string, + params?: PaymentMethodDetachParams, + options?: RequestOptions + ): Promise; + detach(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Payouts.d.ts b/types/2019-12-03/Payouts.d.ts new file mode 100644 index 0000000000..32b35027cd --- /dev/null +++ b/types/2019-12-03/Payouts.d.ts @@ -0,0 +1,270 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Payout object. + */ + interface Payout { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'payout'; + + /** + * Amount (in %s) to be transferred to your bank account or debit card. + */ + amount: number; + + /** + * Date the payout is expected to arrive in the bank. This factors in delays like weekends or bank holidays. + */ + arrival_date: number; + + /** + * Returns `true` if the payout was created by an [automated payout schedule](https://stripe.com/docs/payouts#payout-schedule), and `false` if it was [requested manually](https://stripe.com/docs/payouts#manual-payouts). + */ + automatic: boolean; + + /** + * ID of the balance transaction that describes the impact of this payout on your account balance. + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * ID of the bank account or card the payout was sent to. + */ + destination: + | string + | BankAccount + | Card + | DeletedBankAccount + | DeletedCard + | null; + + /** + * If the payout failed or was canceled, this will be the ID of the balance transaction that reversed the initial balance transaction, and puts the funds from the failed payout back in your balance. + */ + failure_balance_transaction: string | BalanceTransaction | null; + + /** + * Error code explaining reason for payout failure if available. See [Types of payout failures](https://stripe.com/docs/api#payout_failures) for a list of failure codes. + */ + failure_code: string | null; + + /** + * Message to user further explaining reason for payout failure if available. + */ + failure_message: string | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The method used to send this payout, which can be `standard` or `instant`. `instant` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces](/blog/instant-payouts-for-marketplaces) for more information.) + */ + method: string; + + /** + * The source balance this payout came from. One of `card` or `bank_account`. + */ + source_type: string; + + /** + * Extra information about a payout to be displayed on the user's bank statement. + */ + statement_descriptor: string | null; + + /** + * Current status of the payout (`paid`, `pending`, `in_transit`, `canceled` or `failed`). A payout will be `pending` until it is submitted to the bank, at which point it becomes `in_transit`. It will then change to `paid` if the transaction goes through. If it does not go through successfully, its status will change to `failed` or `canceled`. + */ + status: string; + + /** + * Can be `bank_account` or `card`. + */ + type: Payout.Type; + } + + namespace Payout { + type Type = 'bank_account' | 'card'; + } + + interface PayoutCreateParams { + /** + * A positive integer in cents representing how much to payout. + */ + 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * The ID of a bank account or a card to send the payout to. If no destination is supplied, the default external account for the specified currency will be used. + */ + destination?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to a payout object. It can be useful for storing additional information about the payout in a structured format. + */ + metadata?: MetadataParam; + + /** + * The method used to send this payout, which can be `standard` or `instant`. `instant` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces for more information](https://stripe.com/blog/instant-payouts-for-marketplaces).) + */ + method?: PayoutCreateParams.Method; + + /** + * The balance type of your Stripe balance to draw this payout from. Balances for different payment sources are kept separately. You can find the amounts with the balances API. One of `bank_account` or `card`. + */ + source_type?: PayoutCreateParams.SourceType; + + /** + * A string to be displayed on the recipient's bank or card statement. This may be at most 22 characters. Attempting to use a `statement_descriptor` longer than 22 characters will return an error. Note: Most banks will truncate this information and/or display it inconsistently. Some may not display it at all. + */ + statement_descriptor?: string; + } + + namespace PayoutCreateParams { + type Method = 'instant' | 'standard'; + + type SourceType = 'bank_account' | 'card'; + } + + interface PayoutRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PayoutUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A set of key-value pairs that you can attach to a payout object. It can be useful for storing additional information about the payout in a structured format. + */ + metadata?: MetadataParam; + } + + interface PayoutListParams extends PaginationParams { + arrival_date?: RangeQueryParam | number; + + created?: RangeQueryParam | number; + + /** + * The ID of an external account - only return payouts sent to this external account. + */ + destination?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return payouts that have the given status: `pending`, `paid`, `failed`, or `canceled`. + */ + status?: string; + } + + interface PayoutCancelParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class PayoutsResource { + /** + * To send funds to your own bank account, you create a new payout object. Your [Stripe balance](https://stripe.com/docs/api#balance) must be able to cover the payout amount, or you'll receive an “Insufficient Funds” error. + * + * If your API key is in test mode, money won't actually be sent, though everything else will occur as if in live mode. + * + * If you are creating a manual payout on a Stripe account that uses multiple payment source types, you'll need to specify the source type balance that the payout should draw from. The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type. + */ + create( + params: PayoutCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout creation request or the payout list, and Stripe will return the corresponding payout information. + */ + retrieve( + id: string, + params?: PayoutRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified payout by setting the values of the parameters passed. Any parameters not provided will be left unchanged. This request accepts only the metadata as arguments. + */ + update( + id: string, + params?: PayoutUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent you. The payouts are returned in sorted order, with the most recently created payouts appearing first. + */ + list( + params?: PayoutListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * A previously created payout can be canceled if it has not yet been paid out. Funds will be refunded to your available balance. You may not cancel automatic Stripe payouts. + */ + cancel( + id: string, + params?: PayoutCancelParams, + options?: RequestOptions + ): Promise; + cancel(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Persons.d.ts b/types/2019-12-03/Persons.d.ts new file mode 100644 index 0000000000..734d1e9954 --- /dev/null +++ b/types/2019-12-03/Persons.d.ts @@ -0,0 +1,856 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Person object. + */ + interface Person { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'person'; + + /** + * The account the person is associated with. + */ + account: string; + + address?: Address; + + /** + * The Kana variation of the person's address (Japan only). + */ + address_kana?: Person.AddressKana | null; + + /** + * The Kanji variation of the person's address (Japan only). + */ + address_kanji?: Person.AddressKanji | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + deleted?: void; + + dob?: Person.Dob; + + /** + * The person's email address. + */ + email?: string | null; + + /** + * The person's first name. + */ + first_name?: string | null; + + /** + * The Kana variation of the person's first name (Japan only). + */ + first_name_kana?: string | null; + + /** + * The Kanji variation of the person's first name (Japan only). + */ + first_name_kanji?: string | null; + + /** + * The person's gender (International regulations require either "male" or "female"). + */ + gender?: string | null; + + /** + * Whether the person's `id_number` was provided. + */ + id_number_provided?: boolean; + + /** + * The person's last name. + */ + last_name?: string | null; + + /** + * The Kana variation of the person's last name (Japan only). + */ + last_name_kana?: string | null; + + /** + * The Kanji variation of the person's last name (Japan only). + */ + last_name_kanji?: string | null; + + /** + * The person's maiden name. + */ + maiden_name?: string | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: Metadata; + + /** + * The person's phone number. + */ + phone?: string | null; + + relationship?: Person.Relationship; + + /** + * Information about the requirements for this person, including what information needs to be collected, and by when. + */ + requirements?: Person.Requirements | null; + + /** + * Whether the last 4 digits of this person's SSN have been provided. + */ + ssn_last_4_provided?: boolean; + + verification?: Person.Verification; + } + + namespace Person { + interface AddressKana { + /** + * City/Ward. + */ + city: string | null; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string | null; + + /** + * Block/Building number. + */ + line1: string | null; + + /** + * Building details. + */ + line2: string | null; + + /** + * Zip/Postal Code. + */ + postal_code: string | null; + + /** + * Prefecture. + */ + state: string | null; + + /** + * Town/cho-me. + */ + town: string | null; + } + + interface AddressKanji { + /** + * City/Ward. + */ + city: string | null; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string | null; + + /** + * Block/Building number. + */ + line1: string | null; + + /** + * Building details. + */ + line2: string | null; + + /** + * Zip/Postal Code. + */ + postal_code: string | null; + + /** + * Prefecture. + */ + state: string | null; + + /** + * Town/cho-me. + */ + town: string | null; + } + + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number | null; + + /** + * The month of birth, between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year of birth. + */ + year: number | null; + } + + interface Relationship { + /** + * Whether the person is a director of the account's legal entity. Currently only required for accounts in the EU. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. + */ + director: boolean | null; + + /** + * Whether the person has significant responsibility to control, manage, or direct the organization. + */ + executive: boolean | null; + + /** + * Whether the person is an owner of the account's legal entity. + */ + owner: boolean | null; + + /** + * The percent owned by the person of the account's legal entity. + */ + percent_ownership: number | null; + + /** + * Whether the person is authorized as the primary representative of the account. This is the person nominated by the business to provide information about themselves, and general information about the account. There can only be one representative at any given time. At the time the account is created, this person should be set to the person responsible for opening the account. + */ + representative: boolean | null; + + /** + * The person's title (e.g., CEO, Support Engineer). + */ + title: string | null; + } + + interface Requirements { + /** + * Fields that need to be collected to keep the person's account enabled. If not collected by the account's `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + */ + currently_due: Array; + + /** + * Fields that need to be collected assuming all volume thresholds are reached. As fields are needed, they are moved to `currently_due` and the account's `current_deadline` is set. + */ + eventually_due: Array; + + /** + * Fields that weren't collected by the account's `current_deadline`. These fields need to be collected to enable payouts for the person's account. + */ + past_due: Array; + + /** + * Fields that may become required depending on the results of verification or review. An empty array unless an asynchronous verification is pending. If verification fails, the fields in this array become required and move to `currently_due` or `past_due`. + */ + pending_verification: Array; + } + + interface Verification { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: Verification.AdditionalDocument | null; + + /** + * A user-displayable string describing the verification state for the person. For example, this may say "Provided identity information could not be verified". + */ + details?: string | null; + + /** + * One of `document_address_mismatch`, `document_dob_mismatch`, `document_duplicate_type`, `document_id_number_mismatch`, `document_name_mismatch`, `document_nationality_mismatch`, `failed_keyed_identity`, or `failed_other`. A machine-readable code specifying the verification state for the person. + */ + details_code?: string | null; + + document?: Verification.Document; + + /** + * The state of verification for the person. Possible values are `unverified`, `pending`, or `verified`. + */ + status: string; + } + + namespace Verification { + interface AdditionalDocument { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + back: string | File | null; + + /** + * A user-displayable string describing the verification state of this document. For example, if a document is uploaded and the picture is too fuzzy, this may say "Identity document is too unclear to read". + */ + details: string | null; + + /** + * One of `document_corrupt`, `document_country_not_supported`, `document_expired`, `document_failed_copy`, `document_failed_other`, `document_failed_test_mode`, `document_fraudulent`, `document_failed_greyscale`, `document_incomplete`, `document_invalid`, `document_manipulated`, `document_missing_back`, `document_missing_front`, `document_not_readable`, `document_not_uploaded`, `document_photo_mismatch`, `document_too_large`, or `document_type_not_supported`. A machine-readable code specifying the verification state for this document. + */ + details_code: string | null; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + front: string | File | null; + } + + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + back: string | File | null; + + /** + * A user-displayable string describing the verification state of this document. For example, if a document is uploaded and the picture is too fuzzy, this may say "Identity document is too unclear to read". + */ + details: string | null; + + /** + * One of `document_corrupt`, `document_country_not_supported`, `document_expired`, `document_failed_copy`, `document_failed_other`, `document_failed_test_mode`, `document_fraudulent`, `document_failed_greyscale`, `document_incomplete`, `document_invalid`, `document_manipulated`, `document_missing_back`, `document_missing_front`, `document_not_readable`, `document_not_uploaded`, `document_photo_mismatch`, `document_too_large`, or `document_type_not_supported`. A machine-readable code specifying the verification state for this document. + */ + details_code: string | null; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. + */ + front: string | File | null; + } + } + } + + /** + * The DeletedPerson object. + */ + interface DeletedPerson { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'person'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface PersonCreateParams { + /** + * The person's address. + */ + address?: PersonCreateParams.Address; + + /** + * The Kana variation of the person's address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the person's address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * The person's date of birth. + */ + dob?: PersonCreateParams.Dob | null; + + /** + * The person's email address. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The person's first name. + */ + first_name?: string; + + /** + * The Kana variation of the person's first name (Japan only). + */ + first_name_kana?: string; + + /** + * The Kanji variation of the person's first name (Japan only). + */ + first_name_kanji?: string; + + /** + * The person's gender (International regulations require either "male" or "female"). + */ + gender?: string; + + /** + * The person's ID number, as appropriate for their country. For example, a social security number in the U.S., social insurance number in Canada, etc. Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://stripe.com/docs/stripe.js#collecting-pii-data). + */ + id_number?: string; + + /** + * The person's last name. + */ + last_name?: string; + + /** + * The Kana variation of the person's last name (Japan only). + */ + last_name_kana?: string; + + /** + * The Kanji variation of the person's last name (Japan only). + */ + last_name_kanji?: string; + + /** + * The person's maiden name. + */ + maiden_name?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * A [person token](https://stripe.com/docs/connect/account-tokens), used to securely provide details to the person. + */ + person_token?: string; + + /** + * The person's phone number. + */ + phone?: string; + + /** + * The relationship that this person has with the account's legal entity. + */ + relationship?: PersonCreateParams.Relationship; + + /** + * The last 4 digits of the person's social security number. + */ + ssn_last_4?: string; + + /** + * The person's verification status. + */ + verification?: PersonCreateParams.Verification; + } + + namespace PersonCreateParams { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Relationship { + /** + * Whether the person is a director of the account's legal entity. Currently only required for accounts in the EU. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. + */ + director?: boolean; + + /** + * Whether the person has significant responsibility to control, manage, or direct the organization. + */ + executive?: boolean; + + /** + * Whether the person is an owner of the account's legal entity. + */ + owner?: boolean; + + /** + * The percent owned by the person of the account's legal entity. + */ + percent_ownership?: number | ''; + + /** + * Whether the person is authorized as the primary representative of the account. This is the person nominated by the business to provide information about themselves, and general information about the account. There can only be one representative at any given time. At the time the account is created, this person should be set to the person responsible for opening the account. + */ + representative?: boolean; + + /** + * The person's title (e.g., CEO, Support Engineer). + */ + title?: string; + } + + interface Verification { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: Verification.AdditionalDocument; + + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface AdditionalDocument { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + interface PersonRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PersonUpdateParams { + /** + * The person's address. + */ + address?: PersonUpdateParams.Address; + + /** + * The Kana variation of the person's address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the person's address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * The person's date of birth. + */ + dob?: PersonUpdateParams.Dob | null; + + /** + * The person's email address. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The person's first name. + */ + first_name?: string; + + /** + * The Kana variation of the person's first name (Japan only). + */ + first_name_kana?: string; + + /** + * The Kanji variation of the person's first name (Japan only). + */ + first_name_kanji?: string; + + /** + * The person's gender (International regulations require either "male" or "female"). + */ + gender?: string; + + /** + * The person's ID number, as appropriate for their country. For example, a social security number in the U.S., social insurance number in Canada, etc. Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://stripe.com/docs/stripe.js#collecting-pii-data). + */ + id_number?: string; + + /** + * The person's last name. + */ + last_name?: string; + + /** + * The Kana variation of the person's last name (Japan only). + */ + last_name_kana?: string; + + /** + * The Kanji variation of the person's last name (Japan only). + */ + last_name_kanji?: string; + + /** + * The person's maiden name. + */ + maiden_name?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * A [person token](https://stripe.com/docs/connect/account-tokens), used to securely provide details to the person. + */ + person_token?: string; + + /** + * The person's phone number. + */ + phone?: string; + + /** + * The relationship that this person has with the account's legal entity. + */ + relationship?: PersonUpdateParams.Relationship; + + /** + * The last 4 digits of the person's social security number. + */ + ssn_last_4?: string; + + /** + * The person's verification status. + */ + verification?: PersonUpdateParams.Verification; + } + + namespace PersonUpdateParams { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Relationship { + /** + * Whether the person is a director of the account's legal entity. Currently only required for accounts in the EU. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. + */ + director?: boolean; + + /** + * Whether the person has significant responsibility to control, manage, or direct the organization. + */ + executive?: boolean; + + /** + * Whether the person is an owner of the account's legal entity. + */ + owner?: boolean; + + /** + * The percent owned by the person of the account's legal entity. + */ + percent_ownership?: number | ''; + + /** + * Whether the person is authorized as the primary representative of the account. This is the person nominated by the business to provide information about themselves, and general information about the account. There can only be one representative at any given time. At the time the account is created, this person should be set to the person responsible for opening the account. + */ + representative?: boolean; + + /** + * The person's title (e.g., CEO, Support Engineer). + */ + title?: string; + } + + interface Verification { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: Verification.AdditionalDocument; + + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface AdditionalDocument { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + interface PersonListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Filters on the list of people returned based on the person's relationship to the account's company. + */ + relationship?: PersonListParams.Relationship; + } + + namespace PersonListParams { + interface Relationship { + /** + * A filter on the list of people returned based on whether these people are directors of the account's company. + */ + director?: boolean; + + /** + * A filter on the list of people returned based on whether these people are executives of the account's company. + */ + executive?: boolean; + + /** + * A filter on the list of people returned based on whether these people are owners of the account's company. + */ + owner?: boolean; + + /** + * A filter on the list of people returned based on whether these people are the representative of the account's company. + */ + representative?: boolean; + } + } + + interface PersonDeleteParams {} + } +} diff --git a/types/2019-12-03/Plans.d.ts b/types/2019-12-03/Plans.d.ts new file mode 100644 index 0000000000..dbc9875ce9 --- /dev/null +++ b/types/2019-12-03/Plans.d.ts @@ -0,0 +1,469 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Plan object. + */ + interface Plan { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'plan'; + + /** + * Whether the plan is currently available for new subscriptions. + */ + active: boolean; + + /** + * Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for picking the last usage record reported within a period, `last_ever` for picking the last usage record ever (across period bounds) or `max` which picks the usage record with the maximum reported usage during a period. Defaults to `sum`. + */ + aggregate_usage: Plan.AggregateUsage | null; + + /** + * The amount in %s to be charged on the interval specified. + */ + amount: number | null; + + /** + * Same as `amount`, but contains a decimal value with at most 12 decimal places. + */ + amount_decimal: string | null; + + /** + * Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. + */ + billing_scheme: Plan.BillingScheme | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + deleted?: void; + + /** + * One of `day`, `week`, `month` or `year`. The frequency with which a subscription should be billed. + */ + interval: Plan.Interval; + + /** + * The number of intervals (specified in the `interval` property) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. + */ + interval_count: number; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * A brief description of the plan, hidden from customers. + */ + nickname: string | null; + + /** + * The product whose pricing this plan determines. + */ + product: string | Product | DeletedProduct | null; + + /** + * Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. + */ + tiers: Array | null; + + /** + * Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. + */ + tiers_mode: Plan.TiersMode | null; + + /** + * Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. + */ + transform_usage: Plan.TransformUsage | null; + + /** + * Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). + */ + trial_period_days: number | null; + + /** + * Configures how the quantity per period should be determined, can be either `metered` or `licensed`. `licensed` will automatically bill the `quantity` set when adding it to a subscription, `metered` will aggregate the total usage based on usage records. Defaults to `licensed`. + */ + usage_type: Plan.UsageType; + } + + namespace Plan { + type AggregateUsage = 'last_during_period' | 'last_ever' | 'max' | 'sum'; + + type BillingScheme = 'per_unit' | 'tiered'; + + type Interval = 'day' | 'month' | 'week' | 'year'; + + interface Tier { + /** + * Price for the entire tier. + */ + flat_amount: number | null; + + /** + * Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. + */ + flat_amount_decimal: string | null; + + /** + * Per unit price for units relevant to the tier. + */ + unit_amount: number | null; + + /** + * Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. + */ + unit_amount_decimal: string | null; + + /** + * Up to and including to this quantity will be contained in the tier. + */ + up_to: number | null; + } + + type TiersMode = 'graduated' | 'volume'; + + interface TransformUsage { + /** + * Divide usage by this number. + */ + divide_by: number; + + /** + * After division, either round the result `up` or `down`. + */ + round: TransformUsage.Round; + } + + namespace TransformUsage { + type Round = 'down' | 'up'; + } + + type UsageType = 'licensed' | 'metered'; + } + + /** + * The DeletedPlan object. + */ + interface DeletedPlan { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'plan'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface PlanCreateParams { + /** + * 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; + + /** + * Specifies billing frequency. Either `day`, `week`, `month` or `year`. + */ + interval: PlanCreateParams.Interval; + + /** + * Whether the plan is currently available for new subscriptions. Defaults to `true`. + */ + active?: boolean; + + /** + * Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for picking the last usage record reported within a period, `last_ever` for picking the last usage record ever (across period bounds) or `max` which picks the usage record with the maximum reported usage during a period. Defaults to `sum`. + */ + aggregate_usage?: PlanCreateParams.AggregateUsage; + + /** + * A positive integer in %s (or 0 for a free plan) representing how much to charge on a recurring basis. + */ + amount?: number; + + /** + * Same as `amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set. + */ + amount_decimal?: string; + + /** + * Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. + */ + billing_scheme?: PlanCreateParams.BillingScheme; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes. + */ + id?: string; + + /** + * The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). + */ + interval_count?: number; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * A brief description of the plan, hidden from customers. + */ + nickname?: string; + + product?: string | PlanCreateParams.Product; + + /** + * Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. + */ + tiers?: Array; + + /** + * Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. + */ + tiers_mode?: PlanCreateParams.TiersMode; + + /** + * Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. + */ + transform_usage?: PlanCreateParams.TransformUsage; + + /** + * Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). + */ + trial_period_days?: number; + + /** + * Configures how the quantity per period should be determined, can be either `metered` or `licensed`. `licensed` will automatically bill the `quantity` set for a plan when adding it to a subscription, `metered` will aggregate the total usage based on usage records. Defaults to `licensed`. + */ + usage_type?: PlanCreateParams.UsageType; + } + + namespace PlanCreateParams { + type AggregateUsage = 'last_during_period' | 'last_ever' | 'max' | 'sum'; + + type BillingScheme = 'per_unit' | 'tiered'; + + type Interval = 'day' | 'month' | 'week' | 'year'; + + interface Product { + /** + * Whether the product is currently available for purchase. Defaults to `true`. + */ + active?: boolean; + + /** + * The identifier for the product. Must be unique. If not provided, an identifier will be randomly generated. + */ + id?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions. + */ + name: string; + + /** + * An arbitrary string to be displayed on your customer's credit card statement. This may be up to 22 characters. The statement description may not include <>"' characters, and will appear on your customer's statement in capital letters. Non-ASCII characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. + */ + statement_descriptor?: string; + + /** + * A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. + */ + unit_label?: string; + } + + interface Tier { + /** + * The flat billing amount for an entire tier, regardless of the number of units in the tier. + */ + flat_amount?: number; + + /** + * Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. + */ + flat_amount_decimal?: string; + + /** + * The per unit billing amount for each individual unit for which this tier applies. + */ + unit_amount?: number; + + /** + * Same as `unit_amount`, but accepts a decimal value with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + */ + unit_amount_decimal?: string; + + /** + * Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. + */ + up_to: 'inf' | number; + } + + type TiersMode = 'graduated' | 'volume'; + + interface TransformUsage { + /** + * Divide usage by this number. + */ + divide_by: number; + + /** + * After division, either round the result `up` or `down`. + */ + round: TransformUsage.Round; + } + + namespace TransformUsage { + type Round = 'down' | 'up'; + } + + type UsageType = 'licensed' | 'metered'; + } + + interface PlanRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PlanUpdateParams { + /** + * Whether the plan is currently available for new subscriptions. + */ + active?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * A brief description of the plan, hidden from customers. + */ + nickname?: string; + + /** + * The product the plan belongs to. Note that after updating, statement descriptors and line items of the plan in active subscriptions will be affected. + */ + product?: string; + + /** + * Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). + */ + trial_period_days?: number; + } + + interface PlanListParams extends PaginationParams { + /** + * Only return plans that are active or inactive (e.g., pass `false` to list all inactive plans). + */ + active?: boolean; + + /** + * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return plans for the given product. + */ + product?: string; + } + + interface PlanDeleteParams {} + + class PlansResource { + /** + * You can create plans using the API, or in the Stripe [Dashboard](https://dashboard.stripe.com/subscriptions/products). + */ + create(params: PlanCreateParams, options?: RequestOptions): Promise; + + /** + * Retrieves the plan with the given ID. + */ + retrieve( + id: string, + params?: PlanRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan's ID, amount, currency, or billing cycle. + */ + update( + id: string, + params?: PlanUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your plans. + */ + list( + params?: PlanListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Deleting plans means new subscribers can't be added. Existing subscribers aren't affected. + */ + del( + id: string, + params?: PlanDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/PlatformTaxFees.d.ts b/types/2019-12-03/PlatformTaxFees.d.ts new file mode 100644 index 0000000000..54ae484062 --- /dev/null +++ b/types/2019-12-03/PlatformTaxFees.d.ts @@ -0,0 +1,33 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The PlatformTaxFee object. + */ + interface PlatformTaxFee { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'platform_tax_fee'; + + /** + * The Connected account that incurred this charge. + */ + account: string; + + /** + * The payment object that caused this tax to be inflicted. + */ + source_transaction: string; + + /** + * The type of tax (VAT). + */ + type: string; + } + } +} diff --git a/types/2019-12-03/Products.d.ts b/types/2019-12-03/Products.d.ts new file mode 100644 index 0000000000..07889bcffc --- /dev/null +++ b/types/2019-12-03/Products.d.ts @@ -0,0 +1,450 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Product object. + */ + interface Product { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'product'; + + /** + * Whether the product is currently available for purchase. + */ + active: boolean | null; + + /** + * A list of up to 5 attributes that each SKU can provide values for (e.g., `["color", "size"]`). + */ + attributes: Array | null; + + /** + * A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of `type=good`. + */ + caption: string | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * An array of connect application identifiers that cannot purchase this product. Only applicable to products of `type=good`. + */ + deactivate_on?: Array; + + deleted?: void; + + /** + * The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. + */ + description: string | null; + + /** + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. Only applicable to products of `type=good`. + */ + images: Array; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions. + */ + name: string; + + /** + * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own `package_dimensions`. Only applicable to products of `type=good`. + */ + package_dimensions: Product.PackageDimensions | null; + + /** + * Whether this product is a shipped good. Only applicable to products of `type=good`. + */ + shippable: boolean | null; + + /** + * Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. + */ + statement_descriptor: string | null; + + /** + * The type of the product. The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans. + */ + type: Product.Type; + + /** + * A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. + */ + unit_label: string | null; + + updated: number; + + /** + * A URL of a publicly-accessible webpage for this product. Only applicable to products of `type=good`. + */ + url: string | null; + } + + namespace Product { + interface PackageDimensions { + /** + * Height, in inches. + */ + height: number; + + /** + * Length, in inches. + */ + length: number; + + /** + * Weight, in ounces. + */ + weight: number; + + /** + * Width, in inches. + */ + width: number; + } + + type Type = 'good' | 'service'; + } + + /** + * The DeletedProduct object. + */ + interface DeletedProduct { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'product'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface ProductCreateParams { + /** + * The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions. + */ + name: string; + + /** + * Whether the product is currently available for purchase. Defaults to `true`. + */ + active?: boolean; + + /** + * A list of up to 5 alphanumeric attributes. + */ + attributes?: Array; + + /** + * A short one-line description of the product, meant to be displayable to the customer. May only be set if type=`good`. + */ + caption?: string; + + /** + * An array of Connect application names or identifiers that should not be able to order the SKUs for this product. May only be set if type=`good`. + */ + deactivate_on?: Array; + + /** + * The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * An identifier will be randomly generated by Stripe. You can optionally override this ID, but the ID must be unique across all products in your Stripe account. + */ + id?: string; + + /** + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. May only be set if type=`good`. + */ + images?: Array; + + /** + * A set of key-value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + */ + metadata?: MetadataParam; + + /** + * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own `package_dimensions`. May only be set if type=`good`. + */ + package_dimensions?: ProductCreateParams.PackageDimensions; + + /** + * Whether this product is shipped (i.e., physical goods). Defaults to `true`. May only be set if type=`good`. + */ + shippable?: boolean; + + /** + * An arbitrary string to be displayed on your customer's credit card statement. This may be up to 22 characters. The statement description may not include <>"' characters, and will appear on your customer's statement in capital letters. Non-ASCII characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. It must contain at least one letter. + */ + statement_descriptor?: string; + + /** + * The type of the product. Defaults to `service` if not explicitly specified, enabling use of this product with Subscriptions and Plans. Set this parameter to `good` to use this product with Orders and SKUs. On API versions before `2018-02-05`, this field defaults to `good` for compatibility reasons. + */ + type?: ProductCreateParams.Type; + + /** + * A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. + */ + unit_label?: string; + + /** + * A URL of a publicly-accessible webpage for this product. May only be set if type=`good`. + */ + url?: string; + } + + namespace ProductCreateParams { + interface PackageDimensions { + /** + * Height, in inches. Maximum precision is 2 decimal places. + */ + height: number; + + /** + * Length, in inches. Maximum precision is 2 decimal places. + */ + length: number; + + /** + * Weight, in ounces. Maximum precision is 2 decimal places. + */ + weight: number; + + /** + * Width, in inches. Maximum precision is 2 decimal places. + */ + width: number; + } + + type Type = 'good' | 'service'; + } + + interface ProductRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ProductUpdateParams { + /** + * Whether the product is available for purchase. + */ + active?: boolean; + + /** + * A list of up to 5 alphanumeric attributes that each SKU can provide values for (e.g., `["color", "size"]`). If a value for `attributes` is specified, the list specified will replace the existing attributes list on this product. Any attributes not present after the update will be deleted from the SKUs for this product. + */ + attributes?: Array | ''; + + /** + * A short one-line description of the product, meant to be displayable to the customer. May only be set if `type=good`. + */ + caption?: string; + + /** + * An array of Connect application names or identifiers that should not be able to order the SKUs for this product. May only be set if `type=good`. + */ + deactivate_on?: Array; + + /** + * The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. May only be set if `type=good`. + */ + images?: Array | ''; + + /** + * A set of key-value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + */ + metadata?: MetadataParam; + + /** + * The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions. + */ + name?: string; + + /** + * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own `package_dimensions`. May only be set if `type=good`. + */ + package_dimensions?: ProductUpdateParams.PackageDimensions | null; + + /** + * Whether this product is shipped (i.e., physical goods). Defaults to `true`. May only be set if `type=good`. + */ + shippable?: boolean; + + /** + * An arbitrary string to be displayed on your customer's credit card statement. This may be up to 22 characters. The statement description may not include <>"' characters, and will appear on your customer's statement in capital letters. Non-ASCII characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. It must contain at least one letter. May only be set if `type=service`. + */ + statement_descriptor?: string; + + /** + * A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. May only be set if `type=service`. + */ + unit_label?: string; + + /** + * A URL of a publicly-accessible webpage for this product. May only be set if `type=good`. + */ + url?: string; + } + + namespace ProductUpdateParams { + interface PackageDimensions { + /** + * Height, in inches. Maximum precision is 2 decimal places. + */ + height: number; + + /** + * Length, in inches. Maximum precision is 2 decimal places. + */ + length: number; + + /** + * Weight, in ounces. Maximum precision is 2 decimal places. + */ + weight: number; + + /** + * Width, in inches. Maximum precision is 2 decimal places. + */ + width: number; + } + } + + interface ProductListParams extends PaginationParams { + /** + * Only return products that are active or inactive (e.g., pass `false` to list all inactive products). + */ + active?: boolean; + + /** + * Only return products that were created during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return products with the given IDs. + */ + ids?: Array; + + /** + * Only return products that can be shipped (i.e., physical, not digital products). + */ + shippable?: boolean; + + /** + * Only return products of this type. + */ + type?: ProductListParams.Type; + + /** + * Only return products with the given url. + */ + url?: string; + } + + namespace ProductListParams { + type Type = 'good' | 'service'; + } + + interface ProductDeleteParams {} + + class ProductsResource { + /** + * Creates a new product object. To create a product for use with orders, see [Products](https://stripe.com/docs/api#create_product). + */ + create( + params: ProductCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information. + */ + retrieve( + id: string, + params?: ProductRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: ProductUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first. + */ + list( + params?: ProductListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Delete a product. Deleting a product with type=good is only possible if it has no SKUs associated with it. Deleting a product with type=service is only possible if it has no plans associated with it. + */ + del( + id: string, + params?: ProductDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Radar/EarlyFraudWarnings.d.ts b/types/2019-12-03/Radar/EarlyFraudWarnings.d.ts new file mode 100644 index 0000000000..d1b7a67ff4 --- /dev/null +++ b/types/2019-12-03/Radar/EarlyFraudWarnings.d.ts @@ -0,0 +1,90 @@ +declare module 'stripe' { + namespace Stripe { + namespace Radar { + /** + * The EarlyFraudWarning object. + */ + interface EarlyFraudWarning { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'radar.early_fraud_warning'; + + /** + * An EFW is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute later. + */ + actionable: boolean; + + /** + * ID of the charge this early fraud warning is for, optionally expanded. + */ + charge: string | Charge; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The type of fraud labelled by the issuer. One of `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `made_with_lost_card`, `made_with_stolen_card`, `misc`, `unauthorized_use_of_card`. + */ + fraud_type: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + } + + interface EarlyFraudWarningRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface EarlyFraudWarningListParams extends PaginationParams { + /** + * Only return early fraud warnings for the charge specified by this charge ID. + */ + charge?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class EarlyFraudWarningsResource { + /** + * Retrieves the details of an early fraud warning that has previously been created. + * + * Please refer to the [early fraud warning](https://stripe.com/docs/api#early_fraud_warning_object) object reference for more details. + */ + retrieve( + id: string, + params?: EarlyFraudWarningRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of early fraud warnings. + */ + list( + params?: EarlyFraudWarningListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/Radar/ValueListItems.d.ts b/types/2019-12-03/Radar/ValueListItems.d.ts new file mode 100644 index 0000000000..d591f675c8 --- /dev/null +++ b/types/2019-12-03/Radar/ValueListItems.d.ts @@ -0,0 +1,156 @@ +declare module 'stripe' { + namespace Stripe { + namespace Radar { + /** + * The ValueListItem object. + */ + interface ValueListItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'radar.value_list_item'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The name or email address of the user who added this item to the value list. + */ + created_by: string; + + deleted?: void; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The value of the item. + */ + value: string; + + /** + * The identifier of the value list this item belongs to. + */ + value_list: string; + } + + /** + * The DeletedValueListItem object. + */ + interface DeletedValueListItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'radar.value_list_item'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface ValueListItemCreateParams { + /** + * The value of the item (whose type must match the type of the parent value list). + */ + value: string; + + /** + * The identifier of the value list which the created item will be added to. + */ + value_list: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ValueListItemRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ValueListItemListParams extends PaginationParams { + /** + * Identifier for the parent value list this item belongs to. + */ + value_list: string; + + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Return items belonging to the parent list whose value matches the specified value (using an "is like" match). + */ + value?: string; + } + + interface ValueListItemDeleteParams {} + + class ValueListItemsResource { + /** + * Creates a new ValueListItem object, which is added to the specified parent value list. + */ + create( + params: ValueListItemCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a ValueListItem object. + */ + retrieve( + id: string, + params?: ValueListItemRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params: ValueListItemListParams, + options?: RequestOptions + ): ApiListPromise; + + /** + * Deletes a ValueListItem object, removing it from its parent value list. + */ + del( + id: string, + params?: ValueListItemDeleteParams, + options?: RequestOptions + ): Promise; + del( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/Radar/ValueLists.d.ts b/types/2019-12-03/Radar/ValueLists.d.ts new file mode 100644 index 0000000000..c11168a7df --- /dev/null +++ b/types/2019-12-03/Radar/ValueLists.d.ts @@ -0,0 +1,235 @@ +declare module 'stripe' { + namespace Stripe { + namespace Radar { + /** + * The ValueList object. + */ + interface ValueList { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'radar.value_list'; + + /** + * The name of the value list for use in rules. + */ + alias: string; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The name or email address of the user who created this value list. + */ + created_by: string; + + deleted?: void; + + /** + * The type of items in the value list. One of `card_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, or `case_sensitive_string`. + */ + item_type: ValueList.ItemType; + + /** + * List of items contained within this value list. + */ + list_items: ApiList; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The name of the value list. + */ + name: string; + } + + namespace ValueList { + type ItemType = + | 'card_bin' + | 'card_fingerprint' + | 'case_sensitive_string' + | 'country' + | 'email' + | 'ip_address' + | 'string'; + } + + /** + * The DeletedValueList object. + */ + interface DeletedValueList { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'radar.value_list'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface ValueListCreateParams { + /** + * The name of the value list for use in rules. + */ + alias: string; + + /** + * The human-readable name of the value list. + */ + name: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Type of the items in the value list. One of `card_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, or `case_sensitive_string`. Use `string` if the item type is unknown or mixed. + */ + item_type?: ValueListCreateParams.ItemType; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + namespace ValueListCreateParams { + type ItemType = + | 'card_bin' + | 'card_fingerprint' + | 'case_sensitive_string' + | 'country' + | 'email' + | 'ip_address' + | 'string'; + } + + interface ValueListRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ValueListUpdateParams { + /** + * The name of the value list for use in rules. + */ + alias?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The human-readable name of the value list. + */ + name?: string; + } + + interface ValueListListParams extends PaginationParams { + /** + * The alias used to reference the value list when writing rules. + */ + alias?: string; + + /** + * A value contained within a value list - returns all value lists containing this value. + */ + contains?: string; + + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ValueListDeleteParams {} + + class ValueListsResource { + /** + * Creates a new ValueList object, which can then be referenced in rules. + */ + create( + params: ValueListCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a ValueList object. + */ + retrieve( + id: string, + params?: ValueListRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable. + */ + update( + id: string, + params?: ValueListUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: ValueListListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules. + */ + del( + id: string, + params?: ValueListDeleteParams, + options?: RequestOptions + ): Promise; + del( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/Recipients.d.ts b/types/2019-12-03/Recipients.d.ts new file mode 100644 index 0000000000..51b6b5c6fc --- /dev/null +++ b/types/2019-12-03/Recipients.d.ts @@ -0,0 +1,275 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Recipient object. + */ + interface Recipient { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'recipient'; + + /** + * Hash describing the current account on the recipient, if there is one. + */ + active_account: BankAccount | null; + + cards: ApiList | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The default card to use for creating transfers to this recipient. + */ + default_card: string | Card | null; + + deleted?: void; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + email: string | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The ID of the [Custom account](https://stripe.com/docs/connect/custom-accounts) this recipient was migrated to. If set, the recipient can no longer be updated, nor can transfers be made to it: use the Custom account instead. + */ + migrated_to: string | Account | null; + + /** + * Full, legal name of the recipient. + */ + name: string | null; + + rolled_back_from?: string | Account; + + /** + * Type of the recipient, one of `individual` or `corporation`. + */ + type: string; + + /** + * Whether the recipient has been verified. This field is non-standard, and maybe removed in the future + */ + verified: boolean; + } + + /** + * The DeletedRecipient object. + */ + interface DeletedRecipient { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'recipient'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface RecipientCreateParams { + /** + * The recipient's full, legal name. For type `individual`, should be in the format `First Last`, `First Middle Last`, or `First M Last` (no prefixes or suffixes). For `corporation`, the full, incorporated name. + */ + name: string; + + /** + * Type of the recipient: either `individual` or `corporation`. + */ + type: string; + + /** + * A bank account to attach to the recipient. You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe-js), or a dictionary containing a user's bank account details, with the options described below. + */ + bank_account?: string; + + /** + * A U.S. Visa or MasterCard debit card (_not_ prepaid) to attach to the recipient. If the debit card is not valid, recipient creation will fail. You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe-js), or a dictionary containing a user's debit card details, with the options described below. Although not all information is required, the extra info helps prevent fraud. + */ + card?: string; + + /** + * An arbitrary string which you can attach to a `Recipient` object. It is displayed alongside the recipient in the web interface. + */ + description?: string; + + /** + * The recipient's email address. It is displayed alongside the recipient in the web interface, and can be useful for searching and tracking. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The recipient's tax ID, as a string. For type `individual`, the full SSN; for type `corporation`, the full EIN. + */ + tax_id?: string; + } + + interface RecipientRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface RecipientUpdateParams { + /** + * A bank account to attach to the recipient. You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe-js), or a dictionary containing a user's bank account details, with the options described below. + */ + bank_account?: string; + + /** + * A U.S. Visa or MasterCard debit card (not prepaid) to attach to the recipient. You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe-js), or a dictionary containing a user's debit card details, with the options described below. Passing `card` will create a new card, make it the new recipient default card, and delete the old recipient default (if one exists). If you want to add additional debit cards instead of replacing the existing default, use the [card creation API](#create_card). Whenever you attach a card to a recipient, Stripe will automatically validate the debit card. + */ + card?: string; + + /** + * ID of the card to set as the recipient's new default for payouts. + */ + default_card?: string; + + /** + * An arbitrary string which you can attach to a `Recipient` object. It is displayed alongside the recipient in the web interface. + */ + description?: string; + + /** + * The recipient's email address. It is displayed alongside the recipient in the web interface, and can be useful for searching and tracking. + */ + email?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The recipient's full, legal name. For type `individual`, should be in the format `First Last`, `First Middle Last`, or `First M Last` (no prefixes or suffixes). For `corporation`, the full, incorporated name. + */ + name?: string; + + /** + * The recipient's tax ID, as a string. For type `individual`, the full SSN; for type `corporation`, the full EIN. + */ + tax_id?: string; + } + + interface RecipientListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + type?: RecipientListParams.Type; + + /** + * Only return recipients that are verified or unverified. + */ + verified?: boolean; + } + + namespace RecipientListParams { + type Type = 'corporation' | 'individual'; + } + + interface RecipientDeleteParams {} + + class RecipientsResource { + /** + * Creates a new Recipient object and verifies the recipient's identity. + * Also verifies the recipient's bank account information or debit card, if either is provided. + */ + create( + params: RecipientCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing recipient. You need only supply the unique recipient identifier that was returned upon recipient creation. + */ + retrieve( + id: string, + params?: RecipientRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified recipient by setting the values of the parameters passed. + * Any parameters not provided will be left unchanged. + * + * If you update the name or tax ID, the identity verification will automatically be rerun. + * If you update the bank account, the bank account validation will automatically be rerun. + */ + update( + id: string, + params?: RecipientUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your recipients. The recipients are returned sorted by creation date, with the most recently created recipients appearing first. + */ + list( + params?: RecipientListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Permanently deletes a recipient. It cannot be undone. + */ + del( + id: string, + params?: RecipientDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Refunds.d.ts b/types/2019-12-03/Refunds.d.ts new file mode 100644 index 0000000000..f2defb9700 --- /dev/null +++ b/types/2019-12-03/Refunds.d.ts @@ -0,0 +1,236 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Refund object. + */ + interface Refund { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'refund'; + + /** + * Amount, in %s. + */ + amount: number; + + /** + * Balance transaction that describes the impact on your account balance. + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * ID of the charge that was refunded. + */ + charge: string | Charge | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only) + */ + description?: string; + + /** + * If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. + */ + failure_balance_transaction?: string | BalanceTransaction; + + /** + * If the refund failed, the reason for refund failure if known. Possible values are `lost_or_stolen_card`, `expired_or_canceled_card`, or `unknown`. + */ + failure_reason?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * ID of the PaymentIntent that was refunded. + */ + payment_intent: string | PaymentIntent | null; + + /** + * Reason for the refund, either user-provided (`duplicate`, `fraudulent`, or `requested_by_customer`) or generated by Stripe internally (`expired_uncaptured_charge`). + */ + reason: string | null; + + /** + * This is the transaction number that appears on email receipts sent for this refund. + */ + receipt_number: string | null; + + /** + * The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details. + */ + source_transfer_reversal: string | TransferReversal | null; + + /** + * Status of the refund. For credit card refunds, this can be `pending`, `succeeded`, or `failed`. For other types of refunds, it can be `pending`, `succeeded`, `failed`, or `canceled`. Refer to our [refunds](https://stripe.com/docs/refunds#failed-refunds) documentation for more details. + */ + status: string | null; + + /** + * If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter. + */ + transfer_reversal: string | TransferReversal | null; + } + + interface RefundCreateParams { + amount?: number; + + charge?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + metadata?: MetadataParam; + + payment_intent?: string; + + reason?: RefundCreateParams.Reason; + + refund_application_fee?: boolean; + + reverse_transfer?: boolean; + } + + namespace RefundCreateParams { + type Reason = 'duplicate' | 'fraudulent' | 'requested_by_customer'; + } + + interface RefundRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface RefundRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface RefundUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface RefundListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface RefundListParams extends PaginationParams { + /** + * Only return refunds for the charge specified by this charge ID. + */ + charge?: string; + + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return refunds for the PaymentIntent specified by this ID. + */ + payment_intent?: string; + } + + class RefundsResource { + /** + * Create a refund. + */ + create( + params?: RefundCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of an existing refund. + */ + retrieve( + chargeId: string, + id: string, + params?: RefundRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + chargeId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing refund. + */ + retrieve( + id: string, + params?: RefundRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * + * This request only accepts metadata as an argument. + */ + update( + id: string, + params?: RefundUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * You can see a list of the refunds belonging to a specific charge. Note that the 10 most recent refunds are always available by default on the charge object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds. + */ + list( + id: string, + params?: RefundListParams, + options?: RequestOptions + ): ApiListPromise; + list(id: string, options?: RequestOptions): ApiListPromise; + + /** + * Returns a list of all refunds you've previously created. The refunds are returned in sorted order, with the most recent refunds appearing first. For convenience, the 10 most recent refunds are always available by default on the charge object. + */ + list( + params?: RefundListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Reporting/ReportRuns.d.ts b/types/2019-12-03/Reporting/ReportRuns.d.ts new file mode 100644 index 0000000000..4bc26e5ad9 --- /dev/null +++ b/types/2019-12-03/Reporting/ReportRuns.d.ts @@ -0,0 +1,240 @@ +declare module 'stripe' { + namespace Stripe { + namespace Reporting { + /** + * The ReportRun object. + */ + interface ReportRun { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'reporting.report_run'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * If something should go wrong during the run, a message about the failure (populated when + * `status=failed`). + */ + error: string | null; + + /** + * Always `true`: reports can only be run on live-mode data. + */ + livemode: boolean; + + parameters: ReportRun.Parameters; + + /** + * The ID of the [report type](https://stripe.com/docs/reporting/statements/api#report-types) to run, such as `"balance.summary.1"`. + */ + report_type: string; + + /** + * The file object representing the result of the report run (populated when + * `status=succeeded`). + */ + result: File | null; + + /** + * Status of this report run. This will be `pending` when the run is initially created. + * When the run finishes, this will be set to `succeeded` and the `result` field will be populated. + * Rarely, we may encounter an error, at which point this will be set to `failed` and the `error` field will be populated. + */ + status: string; + + /** + * Timestamp at which this run successfully finished (populated when + * `status=succeeded`). Measured in seconds since the Unix epoch. + */ + succeeded_at: number | null; + } + + namespace ReportRun { + interface Parameters { + /** + * The set of output columns requested for inclusion in the report run. + */ + columns?: Array; + + /** + * Connected account ID by which to filter the report run. + */ + connected_account?: string; + + /** + * Currency of objects to be included in the report run. + */ + currency?: string; + + /** + * Ending timestamp of data to be included in the report run (exclusive). + */ + interval_end?: number; + + /** + * Starting timestamp of data to be included in the report run. + */ + interval_start?: number; + + /** + * Payout ID by which to filter the report run. + */ + payout?: string; + + /** + * Category of balance transactions to be included in the report run. + */ + reporting_category?: string; + } + } + + interface ReportRunCreateParams { + /** + * The ID of the [report type](https://stripe.com/docs/reporting/statements/api#report-types) to run, such as `"balance.summary.1"`. + */ + report_type: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Parameters specifying how the report should be run. Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation. + */ + parameters?: ReportRunCreateParams.Parameters; + } + + namespace ReportRunCreateParams { + interface Parameters { + /** + * The set of report columns to include in the report output. If omitted, the Report Type is run with its default column set. + */ + columns?: Array; + + /** + * Connected account ID to filter for in the report run. + */ + connected_account?: string; + + /** + * Currency of objects to be included in the report run. + */ + currency?: string; + + /** + * Ending timestamp of data to be included in the report run (exclusive). + */ + interval_end?: number; + + /** + * Starting timestamp of data to be included in the report run. + */ + interval_start?: number; + + /** + * Payout ID by which to filter the report run. + */ + payout?: string; + + /** + * Category of balance transactions to be included in the report run. + */ + reporting_category?: Parameters.ReportingCategory; + } + + namespace Parameters { + type ReportingCategory = + | 'advance' + | 'advance_funding' + | 'charge' + | 'charge_failure' + | 'connect_collection_transfer' + | 'connect_reserved_funds' + | 'dispute' + | 'dispute_reversal' + | 'fee' + | 'financing_paydown' + | 'financing_paydown_reversal' + | 'financing_payout' + | 'financing_payout_reversal' + | 'issuing_authorization_hold' + | 'issuing_authorization_release' + | 'issuing_transaction' + | 'network_cost' + | 'other_adjustment' + | 'partial_capture_reversal' + | 'payout' + | 'payout_reversal' + | 'platform_earning' + | 'platform_earning_refund' + | 'refund' + | 'refund_failure' + | 'risk_reserved_funds' + | 'tax' + | 'topup' + | 'topup_reversal' + | 'transfer' + | 'transfer_reversal'; + } + } + + interface ReportRunRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ReportRunListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ReportRunsResource { + /** + * Creates a new object and begin running the report. (Requires a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) + */ + create( + params: ReportRunCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing Report Run. (Requires a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) + */ + retrieve( + id: string, + params?: ReportRunRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Report Runs, with the most recent appearing first. (Requires a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) + */ + list( + params?: ReportRunListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/Reporting/ReportTypes.d.ts b/types/2019-12-03/Reporting/ReportTypes.d.ts new file mode 100644 index 0000000000..96d6c96784 --- /dev/null +++ b/types/2019-12-03/Reporting/ReportTypes.d.ts @@ -0,0 +1,88 @@ +declare module 'stripe' { + namespace Stripe { + namespace Reporting { + /** + * The ReportType object. + */ + interface ReportType { + /** + * The [ID of the Report Type](https://stripe.com/docs/reporting/statements/api#available-report-types), such as `balance.summary.1`. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'reporting.report_type'; + + /** + * Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch. + */ + data_available_end: number; + + /** + * Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch. + */ + data_available_start: number; + + /** + * List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the `columns` parameter, this will be null.) + */ + default_columns: Array | null; + + /** + * Human-readable name of the Report Type + */ + name: string; + + /** + * When this Report Type was latest updated. Measured in seconds since the Unix epoch. + */ + updated: number; + + /** + * Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas. + */ + version: number; + } + + interface ReportTypeRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ReportTypeListParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ReportTypesResource { + /** + * Retrieves the details of a Report Type. (Requires a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) + */ + retrieve( + id: string, + params?: ReportTypeRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a full list of Report Types. (Requires a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) + */ + list( + params?: ReportTypeListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/ReserveTransactions.d.ts b/types/2019-12-03/ReserveTransactions.d.ts new file mode 100644 index 0000000000..46c1ee8e57 --- /dev/null +++ b/types/2019-12-03/ReserveTransactions.d.ts @@ -0,0 +1,30 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The ReserveTransaction object. + */ + interface ReserveTransaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'reserve_transaction'; + + 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + } + } +} diff --git a/types/2019-12-03/Reviews.d.ts b/types/2019-12-03/Reviews.d.ts new file mode 100644 index 0000000000..1288c4c149 --- /dev/null +++ b/types/2019-12-03/Reviews.d.ts @@ -0,0 +1,191 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Review object. + */ + interface Review { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'review'; + + /** + * The ZIP or postal code of the card used, if applicable. + */ + billing_zip: string | null; + + /** + * The charge associated with this review. + */ + charge: string | Charge | null; + + /** + * The reason the review was closed, or null if it has not yet been closed. One of `approved`, `refunded`, `refunded_as_fraud`, or `disputed`. + */ + closed_reason: Review.ClosedReason | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * The IP address where the payment originated. + */ + ip_address: string | null; + + /** + * Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address. + */ + ip_address_location: Review.IpAddressLocation | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * If `true`, the review needs action. + */ + open: boolean; + + /** + * The reason the review was opened. One of `rule` or `manual`. + */ + opened_reason: Review.OpenedReason; + + /** + * The PaymentIntent ID associated with this review, if one exists. + */ + payment_intent?: string | PaymentIntent; + + /** + * The reason the review is currently open or closed. One of `rule`, `manual`, `approved`, `refunded`, `refunded_as_fraud`, or `disputed`. + */ + reason: string; + + /** + * Information related to the browsing session of the user who initiated the payment. + */ + session: Review.Session | null; + } + + namespace Review { + type ClosedReason = + | 'approved' + | 'disputed' + | 'refunded' + | 'refunded_as_fraud'; + + interface IpAddressLocation { + /** + * The city where the payment originated. + */ + city: string | null; + + /** + * Two-letter ISO code representing the country where the payment originated. + */ + country: string | null; + + /** + * The geographic latitude where the payment originated. + */ + latitude: number | null; + + /** + * The geographic longitude where the payment originated. + */ + longitude: number | null; + + /** + * The state/county/province/region where the payment originated. + */ + region: string | null; + } + + type OpenedReason = 'manual' | 'rule'; + + interface Session { + /** + * The browser used in this browser session (e.g., `Chrome`). + */ + browser: string | null; + + /** + * Information about the device used for the browser session (e.g., `Samsung SM-G930T`). + */ + device: string | null; + + /** + * The platform for the browser session (e.g., `Macintosh`). + */ + platform: string | null; + + /** + * The version for the browser session (e.g., `61.0.3163.100`). + */ + version: string | null; + } + } + + interface ReviewRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ReviewListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ReviewApproveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ReviewsResource { + /** + * Retrieves a Review object. + */ + retrieve( + id: string, + params?: ReviewRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Returns a list of Review objects that have open set to true. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + */ + list( + params?: ReviewListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Approves a Review object, closing it and removing it from the list of reviews. + */ + approve( + id: string, + params?: ReviewApproveParams, + options?: RequestOptions + ): Promise; + approve(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/SKUs.d.ts b/types/2019-12-03/SKUs.d.ts new file mode 100644 index 0000000000..cd6c0d98f8 --- /dev/null +++ b/types/2019-12-03/SKUs.d.ts @@ -0,0 +1,428 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Sku object. + */ + interface Sku { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'sku'; + + /** + * Whether the SKU is available for purchase. + */ + active: boolean; + + /** + * A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are `["size", "gender"]`, a valid SKU has the following dictionary of attributes: `{"size": "Medium", "gender": "Unisex"}`. + */ + attributes: { + [key: string]: string; + }; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + deleted?: void; + + /** + * The URL of an image for this SKU, meant to be displayable to the customer. + */ + image: string | null; + + inventory: Sku.Inventory; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * The dimensions of this SKU for shipping purposes. + */ + package_dimensions: Sku.PackageDimensions | null; + + /** + * The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency). + */ + price: number; + + /** + * The ID of the product this SKU is associated with. The product must be currently active. + */ + product: string | Product; + + updated: number; + } + + namespace Sku { + interface Inventory { + /** + * The count of inventory available. Will be present if and only if `type` is `finite`. + */ + quantity: number | null; + + /** + * Inventory type. Possible values are `finite`, `bucket` (not quantified), and `infinite`. + */ + type: string; + + /** + * An indicator of the inventory available. Possible values are `in_stock`, `limited`, and `out_of_stock`. Will be present if and only if `type` is `bucket`. + */ + value: string | null; + } + + interface PackageDimensions { + /** + * Height, in inches. + */ + height: number; + + /** + * Length, in inches. + */ + length: number; + + /** + * Weight, in ounces. + */ + weight: number; + + /** + * Width, in inches. + */ + width: number; + } + } + + /** + * The DeletedSku object. + */ + interface DeletedSku { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'sku'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface SkuCreateParams { + /** + * 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; + + /** + * Description of the SKU's inventory. + */ + inventory: SkuCreateParams.Inventory; + + /** + * The cost of the item as a nonnegative integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency). + */ + price: number; + + /** + * The ID of the product this SKU is associated with. Must be a product with type `good`. + */ + product: string; + + /** + * Whether the SKU is available for purchase. Default to `true`. + */ + active?: boolean; + + /** + * A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are `["size", "gender"]`, a valid SKU has the following dictionary of attributes: `{"size": "Medium", "gender": "Unisex"}`. + */ + attributes?: Metadata; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The identifier for the SKU. Must be unique. If not provided, an identifier will be randomly generated. + */ + id?: string; + + /** + * The URL of an image for this SKU, meant to be displayable to the customer. + */ + image?: string; + + /** + * A set of key-value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + */ + metadata?: MetadataParam; + + /** + * The dimensions of this SKU for shipping purposes. + */ + package_dimensions?: SkuCreateParams.PackageDimensions; + } + + namespace SkuCreateParams { + interface Inventory { + /** + * The count of inventory available. Required if `type` is `finite`. + */ + quantity?: number; + + /** + * Inventory type. Possible values are `finite`, `bucket` (not quantified), and `infinite`. + */ + type?: Inventory.Type; + + /** + * An indicator of the inventory available. Possible values are `in_stock`, `limited`, and `out_of_stock`. Will be present if and only if `type` is `bucket`. + */ + value?: Inventory.Value | null; + } + + namespace Inventory { + type Type = 'bucket' | 'finite' | 'infinite'; + + type Value = 'in_stock' | 'limited' | 'out_of_stock'; + } + + interface PackageDimensions { + /** + * Height, in inches. Maximum precision is 2 decimal places. + */ + height: number; + + /** + * Length, in inches. Maximum precision is 2 decimal places. + */ + length: number; + + /** + * Weight, in ounces. Maximum precision is 2 decimal places. + */ + weight: number; + + /** + * Width, in inches. Maximum precision is 2 decimal places. + */ + width: number; + } + } + + interface SkuRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SkuUpdateParams { + /** + * Whether this SKU is available for purchase. + */ + active?: boolean; + + /** + * A dictionary of attributes and values for the attributes defined by the product. When specified, `attributes` will partially update the existing attributes dictionary on the product, with the postcondition that a value must be present for each attribute key on the product. + */ + attributes?: Metadata; + + /** + * 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; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The URL of an image for this SKU, meant to be displayable to the customer. + */ + image?: string; + + /** + * Description of the SKU's inventory. + */ + inventory?: SkuUpdateParams.Inventory; + + /** + * A set of key-value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + */ + metadata?: MetadataParam; + + /** + * The dimensions of this SKU for shipping purposes. + */ + package_dimensions?: SkuUpdateParams.PackageDimensions | null; + + /** + * The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency). + */ + price?: number; + + /** + * The ID of the product that this SKU should belong to. The product must exist, have the same set of attribute names as the SKU's current product, and be of type `good`. + */ + product?: string; + } + + namespace SkuUpdateParams { + interface Inventory { + /** + * The count of inventory available. Required if `type` is `finite`. + */ + quantity?: number; + + /** + * Inventory type. Possible values are `finite`, `bucket` (not quantified), and `infinite`. + */ + type?: Inventory.Type; + + /** + * An indicator of the inventory available. Possible values are `in_stock`, `limited`, and `out_of_stock`. Will be present if and only if `type` is `bucket`. + */ + value?: Inventory.Value | null; + } + + namespace Inventory { + type Type = 'bucket' | 'finite' | 'infinite'; + + type Value = 'in_stock' | 'limited' | 'out_of_stock'; + } + + interface PackageDimensions { + /** + * Height, in inches. Maximum precision is 2 decimal places. + */ + height: number; + + /** + * Length, in inches. Maximum precision is 2 decimal places. + */ + length: number; + + /** + * Weight, in ounces. Maximum precision is 2 decimal places. + */ + weight: number; + + /** + * Width, in inches. Maximum precision is 2 decimal places. + */ + width: number; + } + } + + interface SkuListParams extends PaginationParams { + /** + * Only return SKUs that are active or inactive (e.g., pass `false` to list all inactive products). + */ + active?: boolean; + + /** + * Only return SKUs that have the specified key-value pairs in this partially constructed dictionary. Can be specified only if `product` is also supplied. For instance, if the associated product has attributes `["color", "size"]`, passing in `attributes[color]=red` returns all the SKUs for this product that have `color` set to `red`. + */ + attributes?: Metadata; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return SKUs with the given IDs. + */ + ids?: Array; + + /** + * Only return SKUs that are either in stock or out of stock (e.g., pass `false` to list all SKUs that are out of stock). If no value is provided, all SKUs are returned. + */ + in_stock?: boolean; + + /** + * The ID of the product whose SKUs will be retrieved. Must be a product with type `good`. + */ + product?: string; + } + + interface SkuDeleteParams {} + + class SkusResource { + /** + * Creates a new SKU associated with a product. + */ + create(params: SkuCreateParams, options?: RequestOptions): Promise; + + /** + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU creation request or from the product, and Stripe will return the corresponding SKU information. + */ + retrieve( + id: string, + params?: SkuRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specific SKU by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * + * Note that a SKU's attributes are not editable. Instead, you would need to deactivate the existing SKU and create a new one with the new attribute values. + */ + update( + id: string, + params?: SkuUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your SKUs. The SKUs are returned sorted by creation date, with the most recently created SKUs appearing first. + */ + list( + params?: SkuListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Delete a SKU. Deleting a SKU is only possible until it has been used in an order. + */ + del( + id: string, + params?: SkuDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/SetupIntents.d.ts b/types/2019-12-03/SetupIntents.d.ts new file mode 100644 index 0000000000..14350eeab7 --- /dev/null +++ b/types/2019-12-03/SetupIntents.d.ts @@ -0,0 +1,703 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The SetupIntent object. + */ + interface SetupIntent { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'setup_intent'; + + /** + * ID of the Connect application that created the SetupIntent. + */ + application: string | Application | null; + + /** + * Reason for cancellation of this SetupIntent, one of `abandoned`, `requested_by_customer`, or `duplicate`. + */ + cancellation_reason: SetupIntent.CancellationReason | null; + + /** + * The client secret of this SetupIntent. Used for client-side retrieval using a publishable key. + * + * The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret. + */ + client_secret: string | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * ID of the Customer this SetupIntent belongs to, if one exists. + * + * If present, payment methods used with this SetupIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this SetupIntent. + */ + customer: string | Customer | DeletedCustomer | null; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * The error encountered in the previous SetupIntent confirmation. + */ + last_setup_error: SetupIntent.LastSetupError | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * ID of the multi use Mandate generated by the SetupIntent. + */ + mandate: string | Mandate | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * If present, this property tells you what actions you need to take in order for your customer to continue payment setup. + */ + next_action: SetupIntent.NextAction | null; + + /** + * The account (if any) for which the setup is intended. + */ + on_behalf_of: string | Account | null; + + /** + * ID of the payment method used with this SetupIntent. + */ + payment_method: string | PaymentMethod | null; + + /** + * Payment-method-specific configuration for this SetupIntent. + */ + payment_method_options: SetupIntent.PaymentMethodOptions | null; + + /** + * The list of payment method types (e.g. card) that this SetupIntent is allowed to set up. + */ + payment_method_types: Array; + + /** + * ID of the single_use Mandate generated by the SetupIntent. + */ + single_use_mandate: string | Mandate | null; + + /** + * [Status](https://stripe.com/docs/payments/intents#intent-statuses) of this SetupIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `canceled`, or `succeeded`. + */ + status: SetupIntent.Status; + + /** + * Indicates how the payment method is intended to be used in the future. + * + * Use `on_session` if you intend to only reuse the payment method when the customer is in your checkout flow. Use `off_session` if your customer may or may not be in your checkout flow. If not provided, this value defaults to `off_session`. + */ + usage: string; + } + + namespace SetupIntent { + type CancellationReason = + | 'abandoned' + | 'duplicate' + | 'requested_by_customer'; + + interface LastSetupError { + /** + * For card errors, the ID of the failed charge. + */ + charge?: string; + + /** + * For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported. + */ + code?: string; + + /** + * For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one. + */ + decline_code?: string; + + /** + * A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported. + */ + doc_url?: string; + + /** + * A human-readable message providing more details about the error. For card errors, these messages can be shown to your users. + */ + message?: string; + + /** + * If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. + */ + param?: string; + + payment_intent?: PaymentIntent; + + payment_method?: PaymentMethod; + + setup_intent?: SetupIntent; + + source?: CustomerSource; + + /** + * The type of error returned. One of `api_connection_error`, `api_error`, `authentication_error`, `card_error`, `idempotency_error`, `invalid_request_error`, or `rate_limit_error` + */ + type: LastSetupError.Type; + } + + namespace LastSetupError { + type Type = + | 'api_connection_error' + | 'api_error' + | 'authentication_error' + | 'card_error' + | 'idempotency_error' + | 'invalid_request_error' + | 'rate_limit_error'; + } + + interface NextAction { + redirect_to_url?: NextAction.RedirectToUrl; + + /** + * Type of the next action to perform, one of `redirect_to_url` or `use_stripe_sdk`. + */ + type: string; + + /** + * When confirming a SetupIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js. + */ + use_stripe_sdk?: NextAction.UseStripeSdk; + } + + namespace NextAction { + interface RedirectToUrl { + /** + * If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. + */ + return_url: string | null; + + /** + * The URL you must redirect your customer to in order to authenticate. + */ + url: string | null; + } + + interface UseStripeSdk {} + } + + interface PaymentMethodOptions { + card?: PaymentMethodOptions.Card; + } + + namespace PaymentMethodOptions { + interface Card { + /** + * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + */ + request_three_d_secure: Card.RequestThreeDSecure | null; + } + + namespace Card { + type RequestThreeDSecure = 'any' | 'automatic' | 'challenge_only'; + } + } + + type Status = + | 'canceled' + | 'processing' + | 'requires_action' + | 'requires_confirmation' + | 'requires_payment_method' + | 'succeeded'; + } + + interface SetupIntentCreateParams { + /** + * Set to `true` to attempt to confirm this SetupIntent immediately. This parameter defaults to `false`. If the payment method attached is a card, a return_url may be provided in case additional authentication is required. + */ + confirm?: boolean; + + /** + * ID of the Customer this SetupIntent belongs to, if one exists. + * + * If present, payment methods used with this SetupIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this SetupIntent. + */ + customer?: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). + */ + mandate_data?: SetupIntentCreateParams.MandateData; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * The Stripe account ID for which this SetupIntent is created. + */ + on_behalf_of?: string; + + /** + * ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent. + */ + payment_method?: string; + + /** + * Payment-method-specific configuration for this SetupIntent. + */ + payment_method_options?: SetupIntentCreateParams.PaymentMethodOptions; + + /** + * The list of payment method types (e.g. card) that this SetupIntent is allowed to use. If this is not provided, defaults to ["card"]. + */ + payment_method_types?: Array; + + /** + * The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). + */ + return_url?: string; + + /** + * If this hash is populated, this SetupIntent will generate a single_use Mandate on success. + */ + single_use?: SetupIntentCreateParams.SingleUse; + + /** + * Indicates how the payment method is intended to be used in the future. If not provided, this value defaults to `off_session`. + */ + usage?: string | SetupIntentCreateParams.Usage; + } + + namespace SetupIntentCreateParams { + interface MandateData { + /** + * This hash contains details about the customer acceptance of the Mandate. + */ + customer_acceptance: MandateData.CustomerAcceptance; + } + + namespace MandateData { + interface CustomerAcceptance { + /** + * The time at which the customer accepted the Mandate. + */ + accepted_at?: number; + + /** + * If this is a Mandate accepted offline, this hash contains details about the offline acceptance. + */ + offline?: CustomerAcceptance.Offline; + + /** + * If this is a Mandate accepted online, this hash contains details about the online acceptance. + */ + online?: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. One of `online` or `offline`. + */ + type: CustomerAcceptance.Type; + } + + namespace CustomerAcceptance { + interface Offline {} + + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address: string; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent: string; + } + + type Type = 'offline' | 'online'; + } + } + + interface PaymentMethodOptions { + /** + * Configuration for any card setup attempted on this SetupIntent. + */ + card?: PaymentMethodOptions.Card; + } + + namespace PaymentMethodOptions { + interface Card { + /** + * When specified, this parameter signals that a card has been collected + * as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This + * parameter can only be provided during confirmation. + */ + moto?: boolean; + + /** + * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + */ + request_three_d_secure?: Card.RequestThreeDSecure; + } + + namespace Card { + type RequestThreeDSecure = 'any' | 'automatic'; + } + } + + interface SingleUse { + /** + * Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + 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 Usage = 'off_session' | 'on_session'; + } + + interface SetupIntentRetrieveParams { + /** + * The client secret of the SetupIntent. Required if a publishable key is used to retrieve the SetupIntent. + */ + client_secret?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SetupIntentUpdateParams { + /** + * ID of the Customer this SetupIntent belongs to, if one exists. + * + * If present, payment methods used with this SetupIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this SetupIntent. + */ + customer?: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent. + */ + payment_method?: string; + + /** + * The list of payment method types (e.g. card) that this SetupIntent is allowed to set up. If this is not provided, defaults to ["card"]. + */ + payment_method_types?: Array; + } + + interface SetupIntentListParams extends PaginationParams { + /** + * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + */ + created?: RangeQueryParam | number; + + /** + * Only return SetupIntents for the customer specified by this customer ID. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return SetupIntents associated with the specified payment method. + */ + payment_method?: string; + } + + interface SetupIntentCancelParams { + /** + * Reason for canceling this SetupIntent. Possible values are `abandoned`, `requested_by_customer`, or `duplicate` + */ + cancellation_reason?: SetupIntentCancelParams.CancellationReason; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace SetupIntentCancelParams { + type CancellationReason = + | 'abandoned' + | 'duplicate' + | 'requested_by_customer'; + } + + interface SetupIntentConfirmParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * This hash contains details about the Mandate to create + */ + mandate_data?: + | SetupIntentConfirmParams.MandateData1 + | SetupIntentConfirmParams.MandateData2; + + /** + * ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent. + */ + payment_method?: string; + + /** + * Payment-method-specific configuration for this SetupIntent. + */ + payment_method_options?: SetupIntentConfirmParams.PaymentMethodOptions; + + /** + * The URL to redirect your customer back to after they authenticate on the payment method's app or site. + * If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. + * This parameter is only used for cards and other redirect-based payment methods. + */ + return_url?: string; + } + + namespace SetupIntentConfirmParams { + interface MandateData1 { + /** + * This hash contains details about the customer acceptance of the Mandate. + */ + customer_acceptance: MandateData1.CustomerAcceptance; + } + + namespace MandateData1 { + interface CustomerAcceptance { + /** + * The time at which the customer accepted the Mandate. + */ + accepted_at?: number; + + /** + * If this is a Mandate accepted offline, this hash contains details about the offline acceptance. + */ + offline?: CustomerAcceptance.Offline; + + /** + * If this is a Mandate accepted online, this hash contains details about the online acceptance. + */ + online?: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. One of `online` or `offline`. + */ + type: CustomerAcceptance.Type; + } + + namespace CustomerAcceptance { + interface Offline {} + + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address: string; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent: string; + } + + type Type = 'offline' | 'online'; + } + } + interface MandateData2 { + /** + * This hash contains details about the customer acceptance of the Mandate. + */ + customer_acceptance: MandateData2.CustomerAcceptance; + } + + namespace MandateData2 { + interface CustomerAcceptance { + /** + * If this is a Mandate accepted online, this hash contains details about the online acceptance. + */ + online: CustomerAcceptance.Online; + + /** + * The type of customer acceptance information included with the Mandate. + */ + type: 'online'; + } + + namespace CustomerAcceptance { + interface Online { + /** + * The IP address from which the Mandate was accepted by the customer. + */ + ip_address?: string; + + /** + * The user agent of the browser from which the Mandate was accepted by the customer. + */ + user_agent?: string; + } + } + } + + interface PaymentMethodOptions { + /** + * Configuration for any card setup attempted on this SetupIntent. + */ + card?: PaymentMethodOptions.Card; + } + + namespace PaymentMethodOptions { + interface Card { + /** + * When specified, this parameter signals that a card has been collected + * as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This + * parameter can only be provided during confirmation. + */ + moto?: boolean; + + /** + * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: `automatic` or `any`. If not provided, defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. + */ + request_three_d_secure?: Card.RequestThreeDSecure; + } + + namespace Card { + type RequestThreeDSecure = 'any' | 'automatic'; + } + } + } + + class SetupIntentsResource { + /** + * Creates a SetupIntent object. + * + * After the SetupIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/setup_intents/confirm) + * to collect any required permissions to charge the payment method later. + */ + create( + params?: SetupIntentCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of a SetupIntent that has previously been created. + * + * Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string. + * + * When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the [SetupIntent](https://stripe.com/docs/api#setup_intent_object) object reference for more details. + */ + retrieve( + id: string, + params?: SetupIntentRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates a SetupIntent object. + */ + update( + id: string, + params?: SetupIntentUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of SetupIntents. + */ + list( + params?: SetupIntentListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action. + * + * Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an error. + */ + cancel( + id: string, + params?: SetupIntentCancelParams, + options?: RequestOptions + ): Promise; + cancel(id: string, options?: RequestOptions): Promise; + + /** + * Confirm that your customer intends to set up the current or + * provided payment method. For example, you would confirm a SetupIntent + * when a customer hits the “Save” button on a payment method management + * page on your website. + * + * If the selected payment method does not require any additional + * steps from the customer, the SetupIntent will transition to the + * succeeded status. + * + * Otherwise, it will transition to the requires_action status and + * suggest additional actions via next_action. If setup fails, + * the SetupIntent will transition to the + * requires_payment_method status. + */ + confirm( + id: string, + params?: SetupIntentConfirmParams, + options?: RequestOptions + ): Promise; + confirm(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Sigma/ScheduledQueryRuns.d.ts b/types/2019-12-03/Sigma/ScheduledQueryRuns.d.ts new file mode 100644 index 0000000000..fff4f37dea --- /dev/null +++ b/types/2019-12-03/Sigma/ScheduledQueryRuns.d.ts @@ -0,0 +1,109 @@ +declare module 'stripe' { + namespace Stripe { + namespace Sigma { + /** + * The ScheduledQueryRun object. + */ + interface ScheduledQueryRun { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'scheduled_query_run'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * When the query was run, Sigma contained a snapshot of your Stripe data at this time. + */ + data_load_time: number; + + error?: ScheduledQueryRun.Error; + + /** + * The file object representing the results of the query. + */ + file: File | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Time at which the result expires and is no longer available for download. + */ + result_available_until: number; + + /** + * SQL for the query. + */ + sql: string; + + /** + * The query's execution status, which will be `completed` for successful runs, and `canceled`, `failed`, or `timed_out` otherwise. + */ + status: string; + + /** + * Title of the query. + */ + title: string; + } + + namespace ScheduledQueryRun { + interface Error { + /** + * Information about the run failure. + */ + message: string; + } + } + + interface ScheduledQueryRunRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ScheduledQueryRunListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ScheduledQueryRunsResource { + /** + * Retrieves the details of an scheduled query run. + */ + retrieve( + id: string, + params?: ScheduledQueryRunRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of scheduled query runs. + */ + list( + params?: ScheduledQueryRunListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } + } +} diff --git a/types/2019-12-03/SourceMandateNotifications.d.ts b/types/2019-12-03/SourceMandateNotifications.d.ts new file mode 100644 index 0000000000..7eb74e3410 --- /dev/null +++ b/types/2019-12-03/SourceMandateNotifications.d.ts @@ -0,0 +1,80 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The SourceMandateNotification object. + */ + interface SourceMandateNotification { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'source_mandate_notification'; + + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount associated with the mandate notification. The amount is expressed in the currency of the underlying source. Required if the notification type is `debit_initiated`. + */ + amount: number | null; + + bacs_debit?: SourceMandateNotification.BacsDebit; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The reason of the mandate notification. Valid reasons are `mandate_confirmed` or `debit_initiated`. + */ + reason: string; + + sepa_debit?: SourceMandateNotification.SepaDebit; + + source: Source; + + /** + * The status of the mandate notification. Valid statuses are `pending` or `submitted`. + */ + status: string; + + /** + * The type of source this mandate notification is attached to. Should be the source type identifier code for the payment method, such as `three_d_secure`. + */ + type: string; + } + + namespace SourceMandateNotification { + interface BacsDebit { + /** + * Last 4 digits of the account number associated with the debit. + */ + last4?: string; + } + + interface SepaDebit { + /** + * SEPA creditor ID. + */ + creditor_identifier?: string; + + /** + * Last 4 digits of the account number associated with the debit. + */ + last4?: string; + + /** + * Mandate reference associated with the debit. + */ + mandate_reference?: string; + } + } + } +} diff --git a/types/2019-12-03/SourceTransactions.d.ts b/types/2019-12-03/SourceTransactions.d.ts new file mode 100644 index 0000000000..6cdd21a503 --- /dev/null +++ b/types/2019-12-03/SourceTransactions.d.ts @@ -0,0 +1,193 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The SourceTransaction object. + */ + interface SourceTransaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'source_transaction'; + + ach_credit_transfer?: SourceTransaction.AchCreditTransfer; + + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount your customer has pushed to the receiver. + */ + amount: number; + + chf_credit_transfer?: SourceTransaction.ChfCreditTransfer; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + gbp_credit_transfer?: SourceTransaction.GbpCreditTransfer; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + paper_check?: SourceTransaction.PaperCheck; + + sepa_credit_transfer?: SourceTransaction.SepaCreditTransfer; + + /** + * The ID of the source this transaction is attached to. + */ + source: string; + + /** + * The status of the transaction, one of `succeeded`, `pending`, or `failed`. + */ + status: string; + + /** + * The type of source this transaction is attached to. + */ + type: SourceTransaction.Type; + } + + namespace SourceTransaction { + interface AchCreditTransfer { + /** + * Customer data associated with the transfer. + */ + customer_data?: string; + + /** + * Bank account fingerprint associated with the transfer. + */ + fingerprint?: string; + + /** + * Last 4 digits of the account number associated with the transfer. + */ + last4?: string; + + /** + * Routing number associated with the transfer. + */ + routing_number?: string; + } + + interface ChfCreditTransfer { + /** + * Reference associated with the transfer. + */ + reference?: string; + + /** + * Sender's country address. + */ + sender_address_country?: string; + + /** + * Sender's line 1 address. + */ + sender_address_line1?: string; + + /** + * Sender's bank account IBAN. + */ + sender_iban?: string; + + /** + * Sender's name. + */ + sender_name?: string; + } + + interface GbpCreditTransfer { + /** + * Bank account fingerprint associated with the transfer. + */ + fingerprint?: string; + + /** + * The credit transfer rails the sender used to push money. The three rails are: Faster Payments, BACS, and CHAPS. + */ + funding_method?: string; + + /** + * Last 4 digits of account number associated with the transfer. + */ + last4?: string; + + /** + * Sender entered arbitrary information about the transfer. + */ + reference?: string; + + /** + * Sender name associated with the transfer. + */ + sender_name?: string; + + /** + * Sort code associated with the transfer. + */ + sort_code?: string; + } + + interface PaperCheck { + /** + * String unix time for the available date. + */ + available_at?: string; + + /** + * Invoice ID associated with the paper check. + */ + invoices?: string; + } + + interface SepaCreditTransfer { + /** + * Reference associated with the transfer. + */ + reference?: string; + + /** + * Sender's bank account IBAN. + */ + sender_iban?: string; + + /** + * Sender's name. + */ + sender_name?: string; + } + + type Type = + | 'ach_credit_transfer' + | 'ach_debit' + | 'alipay' + | 'bancontact' + | 'card' + | 'card_present' + | 'eps' + | 'giropay' + | 'ideal' + | 'klarna' + | 'multibanco' + | 'p24' + | 'sepa_debit' + | 'sofort' + | 'three_d_secure' + | 'wechat'; + } + } +} diff --git a/types/2019-12-03/Sources.d.ts b/types/2019-12-03/Sources.d.ts new file mode 100644 index 0000000000..ef08f4e43d --- /dev/null +++ b/types/2019-12-03/Sources.d.ts @@ -0,0 +1,1359 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Source object. + */ + interface Source { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'source'; + + ach_credit_transfer?: Source.AchCreditTransfer; + + ach_debit?: Source.AchDebit; + + acss_debit?: Source.AcssDebit; + + alipay?: Source.Alipay; + + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for `single_use` sources. + */ + amount: number | null; + + au_becs_debit?: Source.AuBecsDebit; + + bancontact?: Source.Bancontact; + + card?: Source.Card; + + card_present?: Source.CardPresent; + + /** + * The client secret of the source. Used for client-side retrieval using a publishable key. + */ + client_secret: string; + + code_verification?: Source.CodeVerification; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source. This is the currency for which the source will be chargeable once ready. Required for `single_use` sources. + */ + currency: string | null; + + /** + * The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. + */ + customer?: string; + + eps?: Source.Eps; + + /** + * The authentication `flow` of the source. `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. + */ + flow: string; + + giropay?: Source.Giropay; + + ideal?: Source.Ideal; + + klarna?: Source.Klarna; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata | null; + + multibanco?: Source.Multibanco; + + /** + * Information about the owner of the payment instrument that may be used or required by particular source types. + */ + owner: Source.Owner | null; + + p24?: Source.P24; + + receiver?: Source.Receiver; + + redirect?: Source.Redirect; + + sepa_credit_transfer?: Source.SepaCreditTransfer; + + sepa_debit?: Source.SepaDebit; + + sofort?: Source.Sofort; + + source_order?: Source.SourceOrder; + + /** + * Extra information about a source. This will appear on your customer's statement every time you charge the source. + */ + statement_descriptor: string | null; + + /** + * The status of the source, one of `canceled`, `chargeable`, `consumed`, `failed`, or `pending`. Only `chargeable` sources can be used to create a charge. + */ + status: string; + + three_d_secure?: Source.ThreeDSecure; + + /** + * The `type` of the source. The `type` is a payment method, one of `ach_credit_transfer`, `ach_debit`, `alipay`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `multibanco`, `klarna`, `p24`, `sepa_debit`, `sofort`, `three_d_secure`, or `wechat`. An additional hash is included on the source with a name matching this value. It contains additional information specific to the [payment method](https://stripe.com/docs/sources) used. + */ + type: Source.Type; + + /** + * Either `reusable` or `single_use`. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned. + */ + usage: string | null; + + wechat?: Source.Wechat; + } + + namespace Source { + interface AchCreditTransfer { + account_number?: string | null; + + bank_name?: string | null; + + fingerprint?: string | null; + + refund_account_holder_name?: string | null; + + refund_account_holder_type?: string | null; + + refund_routing_number?: string | null; + + routing_number?: string | null; + + swift_code?: string | null; + } + + interface AchDebit { + bank_name?: string | null; + + country?: string | null; + + fingerprint?: string | null; + + last4?: string | null; + + routing_number?: string | null; + + type?: string | null; + } + + interface AcssDebit { + bank_address_city?: string | null; + + bank_address_line_1?: string | null; + + bank_address_line_2?: string | null; + + bank_address_postal_code?: string | null; + + bank_name?: string | null; + + category?: string | null; + + country?: string | null; + + fingerprint?: string | null; + + last4?: string | null; + + routing_number?: string | null; + } + + interface Alipay { + data_string?: string | null; + + native_url?: string | null; + + statement_descriptor?: string | null; + } + + interface AuBecsDebit { + bsb_number?: string | null; + + fingerprint?: string | null; + + last4?: string | null; + } + + interface Bancontact { + bank_code?: string | null; + + bank_name?: string | null; + + bic?: string | null; + + iban_last4?: string | null; + + preferred_language?: string | null; + + statement_descriptor?: string | null; + } + + interface Card { + address_line1_check?: string | null; + + address_zip_check?: string | null; + + brand?: string | null; + + country?: string | null; + + cvc_check?: string | null; + + description?: string; + + dynamic_last4?: string | null; + + exp_month?: number | null; + + exp_year?: number | null; + + fingerprint?: string; + + funding?: string | null; + + iin?: string; + + issuer?: string; + + last4?: string | null; + + name?: string | null; + + three_d_secure?: string; + + tokenization_method?: string | null; + } + + interface CardPresent { + application_cryptogram?: string; + + application_preferred_name?: string; + + authorization_code?: string | null; + + authorization_response_code?: string; + + brand?: string | null; + + country?: string | null; + + cvm_type?: string; + + data_type?: string | null; + + dedicated_file_name?: string; + + description?: string; + + emv_auth_data?: string; + + evidence_customer_signature?: string | null; + + evidence_transaction_certificate?: string | null; + + exp_month?: number | null; + + exp_year?: number | null; + + fingerprint?: string; + + funding?: string | null; + + iin?: string; + + issuer?: string; + + last4?: string | null; + + pos_device_id?: string | null; + + pos_entry_mode?: string; + + read_method?: string | null; + + reader?: string | null; + + terminal_verification_results?: string; + + transaction_status_information?: string; + } + + interface CodeVerification { + /** + * The number of attempts remaining to authenticate the source object with a verification code. + */ + attempts_remaining: number; + + /** + * The status of the code verification, either `pending` (awaiting verification, `attempts_remaining` should be greater than 0), `succeeded` (successful verification) or `failed` (failed verification, cannot be verified anymore as `attempts_remaining` should be 0). + */ + status: string; + } + + interface Eps { + reference?: string | null; + + statement_descriptor?: string | null; + } + + interface Giropay { + bank_code?: string | null; + + bank_name?: string | null; + + bic?: string | null; + + statement_descriptor?: string | null; + } + + interface Ideal { + bank?: string | null; + + bic?: string | null; + + iban_last4?: string | null; + + statement_descriptor?: string | null; + } + + interface Klarna { + background_image_url?: string; + + client_token?: string | null; + + first_name?: string; + + last_name?: string; + + locale?: string; + + logo_url?: string; + + page_title?: string; + + pay_later_asset_urls_descriptive?: string; + + pay_later_asset_urls_standard?: string; + + pay_later_name?: string; + + pay_later_redirect_url?: string; + + pay_now_asset_urls_descriptive?: string; + + pay_now_asset_urls_standard?: string; + + pay_now_name?: string; + + pay_now_redirect_url?: string; + + pay_over_time_asset_urls_descriptive?: string; + + pay_over_time_asset_urls_standard?: string; + + pay_over_time_name?: string; + + pay_over_time_redirect_url?: string; + + payment_method_categories?: string; + + purchase_country?: string; + + purchase_type?: string; + + redirect_url?: string; + + shipping_first_name?: string; + + shipping_last_name?: string; + } + + interface Multibanco { + entity?: string | null; + + reference?: string | null; + + refund_account_holder_address_city?: string | null; + + refund_account_holder_address_country?: string | null; + + refund_account_holder_address_line1?: string | null; + + refund_account_holder_address_line2?: string | null; + + refund_account_holder_address_postal_code?: string | null; + + refund_account_holder_address_state?: string | null; + + refund_account_holder_name?: string | null; + + refund_iban?: string | null; + } + + interface Owner { + /** + * Owner's address. + */ + address: Address | null; + + /** + * Owner's email address. + */ + email: string | null; + + /** + * Owner's full name. + */ + name: string | null; + + /** + * Owner's phone number (including extension). + */ + phone: string | null; + + /** + * Verified owner's address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_address: Address | null; + + /** + * Verified owner's email address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_email: string | null; + + /** + * Verified owner's full name. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_name: string | null; + + /** + * Verified owner's phone number (including extension). Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. + */ + verified_phone: string | null; + } + + interface P24 { + reference?: string | null; + } + + interface Receiver { + /** + * The address of the receiver source. This is the value that should be communicated to the customer to send their funds to. + */ + address: string | null; + + /** + * The total amount that was charged by you. The amount charged is expressed in the source's currency. + */ + amount_charged: number; + + /** + * The total amount received by the receiver source. `amount_received = amount_returned + amount_charged` is true at all time. The amount received is expressed in the source's currency. + */ + amount_received: number; + + /** + * The total amount that was returned to the customer. The amount returned is expressed in the source's currency. + */ + amount_returned: number; + + /** + * Type of refund attribute method, one of `email`, `manual`, or `none`. + */ + refund_attributes_method: string; + + /** + * Type of refund attribute status, one of `missing`, `requested`, or `available`. + */ + refund_attributes_status: string; + } + + interface Redirect { + /** + * The failure reason for the redirect, either `user_abort` (the customer aborted or dropped out of the redirect flow), `declined` (the authentication failed or the transaction was declined), or `processing_error` (the redirect failed due to a technical error). Present only if the redirect status is `failed`. + */ + failure_reason: string | null; + + /** + * The URL you provide to redirect the customer to after they authenticated their payment. + */ + return_url: string; + + /** + * The status of the redirect, either `pending` (ready to be used by your customer to authenticate the transaction), `succeeded` (succesful authentication, cannot be reused) or `not_required` (redirect should not be used) or `failed` (failed authentication, cannot be reused). + */ + status: string; + + /** + * The URL provided to you to redirect a customer to as part of a `redirect` authentication flow. + */ + url: string; + } + + interface SepaCreditTransfer { + bank_name?: string | null; + + bic?: string | null; + + iban?: string | null; + + refund_account_holder_address_city?: string | null; + + refund_account_holder_address_country?: string | null; + + refund_account_holder_address_line1?: string | null; + + refund_account_holder_address_line2?: string | null; + + refund_account_holder_address_postal_code?: string | null; + + refund_account_holder_address_state?: string | null; + + refund_account_holder_name?: string | null; + + refund_iban?: string | null; + } + + interface SepaDebit { + bank_code?: string | null; + + branch_code?: string | null; + + country?: string | null; + + fingerprint?: string | null; + + last4?: string | null; + + mandate_reference?: string | null; + + mandate_url?: string | null; + } + + interface Sofort { + bank_code?: string | null; + + bank_name?: string | null; + + bic?: string | null; + + country?: string | null; + + iban_last4?: string | null; + + preferred_language?: string | null; + + statement_descriptor?: string | null; + } + + interface SourceOrder { + /** + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order. + */ + 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; + + /** + * The email address of the customer placing the order. + */ + email?: string; + + /** + * List of items constituting the order. + */ + items: Array | null; + + shipping?: SourceOrder.Shipping; + } + + namespace SourceOrder { + interface Item { + /** + * The amount (price) for this order item. + */ + amount: number | null; + + /** + * This currency of this order item. Required when `amount` is present. + */ + currency: string | null; + + /** + * Human-readable description for this order item. + */ + description: string | null; + + /** + * The quantity of this order item. When type is `sku`, this is the number of instances of the SKU to be ordered. + */ + quantity?: number; + + /** + * The type of this order item. Must be `sku`, `tax`, or `shipping`. + */ + type: string | null; + } + + interface Shipping { + address?: Address; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string | null; + + /** + * Recipient name. + */ + name?: string | null; + + /** + * Recipient phone (including extension). + */ + phone?: string | null; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string | null; + } + } + + interface ThreeDSecure { + address_line1_check?: string | null; + + address_zip_check?: string | null; + + authenticated?: boolean | null; + + brand?: string | null; + + card?: string | null; + + country?: string | null; + + customer?: string | null; + + cvc_check?: string | null; + + description?: string; + + dynamic_last4?: string | null; + + exp_month?: number | null; + + exp_year?: number | null; + + fingerprint?: string; + + funding?: string | null; + + iin?: string; + + issuer?: string; + + last4?: string | null; + + name?: string | null; + + three_d_secure?: string; + + tokenization_method?: string | null; + } + + type Type = + | 'ach_credit_transfer' + | 'ach_debit' + | 'acss_debit' + | 'alipay' + | 'au_becs_debit' + | 'bancontact' + | 'card' + | 'card_present' + | 'eps' + | 'giropay' + | 'ideal' + | 'klarna' + | 'multibanco' + | 'p24' + | 'sepa_credit_transfer' + | 'sepa_debit' + | 'sofort' + | 'three_d_secure' + | 'wechat'; + + interface Wechat { + prepay_id?: string; + + qr_code_url?: string | null; + + statement_descriptor?: string; + } + } + + interface SourceCreateParams { + /** + * Amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for `single_use` sources. Not supported for `receiver` type sources, where charge amount may not be specified until funds land. + */ + amount?: number; + + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source. This is the currency for which the source will be chargeable once ready. + */ + currency?: string; + + /** + * The `Customer` to whom the original source is attached to. Must be set when the original source is not a `Source` (e.g., `Card`). + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The authentication `flow` of the source to create. `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. It is generally inferred unless a type supports multiple flows. + */ + flow?: SourceCreateParams.Flow; + + /** + * Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. + */ + mandate?: SourceCreateParams.Mandate; + + /** + * A set of key-value pairs that you can attach to a source object. It can be useful for storing additional information about the source in a structured format. + */ + metadata?: MetadataParam; + + /** + * The source to share. + */ + original_source?: string; + + /** + * Information about the owner of the payment instrument that may be used or required by particular source types. + */ + owner?: SourceCreateParams.Owner; + + /** + * Optional parameters for the receiver flow. Can be set only if the source is a receiver (`flow` is `receiver`). + */ + receiver?: SourceCreateParams.Receiver; + + /** + * Parameters required for the redirect flow. Required if the source is authenticated by a redirect (`flow` is `redirect`). + */ + redirect?: SourceCreateParams.Redirect; + + /** + * Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it. + */ + source_order?: SourceCreateParams.SourceOrder; + + /** + * An arbitrary string to be displayed on your customer's statement. As an example, if your website is `RunClub` and the item you're charging for is a race ticket, you may want to specify a `statement_descriptor` of `RunClub 5K race ticket.` While many payment types will display this information, some may not display it at all. + */ + statement_descriptor?: string; + + /** + * An optional token used to create the source. When passed, token properties will override source parameters. + */ + token?: string; + + /** + * The `type` of the source to create. Required unless `customer` and `original_source` are specified (see the [Cloning card Sources](https://stripe.com/docs/sources/connect#cloning-card-sources) guide) + */ + type?: string; + + usage?: SourceCreateParams.Usage; + } + + namespace SourceCreateParams { + type Flow = 'code_verification' | 'none' | 'receiver' | 'redirect'; + + interface Mandate { + /** + * The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. + */ + acceptance?: Mandate.Acceptance; + + /** + * The amount specified by the mandate. (Leave null for a mandate covering all amounts) + */ + amount?: number | ''; + + /** + * The currency specified by the mandate. (Must match `currency` of the source) + */ + currency?: string; + + /** + * The interval of debits permitted by the mandate. Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency) + */ + interval?: Mandate.Interval; + + /** + * The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification). + */ + notification_method?: Mandate.NotificationMethod; + } + + namespace Mandate { + interface Acceptance { + /** + * The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. + */ + date?: number; + + /** + * The IP address from which the mandate was accepted or refused by the customer. + */ + ip?: string; + + /** + * The parameters required to store a mandate accepted offline. Should only be set if `mandate[type]` is `offline` + */ + offline?: Acceptance.Offline; + + /** + * The parameters required to store a mandate accepted online. Should only be set if `mandate[type]` is `online` + */ + online?: Acceptance.Online; + + /** + * The status of the mandate acceptance. Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). + */ + status: Acceptance.Status; + + /** + * The type of acceptance information included with the mandate. Either `online` or `offline` + */ + type?: Acceptance.Type; + + /** + * The user agent of the browser from which the mandate was accepted or refused by the customer. + */ + user_agent?: string; + } + + namespace Acceptance { + interface Offline { + /** + * An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. + */ + contact_email: string; + } + + interface Online { + /** + * The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. + */ + date?: number; + + /** + * The IP address from which the mandate was accepted or refused by the customer. + */ + ip?: string; + + /** + * The user agent of the browser from which the mandate was accepted or refused by the customer. + */ + user_agent?: string; + } + + type Status = 'accepted' | 'pending' | 'refused' | 'revoked'; + + type Type = 'offline' | 'online'; + } + + type Interval = 'one_time' | 'scheduled' | 'variable'; + + type NotificationMethod = + | 'deprecated_none' + | 'email' + | 'manual' + | 'none' + | 'stripe_email'; + } + + interface Owner { + /** + * Owner's address. + */ + address?: Owner.Address; + + /** + * Owner's email address. + */ + email?: string; + + /** + * Owner's full name. + */ + name?: string; + + /** + * Owner's phone number. + */ + phone?: string; + } + + namespace Owner { + interface Address { + city?: string; + + country?: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + + interface Receiver { + /** + * The method Stripe should use to request information needed to process a refund or mispayment. Either `email` (an email is sent directly to the customer) or `manual` (a `source.refund_attributes_required` event is sent to your webhooks endpoint). Refer to each payment method's documentation to learn which refund attributes may be required. + */ + refund_attributes_method?: Receiver.RefundAttributesMethod; + } + + namespace Receiver { + type RefundAttributesMethod = 'email' | 'manual' | 'none'; + } + + interface Redirect { + /** + * The URL you provide to redirect the customer back to you after they authenticated their payment. It can use your application URI scheme in the context of a mobile application. + */ + return_url: string; + } + + interface SourceOrder { + /** + * List of items constituting the order. + */ + items?: Array; + + /** + * Shipping address for the order. Required if any of the SKUs are for products that have `shippable` set to true. + */ + shipping?: SourceOrder.Shipping; + } + + namespace SourceOrder { + interface Item { + amount?: number; + + currency?: string; + + description?: string; + + /** + * The ID of the SKU being ordered. + */ + parent?: string; + + /** + * The quantity of this order item. When type is `sku`, this is the number of instances of the SKU to be ordered. + */ + quantity?: number; + + type?: Item.Type; + } + + namespace Item { + type Type = 'discount' | 'shipping' | 'sku' | 'tax'; + } + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name?: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + } + + type Usage = 'reusable' | 'single_use'; + } + + interface SourceRetrieveParams { + /** + * The client secret of the source. Required if a publishable key is used to retrieve the source. + */ + client_secret?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SourceUpdateParams { + /** + * Amount associated with the source. + */ + amount?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. + */ + mandate?: SourceUpdateParams.Mandate; + + /** + * A set of key-value pairs that you can attach to a source object. It can be useful for storing additional information about the source in a structured format. + */ + metadata?: MetadataParam; + + /** + * Information about the owner of the payment instrument that may be used or required by particular source types. + */ + owner?: SourceUpdateParams.Owner; + + /** + * Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it. + */ + source_order?: SourceUpdateParams.SourceOrder; + } + + namespace SourceUpdateParams { + interface Mandate { + /** + * The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. + */ + acceptance?: Mandate.Acceptance; + + /** + * The amount specified by the mandate. (Leave null for a mandate covering all amounts) + */ + amount?: number | ''; + + /** + * The currency specified by the mandate. (Must match `currency` of the source) + */ + currency?: string; + + /** + * The interval of debits permitted by the mandate. Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency) + */ + interval?: Mandate.Interval; + + /** + * The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification). + */ + notification_method?: Mandate.NotificationMethod; + } + + namespace Mandate { + interface Acceptance { + /** + * The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. + */ + date?: number; + + /** + * The IP address from which the mandate was accepted or refused by the customer. + */ + ip?: string; + + /** + * The parameters required to store a mandate accepted offline. Should only be set if `mandate[type]` is `offline` + */ + offline?: Acceptance.Offline; + + /** + * The parameters required to store a mandate accepted online. Should only be set if `mandate[type]` is `online` + */ + online?: Acceptance.Online; + + /** + * The status of the mandate acceptance. Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). + */ + status: Acceptance.Status; + + /** + * The type of acceptance information included with the mandate. Either `online` or `offline` + */ + type?: Acceptance.Type; + + /** + * The user agent of the browser from which the mandate was accepted or refused by the customer. + */ + user_agent?: string; + } + + namespace Acceptance { + interface Offline { + /** + * An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. + */ + contact_email: string; + } + + interface Online { + /** + * The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. + */ + date?: number; + + /** + * The IP address from which the mandate was accepted or refused by the customer. + */ + ip?: string; + + /** + * The user agent of the browser from which the mandate was accepted or refused by the customer. + */ + user_agent?: string; + } + + type Status = 'accepted' | 'pending' | 'refused' | 'revoked'; + + type Type = 'offline' | 'online'; + } + + type Interval = 'one_time' | 'scheduled' | 'variable'; + + type NotificationMethod = + | 'deprecated_none' + | 'email' + | 'manual' + | 'none' + | 'stripe_email'; + } + + interface Owner { + /** + * Owner's address. + */ + address?: Owner.Address; + + /** + * Owner's email address. + */ + email?: string; + + /** + * Owner's full name. + */ + name?: string; + + /** + * Owner's phone number. + */ + phone?: string; + } + + namespace Owner { + interface Address { + city?: string; + + country?: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + + interface SourceOrder { + /** + * List of items constituting the order. + */ + items?: Array; + + /** + * Shipping address for the order. Required if any of the SKUs are for products that have `shippable` set to true. + */ + shipping?: SourceOrder.Shipping; + } + + namespace SourceOrder { + interface Item { + amount?: number; + + currency?: string; + + description?: string; + + /** + * The ID of the SKU being ordered. + */ + parent?: string; + + /** + * The quantity of this order item. When type is `sku`, this is the number of instances of the SKU to be ordered. + */ + quantity?: number; + + type?: Item.Type; + } + + namespace Item { + type Type = 'discount' | 'shipping' | 'sku' | 'tax'; + } + + interface Shipping { + /** + * Shipping address. + */ + address: AddressParam; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier?: string; + + /** + * Recipient name. + */ + name?: string; + + /** + * Recipient phone (including extension). + */ + phone?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number?: string; + } + } + } + + interface SourceListSourceTransactionsParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SourceVerifyParams { + /** + * The values needed to verify the source. + */ + values: Array; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class SourcesResource { + /** + * Creates a new source object. + */ + create( + params?: SourceCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information. + */ + retrieve( + id: string, + params?: SourceRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * + * This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail. + */ + update( + id: string, + params?: SourceUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * List source transactions for a given source. + */ + listSourceTransactions( + id: string, + params?: SourceListSourceTransactionsParams, + options?: RequestOptions + ): ApiListPromise; + listSourceTransactions( + id: string, + options?: RequestOptions + ): ApiListPromise; + + /** + * Verify a given source. + */ + verify( + id: string, + params: SourceVerifyParams, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/SubscriptionItems.d.ts b/types/2019-12-03/SubscriptionItems.d.ts new file mode 100644 index 0000000000..8a06178831 --- /dev/null +++ b/types/2019-12-03/SubscriptionItems.d.ts @@ -0,0 +1,315 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The SubscriptionItem object. + */ + interface SubscriptionItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'subscription_item'; + + /** + * Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period + */ + billing_thresholds: SubscriptionItem.BillingThresholds | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + deleted?: void; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + plan: Plan; + + /** + * The [quantity](https://stripe.com/docs/subscriptions/quantities) of the plan to which the customer should be subscribed. + */ + quantity?: number; + + /** + * The `subscription` this `subscription_item` belongs to. + */ + subscription: string; + + /** + * The tax rates which apply to this `subscription_item`. When set, the `default_tax_rates` on the subscription do not apply to this `subscription_item`. + */ + tax_rates: Array | null; + } + + namespace SubscriptionItem { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to create an invoice + */ + usage_gte: number | null; + } + } + + /** + * The DeletedSubscriptionItem object. + */ + interface DeletedSubscriptionItem { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'subscription_item'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface SubscriptionItemCreateParams { + /** + * The identifier of the plan to add to the subscription. + */ + plan: string; + + /** + * The identifier of the subscription to modify. + */ + subscription: string; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: SubscriptionItemCreateParams.BillingThresholds | null; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Use `allow_incomplete` to create subscriptions with `status=incomplete` if the first invoice cannot be paid. Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. + * + * 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. + */ + payment_behavior?: SubscriptionItemCreateParams.PaymentBehavior; + + /** + * Flag indicating whether to [prorate](https://stripe.com/docs/billing/subscriptions/prorations) switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](#retrieve_customer_invoice) endpoint. + */ + proration_date?: number; + + /** + * The quantity you'd like to apply to the subscription item you're creating. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace SubscriptionItemCreateParams { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + + type PaymentBehavior = + | 'allow_incomplete' + | 'error_if_incomplete' + | 'pending_if_incomplete'; + } + + interface SubscriptionItemRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SubscriptionItemUpdateParams { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: SubscriptionItemUpdateParams.BillingThresholds | null; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + off_session?: boolean; + + /** + * Use `allow_incomplete` to create subscriptions with `status=incomplete` if the first invoice cannot be paid. Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. + * + * 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. + */ + payment_behavior?: SubscriptionItemUpdateParams.PaymentBehavior; + + /** + * The identifier of the new plan for this subscription item. + */ + plan?: string; + + /** + * Flag indicating whether to [prorate](https://stripe.com/docs/billing/subscriptions/prorations) switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](#retrieve_customer_invoice) endpoint. + */ + proration_date?: number; + + /** + * The quantity you'd like to apply to the subscription item you're creating. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace SubscriptionItemUpdateParams { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + + type PaymentBehavior = + | 'allow_incomplete' + | 'error_if_incomplete' + | 'pending_if_incomplete'; + } + + interface SubscriptionItemListParams extends PaginationParams { + /** + * The ID of the subscription whose items will be retrieved. + */ + subscription: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SubscriptionItemDeleteParams { + /** + * Delete all usage for the given subscription item. Allowed only when the current plan's `usage_type` is `metered`. + */ + clear_usage?: boolean; + + /** + * Flag indicating whether to [prorate](https://stripe.com/docs/billing/subscriptions/prorations) switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](#retrieve_customer_invoice) endpoint. + */ + proration_date?: number; + } + + class SubscriptionItemsResource { + /** + * Adds a new item to an existing subscription. No existing items will be changed or replaced. + */ + create( + params: SubscriptionItemCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the invoice item with the given ID. + */ + retrieve( + id: string, + params?: SubscriptionItemRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the plan or quantity of an item on a current subscription. + */ + update( + id: string, + params?: SubscriptionItemUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your subscription items for a given subscription. + */ + list( + params: SubscriptionItemListParams, + options?: RequestOptions + ): ApiListPromise; + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription. + */ + del( + id: string, + params?: SubscriptionItemDeleteParams, + options?: RequestOptions + ): Promise; + del( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Creates a usage record for a specified subscription item and date, and fills it with a quantity. + * + * Usage records provide quantity information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the [metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) plan, Stripe helps you send accurate invoices to your customers. + * + * The default calculation for usage is to add up all the quantity values of the usage records within a billing period. You can change this default behavior with the billing plan's aggregate_usage [parameter](https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage). When there is more than one usage record with the same timestamp, Stripe adds the quantity values together. In most cases, this is the desired resolution, however, you can change this behavior with the action parameter. + * + * The default pricing model for metered billing is [per-unit pricing. For finer granularity, you can configure metered billing to have a tiered pricing](https://stripe.com/docs/api/plans/object#plan_object-billing_scheme) model. + */ + createUsageRecord( + id: string, + params: UsageRecordCreateParams, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/SubscriptionSchedules.d.ts b/types/2019-12-03/SubscriptionSchedules.d.ts new file mode 100644 index 0000000000..3c4cde57de --- /dev/null +++ b/types/2019-12-03/SubscriptionSchedules.d.ts @@ -0,0 +1,829 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The SubscriptionSchedule object. + */ + interface SubscriptionSchedule { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'subscription_schedule'; + + /** + * Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. + */ + canceled_at: number | null; + + /** + * Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. + */ + completed_at: number | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. + */ + current_phase: SubscriptionSchedule.CurrentPhase | null; + + /** + * ID of the customer who owns the subscription schedule. + */ + customer: string | Customer | DeletedCustomer; + + default_settings: SubscriptionSchedule.DefaultSettings; + + /** + * Behavior of the subscription schedule and underlying subscription when it ends. + */ + end_behavior: SubscriptionSchedule.EndBehavior; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata | null; + + /** + * Configuration for the subscription schedule's phases. + */ + phases: Array; + + /** + * Time at which the subscription schedule was released. Measured in seconds since the Unix epoch. + */ + released_at: number | null; + + /** + * ID of the subscription once managed by the subscription schedule (if it is released). + */ + released_subscription: string | null; + + /** + * This field has been deprecated. Interval and duration at which the subscription schedule renews for when it ends if `renewal_behavior` is `renew`. + */ + renewal_interval: SubscriptionSchedule.RenewalInterval | null; + + /** + * The present status of the subscription schedule. Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules). + */ + status: SubscriptionSchedule.Status; + + /** + * ID of the subscription managed by the subscription schedule. + */ + subscription: string | Subscription | null; + } + + namespace SubscriptionSchedule { + interface CurrentPhase { + end_date: number; + + start_date: number; + } + + interface DefaultSettings { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period + */ + billing_thresholds: DefaultSettings.BillingThresholds | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. + */ + collection_method: DefaultSettings.CollectionMethod | null; + + /** + * ID of the default payment method for the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method: string | PaymentMethod | null; + + /** + * The subscription schedule's default invoice settings. + */ + invoice_settings: DefaultSettings.InvoiceSettings | null; + } + + namespace DefaultSettings { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to create an invoice + */ + amount_gte: number | null; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`. + */ + reset_billing_cycle_anchor: boolean | null; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + /** + * Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. + */ + days_until_due: number | null; + } + } + + type EndBehavior = 'cancel' | 'none' | 'release' | 'renew'; + + interface Phase { + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account during this phase of the schedule. + */ + application_fee_percent: number | null; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period + */ + billing_thresholds: Phase.BillingThresholds | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. + */ + collection_method: Phase.CollectionMethod | null; + + /** + * ID of the coupon to use during this phase of the subscription schedule. + */ + coupon: string | Coupon | DeletedCoupon | null; + + /** + * ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method: string | PaymentMethod | null; + + default_tax_rates?: Array | null; + + /** + * The end of this phase of the subscription schedule. + */ + end_date: number; + + /** + * The subscription schedule's default invoice settings. + */ + invoice_settings: Phase.InvoiceSettings | null; + + /** + * Plans to subscribe during this phase of the subscription schedule. + */ + plans: Array; + + /** + * The start of this phase of the subscription schedule. + */ + start_date: number; + + /** + * If provided, each invoice created during this phase of the subscription schedule will apply the tax rate, increasing the amount billed to the customer. + */ + tax_percent: number | null; + + /** + * When the trial ends within the phase. + */ + trial_end: number | null; + } + + namespace Phase { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to create an invoice + */ + amount_gte: number | null; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`. + */ + reset_billing_cycle_anchor: boolean | null; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + /** + * Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. + */ + days_until_due: number | null; + } + + interface Plan { + /** + * Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period + */ + billing_thresholds: Plan.BillingThresholds | null; + + /** + * ID of the plan to which the customer should be subscribed. + */ + plan: string | Plan | DeletedPlan; + + /** + * Quantity of the plan to which the customer should be subscribed. + */ + quantity: number | null; + + /** + * The tax rates which apply to this `phase_item`. When set, the `default_tax_rates` on the phase do not apply to this `phase_item`. + */ + tax_rates?: Array | null; + } + + namespace Plan { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to create an invoice + */ + usage_gte: number | null; + } + } + } + + interface RenewalInterval { + /** + * Interval at which to renew the subscription schedule for when it ends. + */ + interval: RenewalInterval.Interval; + + /** + * Number of intervals to renew the subscription schedule for when it ends. + */ + length: number; + } + + namespace RenewalInterval { + type Interval = 'day' | 'month' | 'week' | 'year'; + } + + type Status = + | 'active' + | 'canceled' + | 'completed' + | 'not_started' + | 'released'; + } + + interface SubscriptionScheduleCreateParams { + /** + * The identifier of the customer to create the subscription schedule for. + */ + customer?: string; + + /** + * Object representing the subscription schedule's default settings. + */ + default_settings?: SubscriptionScheduleCreateParams.DefaultSettings; + + /** + * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + */ + end_behavior?: SubscriptionScheduleCreateParams.EndBehavior; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Migrate an existing subscription to be managed by a subscription schedule. If this parameter is set, a subscription schedule will be created using the subscription's plan(s), set to auto-renew using the subscription's interval. When using this parameter, other parameters (such as phase values) cannot be set. To create a subscription schedule with other modifications, we recommend making two separate API calls. + */ + from_subscription?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. + */ + phases?: Array; + + /** + * When the subscription schedule starts. We recommend using `now` so that it starts the subscription immediately. You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. When you backdate, the `billing_cycle_anchor` of the subscription is equivalent to the `start_date`. + */ + start_date?: number | 'now'; + } + + namespace SubscriptionScheduleCreateParams { + interface DefaultSettings { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: DefaultSettings.BillingThresholds | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to `charge_automatically` on creation. + */ + collection_method?: DefaultSettings.CollectionMethod; + + /** + * ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * All invoices will be billed using the specified settings. + */ + invoice_settings?: DefaultSettings.InvoiceSettings; + } + + namespace DefaultSettings { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to advance to a new billing period + */ + amount_gte?: number; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + */ + reset_billing_cycle_anchor?: boolean; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + days_until_due?: number; + } + } + + type EndBehavior = 'cancel' | 'none' | 'release' | 'renew'; + + interface Phase { + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). + */ + application_fee_percent?: number; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: Phase.BillingThresholds | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to `charge_automatically` on creation. + */ + collection_method?: Phase.CollectionMethod; + + /** + * The identifier of the coupon to apply to this phase of the subscription schedule. + */ + coupon?: string; + + /** + * ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase. When updating, pass an empty string to remove previously-defined tax rates. + */ + default_tax_rates?: Array | ''; + + /** + * The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. + */ + end_date?: number; + + /** + * All invoices will be billed using the specified settings. + */ + invoice_settings?: Phase.InvoiceSettings; + + /** + * Integer representing the multiplier applied to the plan interval. For example, `iterations=2` applied to a plan with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + */ + iterations?: number; + + /** + * List of configuration items, each with an attached plan, to apply during this phase of the subscription schedule. + */ + plans: Array; + + /** + * A non-negative decimal (with at most four decimal places) between 0 and 100. This represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount in each billing period during thise phase of the schedule. For example, a plan which charges $10/month with a `tax_percent` of `20.0` will charge $12 per invoice. To unset a previously-set value, pass an empty string. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + tax_percent?: number; + + /** + * If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. + */ + trial?: boolean; + + /** + * Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial` + */ + trial_end?: number; + } + + namespace Phase { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to advance to a new billing period + */ + amount_gte?: number; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + */ + reset_billing_cycle_anchor?: boolean; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + days_until_due?: number; + } + + interface Plan { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: Plan.BillingThresholds | null; + + /** + * The plan ID to subscribe to. + */ + plan: string; + + /** + * Quantity for the given plan. Can be set only if the plan's `usage_type` is `licensed` and not `metered`. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace Plan { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + } + } + } + + interface SubscriptionScheduleRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SubscriptionScheduleUpdateParams { + /** + * Object representing the subscription schedule's default settings. + */ + default_settings?: SubscriptionScheduleUpdateParams.DefaultSettings; + + /** + * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + */ + end_behavior?: SubscriptionScheduleUpdateParams.EndBehavior; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. Note that past phases can be omitted. + */ + phases?: Array; + + /** + * If the update changes the current phase, indicates if the changes should be prorated. Defaults to `true`. + */ + prorate?: boolean; + } + + namespace SubscriptionScheduleUpdateParams { + interface DefaultSettings { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: DefaultSettings.BillingThresholds | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to `charge_automatically` on creation. + */ + collection_method?: DefaultSettings.CollectionMethod; + + /** + * ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * All invoices will be billed using the specified settings. + */ + invoice_settings?: DefaultSettings.InvoiceSettings; + } + + namespace DefaultSettings { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to advance to a new billing period + */ + amount_gte?: number; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + */ + reset_billing_cycle_anchor?: boolean; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + days_until_due?: number; + } + } + + type EndBehavior = 'cancel' | 'none' | 'release' | 'renew'; + + interface Phase { + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). + */ + application_fee_percent?: number; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: Phase.BillingThresholds | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to `charge_automatically` on creation. + */ + collection_method?: Phase.CollectionMethod; + + /** + * The identifier of the coupon to apply to this phase of the subscription schedule. + */ + coupon?: string; + + /** + * ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase. When updating, pass an empty string to remove previously-defined tax rates. + */ + default_tax_rates?: Array | ''; + + /** + * The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. + */ + end_date?: number | 'now'; + + /** + * All invoices will be billed using the specified settings. + */ + invoice_settings?: Phase.InvoiceSettings; + + /** + * Integer representing the multiplier applied to the plan interval. For example, `iterations=2` applied to a plan with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + */ + iterations?: number; + + /** + * List of configuration items, each with an attached plan, to apply during this phase of the subscription schedule. + */ + plans: Array; + + /** + * The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase. + */ + start_date?: number | 'now'; + + /** + * A non-negative decimal (with at most four decimal places) between 0 and 100. This represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount in each billing period during thise phase of the schedule. For example, a plan which charges $10/month with a `tax_percent` of `20.0` will charge $12 per invoice. To unset a previously-set value, pass an empty string. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + tax_percent?: number; + + /** + * If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. + */ + trial?: boolean; + + /** + * Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial` + */ + trial_end?: number | 'now'; + } + + namespace Phase { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to advance to a new billing period + */ + amount_gte?: number; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + */ + reset_billing_cycle_anchor?: boolean; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + days_until_due?: number; + } + + interface Plan { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: Plan.BillingThresholds | null; + + /** + * The plan ID to subscribe to. + */ + plan: string; + + /** + * Quantity for the given plan. Can be set only if the plan's `usage_type` is `licensed` and not `metered`. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace Plan { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + } + } + } + + interface SubscriptionScheduleListParams extends PaginationParams { + /** + * Only return subscription schedules that were created canceled the given date interval. + */ + canceled_at?: RangeQueryParam | number; + + /** + * Only return subscription schedules that completed during the given date interval. + */ + completed_at?: RangeQueryParam | number; + + /** + * Only return subscription schedules that were created during the given date interval. + */ + created?: RangeQueryParam | number; + + /** + * Only return subscription schedules for the given customer. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return subscription schedules that were released during the given date interval. + */ + released_at?: RangeQueryParam | number; + + /** + * Only return subscription schedules that have not started yet. + */ + scheduled?: boolean; + } + + interface SubscriptionScheduleCancelParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * If the subscription schedule is `active`, indicates whether or not to generate a final invoice that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to `true`. + */ + invoice_now?: boolean; + + /** + * If the subscription schedule is `active`, indicates if the cancellation should be prorated. Defaults to `true`. + */ + prorate?: boolean; + } + + interface SubscriptionScheduleReleaseParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Keep any cancellation on the subscription that the schedule has set + */ + preserve_cancel_date?: boolean; + } + + class SubscriptionSchedulesResource { + /** + * Creates a new subscription schedule object. + */ + create( + params?: SubscriptionScheduleCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the details of an existing subscription schedule. You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation. + */ + retrieve( + id: string, + params?: SubscriptionScheduleRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates an existing subscription schedule. + */ + update( + id: string, + params?: SubscriptionScheduleUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the list of your subscription schedules. + */ + list( + params?: SubscriptionScheduleListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active. + */ + cancel( + id: string, + params?: SubscriptionScheduleCancelParams, + options?: RequestOptions + ): Promise; + cancel( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property. + */ + release( + id: string, + params?: SubscriptionScheduleReleaseParams, + options?: RequestOptions + ): Promise; + release( + id: string, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/Subscriptions.d.ts b/types/2019-12-03/Subscriptions.d.ts new file mode 100644 index 0000000000..74595d6720 --- /dev/null +++ b/types/2019-12-03/Subscriptions.d.ts @@ -0,0 +1,803 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Subscription object. + */ + interface Subscription { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'subscription'; + + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. + */ + application_fee_percent: number | null; + + /** + * Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. + */ + billing_cycle_anchor: number; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period + */ + billing_thresholds: Subscription.BillingThresholds | null; + + /** + * A date in the future at which the subscription will automatically get canceled + */ + cancel_at: number | null; + + /** + * If the subscription has been canceled with the `at_period_end` flag set to `true`, `cancel_at_period_end` on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period. + */ + cancel_at_period_end: boolean; + + /** + * If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will still reflect the date of the initial cancellation request, not the end of the subscription period when the subscription is automatically moved to a canceled state. + */ + canceled_at: number | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. + */ + collection_method: Subscription.CollectionMethod | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. + */ + current_period_end: number; + + /** + * Start of the current period that the subscription has been invoiced for. + */ + current_period_start: number; + + /** + * ID of the customer who owns the subscription. + */ + customer: string | Customer | DeletedCustomer; + + /** + * Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`. + */ + days_until_due: number | null; + + /** + * ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method: string | PaymentMethod | null; + + /** + * ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If not set, defaults to the customer's default source. + */ + default_source: string | CustomerSource | null; + + /** + * 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 | null; + + /** + * Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis. + */ + discount: Discount | null; + + /** + * If the subscription has ended, the date the subscription ended. + */ + ended_at: number | null; + + /** + * List of subscription items, each with an attached plan. + */ + items: ApiList; + + /** + * The most recent invoice this subscription has generated. + */ + latest_invoice: string | Invoice | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`. + */ + next_pending_invoice_item_invoice: number | null; + + /** + * Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. + */ + pending_invoice_item_interval: Subscription.PendingInvoiceItemInterval | null; + + /** + * You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2). + */ + pending_setup_intent: string | SetupIntent | null; + + /** + * Hash describing the plan the customer is subscribed to. Only set if the subscription contains a single plan. + */ + plan: Plan | null; + + /** + * The quantity of the plan to which the customer is subscribed. For example, if your plan is $10/user/month, and your customer has 5 users, you could pass 5 as the quantity to have the customer charged $50 (5 x $10) monthly. Only set if the subscription contains a single plan. + */ + quantity: number | null; + + /** + * The schedule attached to the subscription + */ + schedule: string | SubscriptionSchedule | null; + + /** + * Date when the subscription was first created. The date might differ from the `created` date due to backdating. + */ + start_date: number; + + /** + * Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, or `unpaid`. + * + * For `collection_method=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` state. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal state, the open invoice will be voided and no further invoices will be generated. + * + * A subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over. + * + * If subscription `collection_method=charge_automatically` it becomes `past_due` when payment to renew it fails and `canceled` or `unpaid` (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts. + * + * If subscription `collection_method=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices. + */ + status: Subscription.Status; + + /** + * If provided, each invoice created by this subscription will apply the tax rate, increasing the amount billed to the customer. + */ + tax_percent: number | null; + + /** + * If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. + */ + transfer_data?: Subscription.TransferData | null; + + /** + * If the subscription has a trial, the end of that trial. + */ + trial_end: number | null; + + /** + * If the subscription has a trial, the beginning of that trial. + */ + trial_start: number | null; + } + + namespace Subscription { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to create an invoice + */ + amount_gte: number | null; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`. + */ + reset_billing_cycle_anchor: boolean | null; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface PendingInvoiceItemInterval { + /** + * Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. + */ + interval: PendingInvoiceItemInterval.Interval; + + /** + * The number of intervals between invoices. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). + */ + interval_count: number; + } + + namespace PendingInvoiceItemInterval { + type Interval = 'day' | 'month' | 'week' | 'year'; + } + + type Status = + | 'active' + | 'canceled' + | 'incomplete' + | 'incomplete_expired' + | 'past_due' + | 'trialing' + | 'unpaid'; + + interface TransferData { + /** + * The account (if any) where funds from the payment will be transferred to upon payment success. + */ + destination: string | Account; + } + } + + interface SubscriptionCreateParams { + /** + * The identifier of the customer to subscribe. + */ + customer: string; + + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). + */ + application_fee_percent?: number; + + /** + * For new subscriptions, a past timestamp to backdate the subscription's start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor. + */ + backdate_start_date?: number; + + /** + * A future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. + */ + billing_cycle_anchor?: number; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: SubscriptionCreateParams.BillingThresholds | null; + + /** + * A timestamp at which the subscription should cancel. If set to a date before the current period ends this will cause a proration if `prorate=true`. + */ + cancel_at?: number; + + /** + * Boolean indicating whether this subscription should cancel at the end of the current period. + */ + cancel_at_period_end?: boolean; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to `charge_automatically`. + */ + collection_method?: SubscriptionCreateParams.CollectionMethod; + + /** + * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that particular subscription. + */ + coupon?: string; + + /** + * Number of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where `collection_method` is set to `send_invoice`. + */ + days_until_due?: number; + + /** + * ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If not set, defaults to the customer's default source. + */ + default_source?: string; + + /** + * 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 | ''; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * List of subscription items, each with an attached plan. + */ + items?: Array; + + /** + * A set of key-value pairs that you can attach to a `Subscription` object. It can be useful for storing additional information about the subscription in a structured format. + */ + metadata?: MetadataParam; + + /** + * Indicates if a customer is on or off-session while an invoice payment is attempted. + */ + off_session?: boolean; + + /** + * Use `allow_incomplete` to create subscriptions with `status=incomplete` if the first invoice cannot be paid. Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. + * + * 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. + */ + payment_behavior?: SubscriptionCreateParams.PaymentBehavior; + + /** + * Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. + */ + pending_invoice_item_interval?: SubscriptionCreateParams.PendingInvoiceItemInterval | null; + + /** + * Boolean (defaults to `true`) telling us whether to [credit for unused time](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g. when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. If `false`, the anchor period will be free (similar to a trial) and no proration adjustments will be created. + */ + prorate?: boolean; + + /** + * A non-negative decimal (with at most four decimal places) between 0 and 100. This represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount in each billing period. For example, a plan which charges $10/month with a `tax_percent` of `20.0` will charge $12 per invoice. To unset a previously-set value, pass an empty string. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + tax_percent?: number | ''; + + /** + * If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value. + */ + transfer_data?: SubscriptionCreateParams.TransferData; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. + */ + trial_end?: 'now' | number; + + /** + * Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. + */ + trial_from_plan?: boolean; + + /** + * Integer representing the number of trial period days before the customer is charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. + */ + trial_period_days?: number; + } + + namespace SubscriptionCreateParams { + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to advance to a new billing period + */ + amount_gte?: number; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + */ + reset_billing_cycle_anchor?: boolean; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface Item { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: Item.BillingThresholds | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Plan ID for this item, as a string. + */ + plan: string; + + /** + * Quantity for this item. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace Item { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + } + + type PaymentBehavior = + | 'allow_incomplete' + | 'error_if_incomplete' + | 'pending_if_incomplete'; + + interface PendingInvoiceItemInterval { + /** + * Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. + */ + interval: PendingInvoiceItemInterval.Interval; + + /** + * The number of intervals between invoices. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). + */ + interval_count?: number; + } + + namespace PendingInvoiceItemInterval { + type Interval = 'day' | 'month' | 'week' | 'year'; + } + + interface TransferData { + /** + * ID of an existing, connected Stripe account. + */ + destination: string; + } + } + + interface SubscriptionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface SubscriptionUpdateParams { + /** + * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). + */ + application_fee_percent?: number; + + /** + * Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + */ + billing_cycle_anchor?: SubscriptionUpdateParams.BillingCycleAnchor; + + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: SubscriptionUpdateParams.BillingThresholds | null; + + /** + * A timestamp at which the subscription should cancel. If set to a date before the current period ends this will cause a proration if `prorate=true`. + */ + cancel_at?: number | ''; + + /** + * Boolean indicating whether this subscription should cancel at the end of the current period. + */ + cancel_at_period_end?: boolean; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to `charge_automatically`. + */ + collection_method?: SubscriptionUpdateParams.CollectionMethod; + + /** + * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that particular subscription. + */ + coupon?: string; + + /** + * Number of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where `collection_method` is set to `send_invoice`. + */ + days_until_due?: number; + + /** + * ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. If not set, invoices will use the default payment method in the customer's invoice settings. + */ + default_payment_method?: string; + + /** + * ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If not set, defaults to the customer's default source. + */ + default_source?: string; + + /** + * 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. Pass an empty string to remove previously-defined tax rates. + */ + default_tax_rates?: Array | ''; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * List of subscription items, each with an attached plan. + */ + items?: Array; + + /** + * A set of key-value pairs that you can attach to a subscription object. This can be useful for storing additional information about the subscription in a structured format. + */ + metadata?: MetadataParam; + + /** + * Indicates if a customer is on or off-session while an invoice payment is attempted. + */ + off_session?: boolean; + + /** + * Use `allow_incomplete` to create subscriptions with `status=incomplete` if the first invoice cannot be paid. Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. + * + * 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. + */ + payment_behavior?: SubscriptionUpdateParams.PaymentBehavior; + + /** + * Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. + */ + pending_invoice_item_interval?: SubscriptionUpdateParams.PendingInvoiceItemInterval | null; + + /** + * Boolean (defaults to `true`) telling us whether to [credit for unused time](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g. when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. If `false`, the anchor period will be free (similar to a trial) and no proration adjustments will be created. + */ + prorate?: boolean; + + /** + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](#retrieve_customer_invoice) endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. + */ + proration_date?: number; + + /** + * A non-negative decimal (with at most four decimal places) between 0 and 100. This represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount in each billing period. For example, a plan which charges $10/month with a `tax_percent` of `20.0` will charge $12 per invoice. To unset a previously-set value, pass an empty string. This field has been deprecated and will be removed in a future API version, for further information view the [migration docs](https://stripe.com/docs/billing/migration/taxes) for `tax_rates`. + */ + tax_percent?: number | ''; + + /** + * If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value. + */ + transfer_data?: SubscriptionUpdateParams.TransferData | null; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. + */ + trial_end?: 'now' | number; + + /** + * Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. + */ + trial_from_plan?: boolean; + } + + namespace SubscriptionUpdateParams { + type BillingCycleAnchor = 'now' | 'unchanged'; + + interface BillingThresholds { + /** + * Monetary threshold that triggers the subscription to advance to a new billing period + */ + amount_gte?: number; + + /** + * Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + */ + reset_billing_cycle_anchor?: boolean; + } + + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface Item { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. + */ + billing_thresholds?: Item.BillingThresholds | null; + + /** + * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + */ + clear_usage?: boolean; + + /** + * A flag that, if set to `true`, will delete the specified item. + */ + deleted?: boolean; + + /** + * Subscription item to update. + */ + id?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * Plan ID for this item, as a string. + */ + plan?: string; + + /** + * Quantity for this item. + */ + quantity?: number; + + /** + * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates. + */ + tax_rates?: Array | ''; + } + + namespace Item { + interface BillingThresholds { + /** + * Usage threshold that triggers the subscription to advance to a new billing period + */ + usage_gte: number; + } + } + + type PaymentBehavior = + | 'allow_incomplete' + | 'error_if_incomplete' + | 'pending_if_incomplete'; + + interface PendingInvoiceItemInterval { + /** + * Specifies invoicing frequency. Either `day`, `week`, `month` or `year`. + */ + interval: PendingInvoiceItemInterval.Interval; + + /** + * The number of intervals between invoices. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). + */ + interval_count?: number; + } + + namespace PendingInvoiceItemInterval { + type Interval = 'day' | 'month' | 'week' | 'year'; + } + + interface TransferData { + /** + * ID of an existing, connected Stripe account. + */ + destination: string; + } + } + + interface SubscriptionListParams extends PaginationParams { + /** + * The collection method of the subscriptions to retrieve. Either `charge_automatically` or `send_invoice`. + */ + collection_method?: SubscriptionListParams.CollectionMethod; + + created?: RangeQueryParam | number; + + current_period_end?: RangeQueryParam | number; + + current_period_start?: RangeQueryParam | number; + + /** + * The ID of the customer whose subscriptions will be retrieved. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The ID of the plan whose subscriptions will be retrieved. + */ + plan?: string; + + /** + * The status of the subscriptions to retrieve. One of: `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `unpaid`, `canceled`, or `all`. Passing in a value of `canceled` will return all canceled subscriptions, including those belonging to deleted customers. Passing in a value of `all` will return subscriptions of all statuses. + */ + status?: SubscriptionListParams.Status; + } + + namespace SubscriptionListParams { + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + type Status = + | 'active' + | 'all' + | 'canceled' + | 'ended' + | 'incomplete' + | 'incomplete_expired' + | 'past_due' + | 'trialing' + | 'unpaid'; + } + + interface SubscriptionDeleteParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. + */ + invoice_now?: boolean; + + /** + * Will generate a proration invoice item that credits remaining unused time until the subscription period end. + */ + prorate?: boolean; + } + + interface SubscriptionDeleteDiscountParams {} + + class SubscriptionsResource { + /** + * Creates a new subscription on an existing customer. + */ + create( + params: SubscriptionCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the subscription with the given ID. + */ + retrieve( + id: string, + params?: SubscriptionRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates an existing subscription on a customer to match the specified parameters. When changing plans or quantities, we will optionally prorate the price we charge next month to make up for any price changes. To preview how the proration will be calculated, use the [upcoming invoice](https://stripe.com/docs/api#upcoming_invoice) endpoint. + */ + update( + id: string, + params?: SubscriptionUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled. + */ + list( + params?: SubscriptionListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + * + * Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + * + * By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + */ + del( + id: string, + params?: SubscriptionDeleteParams, + options?: RequestOptions + ): Promise; + del(id: string, options?: RequestOptions): Promise; + + /** + * Removes the currently applied discount on a subscription. + */ + deleteDiscount( + id: string, + params?: SubscriptionDeleteDiscountParams, + options?: RequestOptions + ): Promise; + deleteDiscount( + id: string, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/TaxDeductedAtSources.d.ts b/types/2019-12-03/TaxDeductedAtSources.d.ts new file mode 100644 index 0000000000..71cb6f8e5e --- /dev/null +++ b/types/2019-12-03/TaxDeductedAtSources.d.ts @@ -0,0 +1,33 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The TaxDeductedAtSource object. + */ + interface TaxDeductedAtSource { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'tax_deducted_at_source'; + + /** + * The end of the invoicing period. This TDS applies to Stripe fees collected during this invoicing period. + */ + period_end: number; + + /** + * The start of the invoicing period. This TDS applies to Stripe fees collected during this invoicing period. + */ + period_start: number; + + /** + * The TAN that was supplied to Stripe when TDS was assessed + */ + tax_deduction_account_number: string; + } + } +} diff --git a/types/2019-12-03/TaxIds.d.ts b/types/2019-12-03/TaxIds.d.ts new file mode 100644 index 0000000000..e55524d0b8 --- /dev/null +++ b/types/2019-12-03/TaxIds.d.ts @@ -0,0 +1,151 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The TaxId object. + */ + interface TaxId { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'tax_id'; + + /** + * Two-letter ISO code representing the country of the tax ID. + */ + country: string | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * ID of the customer. + */ + customer: string | Customer; + + deleted?: void; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Type of the tax ID, one of `au_abn`, `ch_vat`, `eu_vat`, `in_gst`, `mx_rfc`, `no_vat`, `nz_gst`, `za_vat`, or `unknown` + */ + type: TaxId.Type; + + /** + * Value of the tax ID. + */ + value: string; + + verification: TaxId.Verification; + } + + namespace TaxId { + type Type = + | 'au_abn' + | 'ch_vat' + | 'eu_vat' + | 'in_gst' + | 'mx_rfc' + | 'no_vat' + | 'nz_gst' + | 'unknown' + | 'za_vat'; + + interface Verification { + /** + * Verification status, one of `pending`, `unavailable`, `unverified`, or `verified`. + */ + status: Verification.Status; + + /** + * Verified address. + */ + verified_address: string | null; + + /** + * Verified name. + */ + verified_name: string | null; + } + + namespace Verification { + type Status = 'pending' | 'unavailable' | 'unverified' | 'verified'; + } + } + + /** + * The DeletedTaxId object. + */ + interface DeletedTaxId { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'tax_id'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface TaxIdCreateParams { + /** + * Type of the tax ID, one of `au_abn`, `ch_vat`, `eu_vat`, `in_gst`, `mx_rfc`, `no_vat`, `nz_gst`, or `za_vat` + */ + type: TaxIdCreateParams.Type; + + /** + * Value of the tax ID. + */ + value: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace TaxIdCreateParams { + type Type = + | 'au_abn' + | 'ch_vat' + | 'eu_vat' + | 'in_gst' + | 'mx_rfc' + | 'no_vat' + | 'nz_gst' + | 'za_vat'; + } + + interface TaxIdRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TaxIdListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TaxIdDeleteParams {} + } +} diff --git a/types/2019-12-03/TaxRates.d.ts b/types/2019-12-03/TaxRates.d.ts new file mode 100644 index 0000000000..8bc3843883 --- /dev/null +++ b/types/2019-12-03/TaxRates.d.ts @@ -0,0 +1,209 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The TaxRate object. + */ + interface TaxRate { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'tax_rate'; + + /** + * Defaults to `true`. When set to `false`, this tax rate cannot be applied to objects in the API, but will still be applied to subscriptions and invoices that already have it set. + */ + active: boolean; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. + */ + description: string | null; + + /** + * The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. + */ + display_name: string; + + /** + * This specifies if the tax rate is inclusive or exclusive. + */ + inclusive: boolean; + + /** + * The jurisdiction for the tax rate. + */ + jurisdiction: string | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * This represents the tax rate percent out of 100. + */ + percentage: number; + } + + interface TaxRateCreateParams { + /** + * The display name of the tax rate, which will be shown to users. + */ + display_name: string; + + /** + * This specifies if the tax rate is inclusive or exclusive. + */ + inclusive: boolean; + + /** + * This represents the tax rate percent out of 100. + */ + percentage: number; + + /** + * Flag determining whether the tax rate is active or inactive. Inactive tax rates continue to work where they are currently applied however they cannot be used for new applications. + */ + active?: boolean; + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The jurisdiction for the tax rate. + */ + jurisdiction?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface TaxRateRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TaxRateUpdateParams { + /** + * Flag determining whether the tax rate is active or inactive. Inactive tax rates continue to work where they are currently applied however they cannot be used for new applications. + */ + active?: boolean; + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. + */ + description?: string; + + /** + * The display name of the tax rate, which will be shown to users. + */ + display_name?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The jurisdiction for the tax rate. + */ + jurisdiction?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface TaxRateListParams extends PaginationParams { + /** + * Optional flag to filter by tax rates that are either active or not active (archived) + */ + active?: boolean; + + /** + * Optional range for filtering created date + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Optional flag to filter by tax rates that are inclusive (or those that are not inclusive) + */ + inclusive?: boolean; + + /** + * Optional range for tax rate percentage filtering + */ + percentage?: RangeQueryParam | number; + } + + class TaxRatesResource { + /** + * Creates a new tax rate. + */ + create( + params: TaxRateCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a tax rate with the given ID + */ + retrieve( + id: string, + params?: TaxRateRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates an existing tax rate. + */ + update( + id: string, + params?: TaxRateUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first. + */ + list( + params?: TaxRateListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/Terminal/ConnectionTokens.d.ts b/types/2019-12-03/Terminal/ConnectionTokens.d.ts new file mode 100644 index 0000000000..2738cfa3a8 --- /dev/null +++ b/types/2019-12-03/Terminal/ConnectionTokens.d.ts @@ -0,0 +1,53 @@ +declare module 'stripe' { + namespace Stripe { + namespace Terminal { + /** + * The ConnectionToken object. + */ + interface ConnectionToken { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'terminal.connection_token'; + + /** + * The id of the location that this connection token is scoped to. + */ + location?: string; + + /** + * Your application should pass this token to the Stripe Terminal SDK. + */ + secret: string; + } + + interface ConnectionTokenCreateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The id of the location that this connection token is scoped to. If specified the connection token will only be usable with readers assigned to that location, otherwise the connection token will be usable with all readers. + */ + location?: string; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + class ConnectionTokensResource { + /** + * To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. On your backend, add an endpoint that creates and returns a connection token. + */ + create( + params?: ConnectionTokenCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + } + } + } +} diff --git a/types/2019-12-03/Terminal/Locations.d.ts b/types/2019-12-03/Terminal/Locations.d.ts new file mode 100644 index 0000000000..bea5bfcdf5 --- /dev/null +++ b/types/2019-12-03/Terminal/Locations.d.ts @@ -0,0 +1,230 @@ +declare module 'stripe' { + namespace Stripe { + namespace Terminal { + /** + * The Location object. + */ + interface Location { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'terminal.location'; + + address: Address; + + deleted?: void; + + /** + * The display name of the location. + */ + display_name: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + } + + /** + * The DeletedLocation object. + */ + interface DeletedLocation { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'terminal.location'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface LocationCreateParams { + /** + * The full address of the location. + */ + address: LocationCreateParams.Address; + + /** + * A name for the location. + */ + display_name: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + namespace LocationCreateParams { + interface Address { + city?: string; + + country: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + + interface LocationRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + interface LocationUpdateParams { + /** + * The full address of the location. + */ + address?: LocationUpdateParams.Address; + + /** + * A name for the location. + */ + display_name?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + namespace LocationUpdateParams { + interface Address { + city?: string; + + country: string; + + line1?: string; + + line2?: string; + + postal_code?: string; + + state?: string; + } + } + + interface LocationListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + interface LocationDeleteParams { + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + class LocationsResource { + /** + * Creates a new Location object. + */ + create( + params: LocationCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a Location object. + */ + retrieve( + id: string, + params?: LocationRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: LocationUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Location objects. + */ + list( + params?: LocationListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Deletes a Location object. + */ + del( + id: string, + params?: LocationDeleteParams, + options?: RequestOptions + ): Promise; + del( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/Terminal/Readers.d.ts b/types/2019-12-03/Terminal/Readers.d.ts new file mode 100644 index 0000000000..ab592a5eff --- /dev/null +++ b/types/2019-12-03/Terminal/Readers.d.ts @@ -0,0 +1,251 @@ +declare module 'stripe' { + namespace Stripe { + namespace Terminal { + /** + * The Reader object. + */ + interface Reader { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'terminal.reader'; + + deleted?: void; + + /** + * The current software version of the reader. + */ + device_sw_version: string | null; + + /** + * Type of reader, one of `bbpos_chipper2x` or `verifone_P400`. + */ + device_type: Reader.DeviceType; + + /** + * The local IP address of the reader. + */ + ip_address: string | null; + + /** + * Custom label given to the reader for easier identification. + */ + label: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The location identifier of the reader. + */ + location: string | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * Serial number of the reader. + */ + serial_number: string; + + /** + * The networking status of the reader. + */ + status: string | null; + } + + namespace Reader { + type DeviceType = 'bbpos_chipper2x' | 'verifone_P400'; + } + + /** + * The DeletedReader object. + */ + interface DeletedReader { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'terminal.reader'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface ReaderCreateParams { + /** + * A code generated by the reader used for registering to an account. + */ + registration_code: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Custom label given to the reader for easier identification. If no label is specified, the registration code will be used. + */ + label?: string; + + /** + * The location to assign the reader to. If no location is specified, the reader will be assigned to the account's default location. + */ + location?: string; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + interface ReaderRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + interface ReaderUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The new label of the reader. + */ + label?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + interface ReaderListParams extends PaginationParams { + /** + * Filters readers by device type + */ + device_type?: string | ReaderListParams.DeviceType; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * A location ID to filter the response list to only readers at the specific location + */ + location?: string; + + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + + /** + * A status filter to filter readers to only offline or online readers + */ + status?: string | ReaderListParams.Status; + } + + namespace ReaderListParams { + type DeviceType = 'bbpos_chipper2x' | 'verifone_P400'; + + type Status = 'offline' | 'online'; + } + + interface ReaderDeleteParams { + /** + * To [group objects](https://stripe.com/docs/terminal/payments/connect#grouping-objects-by-connected-account) on your platform account by connected account, set this parameter to the connected account ID. + */ + operator_account?: string; + } + + class ReadersResource { + /** + * Creates a new Reader object. + */ + create( + params: ReaderCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a Reader object. + */ + retrieve( + id: string, + params?: ReaderRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve( + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + */ + update( + id: string, + params?: ReaderUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of Reader objects. + */ + list( + params?: ReaderListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Deletes a Reader object. + */ + del( + id: string, + params?: ReaderDeleteParams, + options?: RequestOptions + ): Promise; + del( + id: string, + options?: RequestOptions + ): Promise; + } + } + } +} diff --git a/types/2019-12-03/ThreeDSecure.d.ts b/types/2019-12-03/ThreeDSecure.d.ts new file mode 100644 index 0000000000..406cc1bb82 --- /dev/null +++ b/types/2019-12-03/ThreeDSecure.d.ts @@ -0,0 +1,108 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The ThreeDSecure object. + */ + interface ThreeDSecure { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'three_d_secure'; + + amount: number; + + /** + * True if the cardholder went through the authentication flow and their bank indicated that authentication succeeded. + */ + authenticated: boolean; + + card: Card; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * If present, this is the URL that you should send the cardholder to for authentication. If you are going to use Stripe.js to display the authentication page in an iframe, you should use the value "_callback". + */ + redirect_url: string | null; + + /** + * Possible values are `redirect_pending`, `succeeded`, or `failed`. When the cardholder can be authenticated, the object starts with status `redirect_pending`. When liability will be shifted to the cardholder's bank (either because the cardholder was successfully authenticated, or because the bank has not implemented 3D Secure, the object wlil be in status `succeeded`. `failed` indicates that authentication was attempted unsuccessfully. + */ + status: string; + } + + interface ThreeDSecureCreateParams { + /** + * Amount of the charge that you will create when authentication completes. + */ + 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; + + /** + * The URL that the cardholder's browser will be returned to when authentication completes. + */ + return_url: string; + + /** + * The ID of a card token, or the ID of a card belonging to the given customer. + */ + card?: string; + + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ThreeDSecureRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class ThreeDSecureResource { + /** + * Initiate 3D Secure authentication. + */ + create( + params: ThreeDSecureCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves a 3D Secure object. + */ + retrieve( + id: string, + params?: ThreeDSecureRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Tokens.d.ts b/types/2019-12-03/Tokens.d.ts new file mode 100644 index 0000000000..adb4c003bd --- /dev/null +++ b/types/2019-12-03/Tokens.d.ts @@ -0,0 +1,399 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Token object. + */ + interface Token { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'token'; + + bank_account?: BankAccount; + + card?: Card; + + /** + * IP address of the client that generated the token. + */ + client_ip: string | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Email of the user, whose token is created during Stripe Checkout. This field is non-standard, and maybe removed in the future. + */ + email?: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Type of the token: `account`, `bank_account`, `card`, or `pii`. + */ + type: string; + + /** + * Whether this token has already been used (tokens can be used only once). + */ + used: boolean; + } + + interface TokenCreateParams { + /** + * The bank account this token will represent. + */ + bank_account?: TokenCreateParams.BankAccount; + + card?: string | TokenCreateParams.Card; + + /** + * The customer (owned by the application's account) for which to create a token. For use only with [Stripe Connect](https://stripe.com/docs/connect). Also, this can be used only with an [OAuth access token](https://stripe.com/docs/connect/standard-accounts) or [Stripe-Account header](https://stripe.com/docs/connect/authentication). For more details, see [Cloning Saved Payment Methods](https://stripe.com/docs/connect/cloning-saved-payment-methods). + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Information for the person this token will represent. + */ + person?: TokenCreateParams.Person; + + /** + * The PII this token will represent. + */ + pii?: TokenCreateParams.Pii; + } + + namespace TokenCreateParams { + interface BankAccount { + /** + * The name of the person or business that owns the bank account.This field is required when attaching the bank account to a `Customer` object. + */ + account_holder_name?: string; + + /** + * The type of entity that holds the account. It can be `company` or `individual`. This field is required when attaching the bank account to a `Customer` object. + */ + account_holder_type?: BankAccount.AccountHolderType; + + /** + * The account number for the bank account, in string form. Must be a checking account. + */ + account_number: string; + + /** + * The country in which the bank account is located. + */ + country: string; + + /** + * The currency the bank account is in. This must be a country/currency pairing that [Stripe supports.](docs/payouts) + */ + currency?: string; + + /** + * The routing number, sort code, or other country-appropriateinstitution number for the bank account. For US bank accounts, this is required and should bethe ACH routing number, not the wire routing number. If you are providing an IBAN for`account_number`, this field is not required. + */ + routing_number?: string; + } + + namespace BankAccount { + type AccountHolderType = 'company' | 'individual'; + } + + interface Card { + address_city?: string; + + address_country?: string; + + address_line1?: string; + + address_line2?: string; + + address_state?: string; + + address_zip?: string; + + currency?: string; + + cvc?: string; + + exp_month: string; + + exp_year: string; + + name?: string; + + number: string; + } + + interface Person { + /** + * The person's address. + */ + address?: Person.Address; + + /** + * The Kana variation of the person's address (Japan only). + */ + address_kana?: JapanAddressParam; + + /** + * The Kanji variation of the person's address (Japan only). + */ + address_kanji?: JapanAddressParam; + + /** + * The person's date of birth. + */ + dob?: Person.Dob | null; + + /** + * The person's email address. + */ + email?: string; + + /** + * The person's first name. + */ + first_name?: string; + + /** + * The Kana variation of the person's first name (Japan only). + */ + first_name_kana?: string; + + /** + * The Kanji variation of the person's first name (Japan only). + */ + first_name_kanji?: string; + + /** + * The person's gender (International regulations require either "male" or "female"). + */ + gender?: string; + + /** + * The person's ID number, as appropriate for their country. For example, a social security number in the U.S., social insurance number in Canada, etc. Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://stripe.com/docs/stripe.js#collecting-pii-data). + */ + id_number?: string; + + /** + * The person's last name. + */ + last_name?: string; + + /** + * The Kana variation of the person's last name (Japan only). + */ + last_name_kana?: string; + + /** + * The Kanji variation of the person's last name (Japan only). + */ + last_name_kanji?: string; + + /** + * The person's maiden name. + */ + maiden_name?: string; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * The person's phone number. + */ + phone?: string; + + /** + * The relationship that this person has with the account's legal entity. + */ + relationship?: Person.Relationship; + + /** + * The last 4 digits of the person's social security number. + */ + ssn_last_4?: string; + + /** + * The person's verification status. + */ + verification?: Person.Verification; + } + + namespace Person { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface Dob { + /** + * The day of birth, between 1 and 31. + */ + day: number; + + /** + * The month of birth, between 1 and 12. + */ + month: number; + + /** + * The four-digit year of birth. + */ + year: number; + } + + interface Relationship { + /** + * Whether the person is a director of the account's legal entity. Currently only required for accounts in the EU. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. + */ + director?: boolean; + + /** + * Whether the person has significant responsibility to control, manage, or direct the organization. + */ + executive?: boolean; + + /** + * Whether the person is an owner of the account's legal entity. + */ + owner?: boolean; + + /** + * The percent owned by the person of the account's legal entity. + */ + percent_ownership?: number | ''; + + /** + * Whether the person is authorized as the primary representative of the account. This is the person nominated by the business to provide information about themselves, and general information about the account. There can only be one representative at any given time. At the time the account is created, this person should be set to the person responsible for opening the account. + */ + representative?: boolean; + + /** + * The person's title (e.g., CEO, Support Engineer). + */ + title?: string; + } + + interface Verification { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: Verification.AdditionalDocument; + + /** + * An identifying document, either a passport or local ID card. + */ + document?: Verification.Document; + } + + namespace Verification { + interface AdditionalDocument { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + + interface Document { + /** + * The back of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a [file upload](#create_file) with a `purpose` value of `identity_document`. The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + } + } + + interface Pii { + /** + * The `id_number` for the PII, in string form. + */ + id_number?: string; + } + } + + interface TokenRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class TokensResource { + /** + * Creates a single-use token that represents a bank account's details. + * This token can be used with any API method in place of a bank account dictionary. This token can be used only once, by attaching it to a [Custom account](https://stripe.com/docs/api#accounts). + */ + create( + params?: TokenCreateParams, + options?: RequestOptions + ): Promise; + create(options?: RequestOptions): Promise; + + /** + * Retrieves the token with the given ID. + */ + retrieve( + id: string, + params?: TokenRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/Topups.d.ts b/types/2019-12-03/Topups.d.ts new file mode 100644 index 0000000000..4f615b6f2a --- /dev/null +++ b/types/2019-12-03/Topups.d.ts @@ -0,0 +1,241 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Topup object. + */ + interface Topup { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'topup'; + + /** + * Amount transferred. + */ + amount: number; + + /** + * ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up. + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up. + */ + expected_availability_date: number | null; + + /** + * Error code explaining reason for top-up failure if available (see [the errors section](https://stripe.com/docs/api#errors) for a list of codes). + */ + failure_code: string | null; + + /** + * Message to user further explaining reason for top-up failure if available. + */ + failure_message: string | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + source: Source; + + /** + * Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter. + */ + statement_descriptor: string | null; + + /** + * The status of the top-up is either `canceled`, `failed`, `pending`, `reversed`, or `succeeded`. + */ + status: Topup.Status; + + /** + * A string that identifies this top-up as part of a group. + */ + transfer_group: string | null; + } + + namespace Topup { + type Status = + | 'canceled' + | 'failed' + | 'pending' + | 'reversed' + | 'succeeded'; + } + + interface TopupCreateParams { + /** + * A positive integer representing how much to transfer. + */ + 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + + /** + * The ID of a source to transfer funds from. For most users, this should be left unspecified which will use the bank account that was set up in the dashboard for the specified currency. In test mode, this can be a test bank token (see [Testing Top-ups](https://stripe.com/docs/connect/testing#testing-top-ups)). + */ + source?: string; + + /** + * Extra information about a top-up for the source's bank statement. Limited to 15 ASCII characters. + */ + statement_descriptor?: string; + + /** + * A string that identifies this top-up as part of a group. + */ + transfer_group?: string; + } + + interface TopupRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TopupUpdateParams { + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata?: MetadataParam; + } + + interface TopupListParams extends PaginationParams { + /** + * A positive integer representing how much to transfer. + */ + amount?: RangeQueryParam | number; + + /** + * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. + */ + created?: RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return top-ups that have the given status. One of `canceled`, `failed`, `pending` or `succeeded`. + */ + status?: TopupListParams.Status; + } + + namespace TopupListParams { + type Status = 'canceled' | 'failed' | 'pending' | 'succeeded'; + } + + interface TopupCancelParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class TopupsResource { + /** + * Top up the balance of an account + */ + create( + params: TopupCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information. + */ + retrieve( + id: string, + params?: TopupRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the metadata of a top-up. Other top-up details are not editable by design. + */ + update( + id: string, + params?: TopupUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of top-ups. + */ + list( + params?: TopupListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * Cancels a top-up. Only pending top-ups can be canceled. + */ + cancel( + id: string, + params?: TopupCancelParams, + options?: RequestOptions + ): Promise; + cancel(id: string, options?: RequestOptions): Promise; + } + } +} diff --git a/types/2019-12-03/TransferReversals.d.ts b/types/2019-12-03/TransferReversals.d.ts new file mode 100644 index 0000000000..b8179759fd --- /dev/null +++ b/types/2019-12-03/TransferReversals.d.ts @@ -0,0 +1,111 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The TransferReversal object. + */ + interface TransferReversal { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'transfer_reversal'; + + /** + * Amount, in %s. + */ + amount: number; + + /** + * Balance transaction that describes the impact on your account balance. + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: 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; + + /** + * Linked payment refund for the transfer reversal. + */ + destination_payment_refund: string | Refund | null; + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Metadata; + + /** + * ID of the refund responsible for the transfer reversal. + */ + source_refund: string | Refund | null; + + /** + * ID of the transfer that was reversed. + */ + transfer: string | Transfer; + } + + interface TransferReversalCreateParams { + /** + * A positive integer in %s representing how much of this transfer to reverse. Can only reverse up to the unreversed amount remaining of the transfer. Partial transfer reversals are only allowed for transfers to Stripe Accounts. Defaults to the entire transfer amount. + */ + amount?: number; + + /** + * An arbitrary string which you can attach to a reversal object. It is displayed alongside the reversal in the Dashboard. This will be unset if you POST an empty value. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * Boolean indicating whether the application fee should be refunded when reversing this transfer. If a full transfer reversal is given, the full application fee will be refunded. Otherwise, the application fee will be refunded with an amount proportional to the amount of the transfer reversed. + */ + refund_application_fee?: boolean; + } + + interface TransferReversalRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TransferReversalUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface TransferReversalListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } +} diff --git a/types/2019-12-03/Transfers.d.ts b/types/2019-12-03/Transfers.d.ts new file mode 100644 index 0000000000..04c9260621 --- /dev/null +++ b/types/2019-12-03/Transfers.d.ts @@ -0,0 +1,284 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The Transfer object. + */ + interface Transfer { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'transfer'; + + /** + * Amount in %s to be transferred. + */ + amount: number; + + /** + * Amount in %s reversed (can be less than the amount attribute on the transfer if a partial reversal was issued). + */ + amount_reversed: number; + + /** + * Balance transaction that describes the impact of this transfer on your account balance. + */ + balance_transaction: string | BalanceTransaction | null; + + /** + * Time that this record of the transfer was first created. + */ + created: 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; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description: string | null; + + /** + * ID of the Stripe account the transfer was sent to. + */ + destination: string | Account | null; + + /** + * If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer. + */ + destination_payment?: string | Charge; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * A set of key-value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. + */ + metadata: Metadata; + + /** + * A list of reversals that have been applied to the transfer. + */ + reversals: ApiList; + + /** + * Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false. + */ + reversed: boolean; + + /** + * ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance. + */ + source_transaction: string | Charge | null; + + /** + * The source balance this transfer came from. One of `card` or `bank_account`. + */ + source_type: string | null; + + /** + * A string that identifies this transaction as part of a group. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers#grouping-transactions) for details. + */ + transfer_group: string | null; + } + + interface TransferCreateParams { + /** + * 3-letter [ISO code for currency](https://stripe.com/docs/payouts). + */ + currency: string; + + /** + * The ID of a connected Stripe account. [See the Connect documentation](https://stripe.com/docs/connect/charges-transfers) for details. + */ + destination: string; + + /** + * A positive integer in %s representing how much to transfer. + */ + amount?: number; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + + /** + * You can use this parameter to transfer funds from a charge before they are added to your available balance. A pending balance will transfer immediately but the funds will not become available until the original charge becomes available. [See the Connect documentation](https://stripe.com/docs/connect/charges-transfers#transfer-availability) for details. + */ + source_transaction?: string; + + /** + * The source balance to use for this transfer. One of `bank_account` or `card`. For most users, this will default to `card`. + */ + source_type?: TransferCreateParams.SourceType; + + /** + * A string that identifies this transaction as part of a group. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers#grouping-transactions) for details. + */ + transfer_group?: string; + } + + namespace TransferCreateParams { + type SourceType = 'bank_account' | 'card'; + } + + interface TransferRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TransferUpdateParams { + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of key-value pairs 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?: MetadataParam; + } + + interface TransferListParams extends PaginationParams { + created?: RangeQueryParam | number; + + /** + * Only return transfers for the destination specified by this account ID. + */ + destination?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return transfers with the specified transfer group. + */ + transfer_group?: string; + } + + class TransfersResource { + /** + * To send funds from your Stripe account to a connected account, you create a new transfer object. Your [Stripe balance](https://stripe.com/docs/api#balance) must be able to cover the transfer amount, or you'll receive an “Insufficient Funds” error. + */ + create( + params: TransferCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the details of an existing transfer. Supply the unique transfer ID from either a transfer creation request or the transfer list, and Stripe will return the corresponding transfer information. + */ + retrieve( + id: string, + params?: TransferRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * + * This request accepts only metadata as an argument. + */ + update( + id: string, + params?: TransferUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of existing transfers sent to connected accounts. The transfers are returned in sorted order, with the most recently created transfers appearing first. + */ + list( + params?: TransferListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * When you create a new reversal, you must specify a transfer to create it on. + * + * When reversing transfers, you can optionally reverse part of the transfer. You can do so as many times as you wish until the entire transfer has been reversed. + * + * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, or when trying to reverse more money than is left on a transfer. + */ + createReversal( + id: string, + params?: TransferReversalCreateParams, + options?: RequestOptions + ): Promise; + createReversal( + id: string, + options?: RequestOptions + ): Promise; + + /** + * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer. + */ + retrieveReversal( + idId: string, + id: string, + params?: TransferReversalRetrieveParams, + options?: RequestOptions + ): Promise; + retrieveReversal( + idId: string, + id: string, + options?: RequestOptions + ): Promise; + + /** + * Updates the specified reversal by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * + * This request only accepts metadata and description as arguments. + */ + updateReversal( + idId: string, + id: string, + params?: TransferReversalUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals. + */ + listReversals( + id: string, + params?: TransferReversalListParams, + options?: RequestOptions + ): ApiListPromise; + listReversals( + id: string, + options?: RequestOptions + ): ApiListPromise; + } + } +} diff --git a/types/2019-12-03/UsageRecordSummaries.d.ts b/types/2019-12-03/UsageRecordSummaries.d.ts new file mode 100644 index 0000000000..d990609176 --- /dev/null +++ b/types/2019-12-03/UsageRecordSummaries.d.ts @@ -0,0 +1,54 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The UsageRecordSummary object. + */ + interface UsageRecordSummary { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'usage_record_summary'; + + /** + * The invoice in which this usage period has been billed for. + */ + invoice: string | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + period: UsageRecordSummary.Period; + + /** + * The ID of the subscription item this summary is describing. + */ + subscription_item: string; + + /** + * The total usage within this usage period. + */ + total_usage: number; + } + + namespace UsageRecordSummary { + interface Period { + /** + * The end date of this usage period. All usage up to and including this point in time is included. + */ + end: number | null; + + /** + * The start date of this usage period. All usage after this point in time is included. + */ + start: number | null; + } + } + } +} diff --git a/types/2019-12-03/UsageRecords.d.ts b/types/2019-12-03/UsageRecords.d.ts new file mode 100644 index 0000000000..45ef69bb95 --- /dev/null +++ b/types/2019-12-03/UsageRecords.d.ts @@ -0,0 +1,64 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The UsageRecord object. + */ + interface UsageRecord { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'usage_record'; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The usage quantity for the specified date. + */ + quantity: number; + + /** + * The ID of the subscription item this usage record contains data for. + */ + subscription_item: string; + + /** + * The timestamp when this usage occurred. + */ + timestamp: number; + } + + interface UsageRecordCreateParams { + /** + * The usage quantity for the specified timestamp. + */ + quantity: number; + + /** + * The timestamp for the usage event. This timestamp must be within the current billing period of the subscription of the provided `subscription_item`. + */ + timestamp: number; + + /** + * Valid values are `increment` (default) or `set`. When using `increment` the specified `quantity` will be added to the usage at the specified timestamp. The `set` action will overwrite the usage quantity at that timestamp. If the subscription has [billing thresholds](https://stripe.com/docs/api/subscriptions/object#subscription_object-billing_thresholds), `increment` is the only allowed value. + */ + action?: UsageRecordCreateParams.Action; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace UsageRecordCreateParams { + type Action = 'increment' | 'set'; + } + } +} diff --git a/types/2019-12-03/WebhookEndpoints.d.ts b/types/2019-12-03/WebhookEndpoints.d.ts new file mode 100644 index 0000000000..53772b8b06 --- /dev/null +++ b/types/2019-12-03/WebhookEndpoints.d.ts @@ -0,0 +1,600 @@ +declare module 'stripe' { + namespace Stripe { + /** + * The WebhookEndpoint object. + */ + interface WebhookEndpoint { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'webhook_endpoint'; + + /** + * The API version events are rendered as for this webhook endpoint. + */ + api_version: string | null; + + /** + * The ID of the associated Connect application. + */ + application: string | null; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + deleted?: void; + + /** + * The list of events to enable for this endpoint. `['*']` indicates that all events are enabled, except those that require explicit selection. + */ + enabled_events: Array; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The endpoint's secret, used to generate [webhook signatures](https://stripe.com/docs/webhooks/signatures). Only returned at creation. + */ + secret?: string; + + /** + * The status of the webhook. It can be `enabled` or `disabled`. + */ + status: string; + + /** + * The URL of the webhook endpoint. + */ + url: string; + } + + /** + * The DeletedWebhookEndpoint object. + */ + interface DeletedWebhookEndpoint { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'webhook_endpoint'; + + /** + * Always true for a deleted object + */ + deleted: true; + } + + interface WebhookEndpointCreateParams { + /** + * The list of events to enable for this endpoint. You may specify `['*']` to enable all events, except those that require explicit selection. + */ + enabled_events: Array; + + /** + * The URL of the webhook endpoint. + */ + url: string; + + /** + * Events sent to this endpoint will be generated with this Stripe Version instead of your account's default Stripe Version. + */ + api_version?: WebhookEndpointCreateParams.ApiVersion; + + /** + * Whether this endpoint should receive events from connected accounts (`true`), or from your account (`false`). Defaults to `false`. + */ + connect?: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace WebhookEndpointCreateParams { + type ApiVersion = + | '2011-01-01' + | '2011-06-21' + | '2011-06-28' + | '2011-08-01' + | '2011-09-15' + | '2011-11-17' + | '2012-02-23' + | '2012-03-25' + | '2012-06-18' + | '2012-06-28' + | '2012-07-09' + | '2012-09-24' + | '2012-10-26' + | '2012-11-07' + | '2013-02-11' + | '2013-02-13' + | '2013-07-05' + | '2013-08-12' + | '2013-08-13' + | '2013-10-29' + | '2013-12-03' + | '2014-01-31' + | '2014-03-13' + | '2014-03-28' + | '2014-05-19' + | '2014-06-13' + | '2014-06-17' + | '2014-07-22' + | '2014-07-26' + | '2014-08-04' + | '2014-08-20' + | '2014-09-08' + | '2014-10-07' + | '2014-11-05' + | '2014-11-20' + | '2014-12-08' + | '2014-12-17' + | '2014-12-22' + | '2015-01-11' + | '2015-01-26' + | '2015-02-10' + | '2015-02-16' + | '2015-02-18' + | '2015-03-24' + | '2015-04-07' + | '2015-06-15' + | '2015-07-07' + | '2015-07-13' + | '2015-07-28' + | '2015-08-07' + | '2015-08-19' + | '2015-09-03' + | '2015-09-08' + | '2015-09-23' + | '2015-10-01' + | '2015-10-12' + | '2015-10-16' + | '2016-02-03' + | '2016-02-19' + | '2016-02-22' + | '2016-02-23' + | '2016-02-29' + | '2016-03-07' + | '2016-06-15' + | '2016-07-06' + | '2016-10-19' + | '2017-01-27' + | '2017-02-14' + | '2017-04-06' + | '2017-05-25' + | '2017-06-05' + | '2017-08-15' + | '2017-12-14' + | '2018-01-23' + | '2018-02-05' + | '2018-02-06' + | '2018-02-28' + | '2018-05-21' + | '2018-07-27' + | '2018-08-23' + | '2018-09-06' + | '2018-09-24' + | '2018-10-31' + | '2018-11-08' + | '2019-02-11' + | '2019-02-19' + | '2019-03-14' + | '2019-05-16' + | '2019-08-14' + | '2019-09-09' + | '2019-10-08' + | '2019-10-17' + | '2019-11-05' + | '2019-12-03'; + + type EnabledEvent = + | '*' + | 'account.application.authorized' + | 'account.application.deauthorized' + | 'account.external_account.created' + | 'account.external_account.deleted' + | 'account.external_account.updated' + | 'account.updated' + | 'application_fee.created' + | 'application_fee.refund.updated' + | 'application_fee.refunded' + | 'balance.available' + | 'capability.updated' + | 'charge.captured' + | 'charge.dispute.closed' + | 'charge.dispute.created' + | 'charge.dispute.funds_reinstated' + | 'charge.dispute.funds_withdrawn' + | 'charge.dispute.updated' + | 'charge.expired' + | 'charge.failed' + | 'charge.pending' + | 'charge.refund.updated' + | 'charge.refunded' + | 'charge.succeeded' + | 'charge.updated' + | 'checkout.session.completed' + | 'coupon.created' + | 'coupon.deleted' + | 'coupon.updated' + | 'credit_note.created' + | 'credit_note.updated' + | 'credit_note.voided' + | 'customer.created' + | 'customer.deleted' + | 'customer.discount.created' + | 'customer.discount.deleted' + | 'customer.discount.updated' + | 'customer.source.created' + | 'customer.source.deleted' + | 'customer.source.expiring' + | 'customer.source.updated' + | 'customer.subscription.created' + | 'customer.subscription.deleted' + | 'customer.subscription.trial_will_end' + | 'customer.subscription.updated' + | 'customer.tax_id.created' + | 'customer.tax_id.deleted' + | 'customer.tax_id.updated' + | 'customer.updated' + | 'file.created' + | 'invoice.created' + | 'invoice.deleted' + | 'invoice.finalized' + | 'invoice.marked_uncollectible' + | 'invoice.payment_action_required' + | 'invoice.payment_failed' + | 'invoice.payment_succeeded' + | 'invoice.sent' + | 'invoice.upcoming' + | 'invoice.updated' + | 'invoice.voided' + | 'invoiceitem.created' + | 'invoiceitem.deleted' + | 'invoiceitem.updated' + | 'issuing_authorization.created' + | 'issuing_authorization.request' + | 'issuing_authorization.updated' + | 'issuing_card.created' + | 'issuing_card.updated' + | 'issuing_cardholder.created' + | 'issuing_cardholder.updated' + | 'issuing_dispute.created' + | 'issuing_dispute.updated' + | 'issuing_settlement.created' + | 'issuing_settlement.updated' + | 'issuing_transaction.created' + | 'issuing_transaction.updated' + | 'mandate.updated' + | 'order.created' + | 'order.payment_failed' + | 'order.payment_succeeded' + | 'order.updated' + | 'order_return.created' + | 'payment_intent.amount_capturable_updated' + | 'payment_intent.canceled' + | 'payment_intent.created' + | 'payment_intent.payment_failed' + | 'payment_intent.succeeded' + | 'payment_method.attached' + | 'payment_method.card_automatically_updated' + | 'payment_method.detached' + | 'payment_method.updated' + | 'payout.canceled' + | 'payout.created' + | 'payout.failed' + | 'payout.paid' + | 'payout.updated' + | 'person.created' + | 'person.deleted' + | 'person.updated' + | 'plan.created' + | 'plan.deleted' + | 'plan.updated' + | 'product.created' + | 'product.deleted' + | 'product.updated' + | 'radar.early_fraud_warning.created' + | 'radar.early_fraud_warning.updated' + | 'recipient.created' + | 'recipient.deleted' + | 'recipient.updated' + | 'reporting.report_run.failed' + | 'reporting.report_run.succeeded' + | 'reporting.report_type.updated' + | 'review.closed' + | 'review.opened' + | 'setup_intent.canceled' + | 'setup_intent.created' + | 'setup_intent.setup_failed' + | 'setup_intent.succeeded' + | 'sigma.scheduled_query_run.created' + | 'sku.created' + | 'sku.deleted' + | 'sku.updated' + | 'source.canceled' + | 'source.chargeable' + | 'source.failed' + | 'source.mandate_notification' + | 'source.refund_attributes_required' + | 'source.transaction.created' + | 'source.transaction.updated' + | 'subscription_schedule.aborted' + | 'subscription_schedule.canceled' + | 'subscription_schedule.completed' + | 'subscription_schedule.created' + | 'subscription_schedule.expiring' + | 'subscription_schedule.released' + | 'subscription_schedule.updated' + | 'tax_rate.created' + | 'tax_rate.updated' + | 'topup.canceled' + | 'topup.created' + | 'topup.failed' + | 'topup.reversed' + | 'topup.succeeded' + | 'transfer.created' + | 'transfer.failed' + | 'transfer.paid' + | 'transfer.reversed' + | 'transfer.updated'; + } + + interface WebhookEndpointRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface WebhookEndpointUpdateParams { + /** + * Disable the webhook endpoint if set to true. + */ + disabled?: boolean; + + /** + * The list of events to enable for this endpoint. You may specify `['*']` to enable all events, except those that require explicit selection. + */ + enabled_events?: Array; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The URL of the webhook endpoint. + */ + url?: string; + } + + namespace WebhookEndpointUpdateParams { + type EnabledEvent = + | '*' + | 'account.application.authorized' + | 'account.application.deauthorized' + | 'account.external_account.created' + | 'account.external_account.deleted' + | 'account.external_account.updated' + | 'account.updated' + | 'application_fee.created' + | 'application_fee.refund.updated' + | 'application_fee.refunded' + | 'balance.available' + | 'capability.updated' + | 'charge.captured' + | 'charge.dispute.closed' + | 'charge.dispute.created' + | 'charge.dispute.funds_reinstated' + | 'charge.dispute.funds_withdrawn' + | 'charge.dispute.updated' + | 'charge.expired' + | 'charge.failed' + | 'charge.pending' + | 'charge.refund.updated' + | 'charge.refunded' + | 'charge.succeeded' + | 'charge.updated' + | 'checkout.session.completed' + | 'coupon.created' + | 'coupon.deleted' + | 'coupon.updated' + | 'credit_note.created' + | 'credit_note.updated' + | 'credit_note.voided' + | 'customer.created' + | 'customer.deleted' + | 'customer.discount.created' + | 'customer.discount.deleted' + | 'customer.discount.updated' + | 'customer.source.created' + | 'customer.source.deleted' + | 'customer.source.expiring' + | 'customer.source.updated' + | 'customer.subscription.created' + | 'customer.subscription.deleted' + | 'customer.subscription.trial_will_end' + | 'customer.subscription.updated' + | 'customer.tax_id.created' + | 'customer.tax_id.deleted' + | 'customer.tax_id.updated' + | 'customer.updated' + | 'file.created' + | 'invoice.created' + | 'invoice.deleted' + | 'invoice.finalized' + | 'invoice.marked_uncollectible' + | 'invoice.payment_action_required' + | 'invoice.payment_failed' + | 'invoice.payment_succeeded' + | 'invoice.sent' + | 'invoice.upcoming' + | 'invoice.updated' + | 'invoice.voided' + | 'invoiceitem.created' + | 'invoiceitem.deleted' + | 'invoiceitem.updated' + | 'issuing_authorization.created' + | 'issuing_authorization.request' + | 'issuing_authorization.updated' + | 'issuing_card.created' + | 'issuing_card.updated' + | 'issuing_cardholder.created' + | 'issuing_cardholder.updated' + | 'issuing_dispute.created' + | 'issuing_dispute.updated' + | 'issuing_settlement.created' + | 'issuing_settlement.updated' + | 'issuing_transaction.created' + | 'issuing_transaction.updated' + | 'mandate.updated' + | 'order.created' + | 'order.payment_failed' + | 'order.payment_succeeded' + | 'order.updated' + | 'order_return.created' + | 'payment_intent.amount_capturable_updated' + | 'payment_intent.canceled' + | 'payment_intent.created' + | 'payment_intent.payment_failed' + | 'payment_intent.succeeded' + | 'payment_method.attached' + | 'payment_method.card_automatically_updated' + | 'payment_method.detached' + | 'payment_method.updated' + | 'payout.canceled' + | 'payout.created' + | 'payout.failed' + | 'payout.paid' + | 'payout.updated' + | 'person.created' + | 'person.deleted' + | 'person.updated' + | 'plan.created' + | 'plan.deleted' + | 'plan.updated' + | 'product.created' + | 'product.deleted' + | 'product.updated' + | 'radar.early_fraud_warning.created' + | 'radar.early_fraud_warning.updated' + | 'recipient.created' + | 'recipient.deleted' + | 'recipient.updated' + | 'reporting.report_run.failed' + | 'reporting.report_run.succeeded' + | 'reporting.report_type.updated' + | 'review.closed' + | 'review.opened' + | 'setup_intent.canceled' + | 'setup_intent.created' + | 'setup_intent.setup_failed' + | 'setup_intent.succeeded' + | 'sigma.scheduled_query_run.created' + | 'sku.created' + | 'sku.deleted' + | 'sku.updated' + | 'source.canceled' + | 'source.chargeable' + | 'source.failed' + | 'source.mandate_notification' + | 'source.refund_attributes_required' + | 'source.transaction.created' + | 'source.transaction.updated' + | 'subscription_schedule.aborted' + | 'subscription_schedule.canceled' + | 'subscription_schedule.completed' + | 'subscription_schedule.created' + | 'subscription_schedule.expiring' + | 'subscription_schedule.released' + | 'subscription_schedule.updated' + | 'tax_rate.created' + | 'tax_rate.updated' + | 'topup.canceled' + | 'topup.created' + | 'topup.failed' + | 'topup.reversed' + | 'topup.succeeded' + | 'transfer.created' + | 'transfer.failed' + | 'transfer.paid' + | 'transfer.reversed' + | 'transfer.updated'; + } + + interface WebhookEndpointListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface WebhookEndpointDeleteParams {} + + class WebhookEndpointsResource { + /** + * A webhook endpoint must have a url and a list of enabled_events. You may optionally specify the Boolean connect parameter. If set to true, then a Connect webhook endpoint that notifies the specified url about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified url only about events from your account is created. You can also create webhook endpoints in the [webhooks settings](https://dashboard.stripe.com/account/webhooks) section of the Dashboard. + */ + create( + params: WebhookEndpointCreateParams, + options?: RequestOptions + ): Promise; + + /** + * Retrieves the webhook endpoint with the given ID. + */ + retrieve( + id: string, + params?: WebhookEndpointRetrieveParams, + options?: RequestOptions + ): Promise; + retrieve(id: string, options?: RequestOptions): Promise; + + /** + * Updates the webhook endpoint. You may edit the url, the list of enabled_events, and the status of your endpoint. + */ + update( + id: string, + params?: WebhookEndpointUpdateParams, + options?: RequestOptions + ): Promise; + + /** + * Returns a list of your webhook endpoints. + */ + list( + params?: WebhookEndpointListParams, + options?: RequestOptions + ): ApiListPromise; + list(options?: RequestOptions): ApiListPromise; + + /** + * You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard. + */ + del( + id: string, + params?: WebhookEndpointDeleteParams, + options?: RequestOptions + ): Promise; + del( + id: string, + options?: RequestOptions + ): Promise; + } + } +} diff --git a/types/2019-12-03/index.d.ts b/types/2019-12-03/index.d.ts new file mode 100644 index 0000000000..668725657b --- /dev/null +++ b/types/2019-12-03/index.d.ts @@ -0,0 +1,221 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +declare module 'stripe' { + // Added to in other modules, referenced above. + export namespace Stripe {} + + export class Stripe { + static Stripe: typeof Stripe; + + constructor(apiKey: string, config: Stripe.StripeConfig); + + setAppInfo(info: Stripe.AppInfo): void; + + /** + * Top Level Resources + */ + accounts: Stripe.AccountsResource; + accountLinks: Stripe.AccountLinksResource; + applePayDomains: Stripe.ApplePayDomainsResource; + applicationFees: Stripe.ApplicationFeesResource; + balance: Stripe.BalanceResource; + balanceTransactions: Stripe.BalanceTransactionsResource; + bitcoinReceivers: Stripe.BitcoinReceiversResource; + charges: Stripe.ChargesResource; + countrySpecs: Stripe.CountrySpecsResource; + coupons: Stripe.CouponsResource; + creditNotes: Stripe.CreditNotesResource; + customers: Stripe.CustomersResource; + disputes: Stripe.DisputesResource; + ephemeralKeys: Stripe.EphemeralKeysResource; + events: Stripe.EventsResource; + exchangeRates: Stripe.ExchangeRatesResource; + files: Stripe.FilesResource; + fileLinks: Stripe.FileLinksResource; + invoices: Stripe.InvoicesResource; + invoiceItems: Stripe.InvoiceItemsResource; + issuerFraudRecords: Stripe.IssuerFraudRecordsResource; + mandates: Stripe.MandatesResource; + orders: Stripe.OrdersResource; + orderReturns: Stripe.OrderReturnsResource; + paymentIntents: Stripe.PaymentIntentsResource; + paymentMethods: Stripe.PaymentMethodsResource; + payouts: Stripe.PayoutsResource; + plans: Stripe.PlansResource; + products: Stripe.ProductsResource; + recipients: Stripe.RecipientsResource; + refunds: Stripe.RefundsResource; + reviews: Stripe.ReviewsResource; + setupIntents: Stripe.SetupIntentsResource; + skus: Stripe.SkusResource; + sources: Stripe.SourcesResource; + subscriptions: Stripe.SubscriptionsResource; + subscriptionItems: Stripe.SubscriptionItemsResource; + subscriptionSchedules: Stripe.SubscriptionSchedulesResource; + taxRates: Stripe.TaxRatesResource; + threeDSecure: Stripe.ThreeDSecureResource; + tokens: Stripe.TokensResource; + topups: Stripe.TopupsResource; + transfers: Stripe.TransfersResource; + webhookEndpoints: Stripe.WebhookEndpointsResource; + webhooks: Stripe.Webhooks; + oauth: Stripe.OAuthResource; + + /** + * Namespaced Resources + */ + checkout: {sessions: Stripe.Checkout.SessionsResource}; + issuing: { + authorizations: Stripe.Issuing.AuthorizationsResource; + cards: Stripe.Issuing.CardsResource; + cardholders: Stripe.Issuing.CardholdersResource; + disputes: Stripe.Issuing.DisputesResource; + transactions: Stripe.Issuing.TransactionsResource; + }; + radar: { + earlyFraudWarnings: Stripe.Radar.EarlyFraudWarningsResource; + valueLists: Stripe.Radar.ValueListsResource; + valueListItems: Stripe.Radar.ValueListItemsResource; + }; + reporting: { + reportRuns: Stripe.Reporting.ReportRunsResource; + reportTypes: Stripe.Reporting.ReportTypesResource; + }; + sigma: {scheduledQueryRuns: Stripe.Sigma.ScheduledQueryRunsResource}; + terminal: { + connectionTokens: Stripe.Terminal.ConnectionTokensResource; + locations: Stripe.Terminal.LocationsResource; + readers: Stripe.Terminal.ReadersResource; + }; + + /** + * API Errors + */ + static errors: Stripe.Errors; + errors: Stripe.Errors; + + on(event: 'request', handler: (event: Stripe.RequestEvent) => void): void; + on(event: 'response', handler: (event: Stripe.ResponseEvent) => void): void; + once(event: 'request', handler: (event: Stripe.RequestEvent) => void): void; + once( + event: 'response', + handler: (event: Stripe.ResponseEvent) => void + ): void; + off(event: 'request', handler: (event: Stripe.RequestEvent) => void): void; + off( + event: 'response', + handler: (event: Stripe.ResponseEvent) => void + ): void; + + setProtocol(protocol: string): void; + + /** @deprecated Please use the StripeConfig object instead. */ + setHost(host: string, port?: string | number, protocol?: string): void; + + /** @deprecated Please use the StripeConfig object instead. */ + setPort(port: string | number): void; + /** @deprecated Please use the StripeConfig object instead. */ + setApiVersion(version: Stripe.LatestApiVersion): void; + /** @deprecated Please use the StripeConfig object instead. */ + setApiKey(key: string): void; + + /** @deprecated Please use the StripeConfig object instead. */ + setTimeout(timeout?: number): void; + /** @deprecated Please use the StripeConfig object instead. */ + setMaxNetworkRetries(maxNetworkRetries: number): void; + /** @deprecated Please use the StripeConfig object instead. */ + setTelemetryEnabled(enabled: boolean): void; + /** @deprecated Please use the StripeConfig object instead. */ + setHttpAgent(agent: Stripe.HttpAgent): void; + } + + export default Stripe; +} diff --git a/types/OAuth.d.ts b/types/OAuth.d.ts new file mode 100644 index 0000000000..bf922c0e18 --- /dev/null +++ b/types/OAuth.d.ts @@ -0,0 +1,355 @@ +declare module 'stripe' { + namespace Stripe { + interface OAuthToken { + /** + * The access token you can use to make requests on behalf of this Stripe account. Use it as you would any Stripe secret API key. + * This key does not expire, but may be revoked by the user at any time (you'll get a account.application.deauthorized webhook event when this happens). + */ + access_token?: string; + + /** + * The scope granted to the access token, depending on the scope of the authorization code and scope parameter. + */ + scope?: string; + + /** + * The live mode indicator for the token. If true, the access_token can be used as a live secret key. If false, the access_token can be used as a test secret key. + * Depends on the mode of the secret API key used to make the request. + */ + livemode?: boolean; + + /** + * Will always have a value of bearer. + */ + token_type?: 'bearer'; + + /** + * Can be used to get a new access token of an equal or lesser scope, or of a different live mode (where applicable). + */ + refresh_token?: string; + + /** + * The unique id of the account you have been granted access to, as a string. + */ + stripe_user_id?: string; + + /** + * A publishable key that can be used with this account. Matches the mode—live or test—of the token. + */ + stripe_publishable_key?: string; + } + + interface OAuthDeauthorization { + /** + * The unique id of the account you have revoked access to, as a string. + * This is the same as the stripe_user_id you passed in. + * If this is returned, the revocation was successful. + */ + stripe_user_id: string; + } + + interface OAuthAuthorizeUrlParams { + /** + * The unique identifier provided to your application, found in your application settings. + */ + client_id: string; + + /** + * The only option at the moment is `'code'`. + */ + response_type: 'code'; + + /** + * The URL for the authorize response redirect. If provided, this must exactly match one of the comma-separated redirect_uri values in your application settings. + * To protect yourself from certain forms of man-in-the-middle attacks, the live mode redirect_uri must use a secure HTTPS connection. + * Defaults to the redirect_uri in your application settings if not provided. + */ + redirect_uri?: string; + + /** + * read_write or read_only, depending on the level of access you need. + * + * Defaults to read_only. + */ + scope?: string; + + /** + * An arbitrary string value we will pass back to you, useful for CSRF protection. + */ + state?: string; + + /** + * login or register, depending on what type of screen you want your users to see. Only override this to be login if you expect all your users to have Stripe accounts already (e.g., most read-only applications, like analytics dashboards or accounting software). + * Defaults to login for scope read_only and register for scope read_write. + */ + stripe_landing?: string; + + /** + * Boolean to indicate that the user should always be asked to connect, even if they're already connected. + * Defaults to false. + */ + always_prompt?: boolean; + + /** + * Express only + * An array of capabilities to apply to the connected account. + */ + suggested_capabilities?: Array; + + /** + * Stripe will use these to prefill details in the account form for new users. + * Some prefilled fields (e.g., URL or product category) may be automatically hidden from the user's view. + * Any parameters with invalid values will be silently ignored. + */ + stripe_user?: OAuthAuthorizeUrlParams.StripeUser; + } + + namespace OAuthAuthorizeUrlParams { + interface StripeUser { + /** + * Recommended + * The user's email address. Must be a valid email format. + */ + email?: string; + + /** + * Recommended + * The URL for the user's business. This may be the user's website, a profile page within your application, or another publicly available profile for the business, such as a LinkedIn or Facebook profile. + * Must be URL-encoded and include a scheme (http or https). + * If you will be prefilling this field, we highly recommend that the linked page contain a description of the user's products or services and their contact information. If we don't have enough information, we'll have to reach out to the user directly before initiating payouts. + */ + url?: string; + + /** + * Two-letter country code (e.g., US or CA). + * Must be a country that Stripe currently supports. + */ + country?: string; + + /** + * The business phone number. Must be 10 digits only. + * Must also prefill stripe_user[country] with the corresponding country. + */ + phone_number?: string; + + /** + * The legal name of the business, also used for the statement descriptor. + */ + business_name?: string; + + /** + * The type of the business. + * Must be one of sole_prop, corporation, non_profit, partnership, or llc. + */ + business_type?: string; + + /** + * First name of the person who will be filling out a Stripe application. + */ + first_name?: string; + + /** + * Last name of the person who will be filling out a Stripe application. + */ + last_name?: string; + + /** + * Day (0-31), month (1-12), and year (YYYY, greater than 1900) for the birth date of the person who will be filling out a Stripe application. + * If you choose to pass these parameters, you must pass all three. + */ + dob_day?: string; + + /** + * Day (0-31), month (1-12), and year (YYYY, greater than 1900) for the birth date of the person who will be filling out a Stripe application. + * If you choose to pass these parameters, you must pass all three. + */ + dob_month?: string; + + /** + * Day (0-31), month (1-12), and year (YYYY, greater than 1900) for the birth date of the person who will be filling out a Stripe application. + * If you choose to pass these parameters, you must pass all three. + */ + dob_year?: string; + + /** + * Standard only + * Street address of the business. + */ + street_address?: string; + + /** + * Standard only + * Address city of the business. + * We highly recommend that you also prefill stripe_user[country] with the corresponding country. + */ + city?: string; + + /** + * Standard only + * Address state of the business. Must be the two-letter state or province code (e.g., NY for a U.S. business or AB for a Canadian one). + * Must also prefill stripe_user[country] with the corresponding country. + */ + state?: string; + + /** + * Standard only + * Address ZIP code of the business. Must be a string. + * We highly recommend that you also prefill stripe_user[country] with the corresponding country. + */ + zip?: string; + + /** + * Standard only + * A string: true if the user sells a physical product, false otherwise. + */ + physical_product?: string; + + /** + * A description of what the business is accepting payments for. + */ + product_description?: string; + + /** + * Standard only + * Three-letter ISO code representing currency, in lowercase (e.g., usd or cad). + * Must be a valid country and currency combination that Stripe supports. + * Must prefill stripe_user[country] with the corresponding country. + */ + currency?: string; + + /** + * The Kana variation of the first name of the person who will be filling out a Stripe application. + * Must prefill stripe_user[country] with JP, as this parameter is only relevant for Japan. + */ + first_name_kana?: string; + + /** + * The Kanji variation of the first name of the person who will be filling out a Stripe application. + * Must prefill stripe_user[country] with JP, as this parameter is only relevant for Japan. + */ + first_name_kanji?: string; + + /** + * The Kana variation of the last name of the person who will be filling out a Stripe application. + * Must prefill stripe_user[country] with JP, as this parameter is only relevant for Japan. + */ + last_name_kana?: string; + + /** + * The Kanji variation of the last name of the person who will be filling out a Stripe application. + * Must prefill stripe_user[country] with JP, as this parameter is only relevant for Japan. + */ + last_name_kanji?: string; + + /** + * The gender of the person who will be filling out a Stripe application. (International regulations require either male or female.) + * Must prefill stripe_user[country] with JP, as this parameter is only relevant for Japan. + */ + gender?: string; + + /** + * Standard only + * The Kana variation of the address block. + * This parameter is only relevant for Japan. You must prefill stripe_user[country] with JP and stripe_user[zip] with a valid Japanese postal code to use this parameter. + */ + block_kana?: string; + + /** + * Standard only + * The Kanji variation of the address block. + * This parameter is only relevant for Japan. You must prefill stripe_user[country] with JP and stripe_user[zip] with a valid Japanese postal code to use this parameter. + */ + block_kanji?: string; + + /** + * Standard only + * The Kana variation of the address building. + * This parameter is only relevant for Japan. You must prefill stripe_user[country] with JP and stripe_user[zip] with a valid Japanese postal code to use this parameter. + */ + building_kana?: string; + + /** + * Standard only + * The Kanji variation of the address building. + * This parameter is only relevant for Japan. You must prefill stripe_user[country] with JP and stripe_user[zip] with a valid Japanese postal code to use this parameter. + */ + building_kanji?: string; + } + } + + interface OAuthAuthorizeUrlOptions { + express?: boolean; + } + + interface OAuthDeauthorizeParams { + /** + * The client_id of the application that you'd like to disconnect the account from. + * The account must be connected to this application. + */ + client_id: string; + + /** + * The account you'd like to disconnect from. + */ + stripe_user_id: string; + } + + interface OAuthTokenParams { + /** + * `'authorization_code'` when turning an authorization code into an access token, or `'refresh_token'` when using a refresh token to get a new access token. + */ + grant_type: 'authorization_code' | 'refresh_token'; + + /** + * The value of the code or refresh_token, depending on the grant_type. + */ + code?: string; + + /** + * The value of the code or refresh_token, depending on the grant_type. + */ + refresh_token?: string; + + /** + * When requesting a new access token from a refresh token, any scope that has an equal or lesser scope as the refresh token. Has no effect when requesting an access token from an authorization code. + * Defaults to the scope of the refresh token. + */ + scope?: string; + + /** + * Express only + * Check whether the suggested_capabilities were applied to the connected account. + */ + assert_capabilities?: string; + } + + export class OAuthResource { + /** + * Get a URL to which you can send a user to complete the OAuth flow to authorize their account. + * @docs https://stripe.com/docs/connect/oauth-reference#get-authorize + */ + authorizeUrl( + params?: OAuthAuthorizeUrlParams, + options?: OAuthAuthorizeUrlOptions + ): string; + + /** + * Used for revoking access to an account. + * @docs https://stripe.com/docs/connect/oauth-reference#post-deauthorize + */ + deauthorize( + params: OAuthDeauthorizeParams, + options?: Stripe.RequestOptions + ): Promise; + + /** + * Turning an authorization_code into an access_token, or get a new access token using a refresh_token. + * @docs https://stripe.com/docs/connect/oauth-reference#post-token + */ + token( + params: OAuthTokenParams, + options?: Stripe.RequestOptions + ): Promise; + } + } +} diff --git a/types/Webhooks.d.ts b/types/Webhooks.d.ts new file mode 100644 index 0000000000..ad6a42b125 --- /dev/null +++ b/types/Webhooks.d.ts @@ -0,0 +1,87 @@ +/// + +declare module 'stripe' { + namespace Stripe { + export class Webhooks { + /** + * Constructs and verifies the signature of an Event from the provided details. + * + * @throws Stripe.errors.StripeSignatureVerificationError + */ + constructEvent( + /** + * Raw text body payload received from Stripe. + */ + payload: string | Buffer, + + /** + * Value of the `stripe-signature` header from Stripe. + */ + header: string, + + /** + * Your Webhook Signing Secret for this endpoint (eg; 'whsec_...'). + * You can get this [in your dashboard](https://dashboard.stripe.com/webhooks). + */ + secret: string, + + /** + * Seconds of tolerance on timestamps. + */ + tolerance?: number + ): Stripe.Event; + + /** + * Generates a header to be used for webhook mocking + */ + generateTestHeaderString(opts: { + /** + * JSON stringified payload object, containing the 'id' and 'object' parameters. + */ + payload: string; + + /** + * Timestamp of the header. Defaults to Date.now(). + */ + timestamp?: number; + + /** + * Stripe webhook secret, eg; 'whsec_...'. + */ + secret: string; + + /** + * Version of API to hit. Defaults to 'v1'. + */ + scheme?: string; + + /** + * Computed webhook signature. + */ + signature?: string; + }): string; + + signature: Signature; + } + + export class Signature { + EXPECTED_SCHEME: 'v1'; + + _computeSignature(payload: string, secret: string): string; + verifyHeader( + payload: string, + header: string, + secret: string, + tolerance?: number + ): void; + parseHeader( + header: string, + scheme?: string + ): { + t: number; + v0: string; + v1: string; + }; + } + } +} diff --git a/types/lib.d.ts b/types/lib.d.ts new file mode 100644 index 0000000000..9e9ee27b88 --- /dev/null +++ b/types/lib.d.ts @@ -0,0 +1,333 @@ +/// +/// + +import {Agent} from 'http'; + +declare module 'stripe' { + namespace Stripe { + export type LatestApiVersion = '2019-12-03'; + export type HttpAgent = Agent; + + export interface StripeConfig { + /** + * This library's types only reflect the latest API version. + * + * We recommend upgrading your account's API Version to the latest version + * if you wish to use TypeScript with this library. + * + * If you wish to remain on your account's default API version, + * you may pass `null` or another version instead of the latest version, + * and add a `@ts-ignore` comment here and anywhere the types differ between API versions. + * + * @docs https://stripe.com/docs/api/versioning + */ + apiVersion: LatestApiVersion; + + /** + * Indicate that you are using TypeScript. + * This currently has no runtime effect other than adding "TypeScript" to your user-agent. + */ + typescript: true; + + /** + * Enables automatic network retries with exponential backoff, up to the specified number of retries (default 0). + * Idempotency keys](https://stripe.com/docs/api/idempotent_requests) are added where appropriate to prevent duplication. + * @docs https://github.com/stripe/stripe-node#network-retries + */ + maxNetworkRetries?: number; + + /** + * Use a custom http(s) agent. + * Useful for making requests through a proxy. + */ + httpAgent?: HttpAgent; + + /** + * Request timeout in milliseconds. + * The default is Node's default of 120 seconds. + */ + timeout?: number; + + host?: string; + + port?: string | number; + + /** + * Pass `telemetry: false` to disable headers that provide Stripe + * with data about usage of the API. + * Currently, the only telemetry we send is latency metrics. + */ + telemetry?: boolean; + } + + export interface RequestOptions { + /** + * Use a specific API Key for this request. + * For Connect, we recommend using `stripeAccount` instead. + */ + apiKey?: string; + /** @deprecated Please use apiKey instead. */ + api_key?: string; + + /** + * See the [idempotency key docs](https://stripe.com/docs/api/idempotency). + */ + idempotencyKey?: string; + /** @deprecated Please use idempotencyKey instead. */ + idempotency_key?: string; + + /** + * An account id on whose behalf you wish to make a request. + */ + stripeAccount?: string; + /** @deprecated Please use stripeAccount instead. */ + stripe_account?: string; + + /** + * The [API Version](https://stripe.com/docs/upgrades) to use for a given request (eg; '2019-12-03'). + */ + stripeVersion?: string; + /** @deprecated Please use stripeVersion instead. */ + stripe_version?: string; + + /** + * Specify the number of requests to retry in event of error. + * This overrides a default set on the Stripe object's config argument. + */ + maxNetworkRetries?: number; + + /** + * Specify a timeout for this request in milliseconds. + */ + timeout?: number; + } + + /** + * A container for paginated lists of objects. + * The array of objects is on the `.data` property, + * and `.has_more` indicates whether there are additional objects beyond the end of this list. + * + * Learn more in Stripe's [pagination docs](https://stripe.com/docs/api/pagination?lang=node) + * or, when iterating over many items, try [auto-pagination](https://github.com/stripe/stripe-node#auto-pagination) instead. + */ + export interface ApiList { + object: 'list'; + + data: Array; + + /** + * True if this list has another page of items after this one that can be fetched. + */ + has_more: boolean; + + /** + * The URL where this list can be accessed. + */ + url: string; + + // Looking for `total_count`? It is deprecated; please do not use it. + } + + export interface ApiListPromise + extends Promise>, + AsyncIterableIterator { + autoPagingEach( + handler: (item: T) => boolean | void | Promise + ): void; + + autoPagingToArray(opts: {limit: number}): Promise>; + } + + export interface RequestEvent { + api_version: string; + account?: string; + idempotency_key?: string; + method: string; + path: string; + request_start_time: number; + } + + export interface ResponseEvent { + api_version: string; + account?: string; + idempotency_key?: string; + method: string; + path: string; + status: number; + request_id: string; + elapsed: number; + request_start_time: number; + request_end_time: number; + } + + /** + * Identify your plugin. + * @docs https://stripe.com/docs/building-plugins?lang=node#setappinfo + */ + export interface AppInfo { + name: string; + partner_id?: string; + url?: string; + version?: string; + } + + export type Errors = { + StripeError: typeof StripeError; + StripeCardError: typeof StripeCardError; + StripeInvalidRequestError: typeof StripeInvalidRequestError; + StripeAPIError: typeof StripeAPIError; + StripeAuthenticationError: typeof StripeAuthenticationError; + StripePermissionError: typeof StripePermissionError; + StripeRateLimitError: typeof StripeRateLimitError; + StripeConnectionError: typeof StripeConnectionError; + StripeSignatureVerificationError: typeof StripeSignatureVerificationError; + StripeIdempotencyError: typeof StripeIdempotencyError; + }; + + export type RawErrorType = + | 'card_error' + | 'invalid_request_error' + | 'api_error' + | 'idempotency_error' + | 'rate_limit_error' + | 'authentication_error' + | 'invalid_grant'; + + class StripeError { + static populate(type: RawErrorType): StripeError; + + /** + * A human-readable message giving more details about the error. For card errors, these messages can + * be shown to your users. + */ + readonly message: string; + + readonly type: keyof Errors; + + /** + * See the "error types" section at https://stripe.com/docs/api/errors + */ + readonly rawType: RawErrorType; + + /** + * For card errors, a short string describing the kind of card error that occurred. + * + * @docs https://stripe.com/docs/error-codes + */ + readonly code?: string; + + /** + * Typically a 4xx or 5xx. + */ + readonly statusCode?: number; + + readonly raw: unknown; + + readonly headers: { + [key: string]: string; + }; + + readonly requestId: string; + + /** + * The parameter the error relates to if the error is parameter-specific. You can use this to display a + * message near the correct form field, for example. + */ + readonly param?: string; + + /** @deprecated */ + readonly detail?: unknown; + + readonly charge?: string; + readonly decline_code?: string; + readonly payment_intent?: PaymentIntent; + readonly payment_method?: PaymentMethod; + readonly setup_intent?: SetupIntent; + readonly source?: Source; + } + + /** + * Card errors are the most common type of error you should expect to handle. + * They result when the user enters a card that can't be charged for some reason. + */ + class StripeCardError extends StripeError { + readonly type: 'StripeCardError'; + readonly rawType: 'card_error'; + + /** + * @docs https://stripe.com/docs/declines/codes + */ + readonly decline_code: string; + } + + /** + * Invalid request errors arise when your request has invalid parameters. + */ + class StripeInvalidRequestError extends StripeError { + readonly type: 'StripeInvalidRequestError'; + readonly rawType: 'invalid_request_error'; + } + + /** + * API errors cover any other type of problem (e.g., a temporary problem with Stripe's servers), + * and are extremely uncommon. + * + * It could also be raised in the case that a new error has been introduced in the API, + * but this version of the library doesn't know how to handle it. + */ + class StripeAPIError extends StripeError { + readonly type: 'StripeAPIError'; + readonly rawType: 'api_error'; + } + + /** + * Failure to properly authenticate yourself in the request. + */ + class StripeAuthenticationError extends StripeError { + readonly type: 'StripeAuthenticationError'; + readonly rawType: 'authentication_error'; + } + + /** + * Access was attempted on a resource that wasn't allowed. + */ + class StripePermissionError extends StripeError { + readonly type: 'StripePermissionError'; + } + + /** + * Too many requests hit the API too quickly. + * @docs https://stripe.com/docs/rate-limits + */ + class StripeRateLimitError extends StripeError { + readonly type: 'StripeRateLimitError'; + readonly rawType: 'rate_limit_error'; + } + + /** + * The library cannot connect to Stripe. + * This can happen for a variety of reasons, + * such as loss of network connectivity or a bad TLS certificate. + */ + class StripeConnectionError extends StripeError { + readonly type: 'StripeConnectionError'; + } + + /** + * The signature verification for a webhook failed. + * @docs https://stripe.com/docs/webhooks/signatures + */ + class StripeSignatureVerificationError extends StripeError { + readonly type: 'StripeSignatureVerificationError'; + } + + /** + * Idempotency errors occur when an `Idempotency-Key` is re-used on a request that does not match the first request's API endpoint and parameters. + * @docs https://stripe.com/docs/api/idempotent_requests?lang=node + */ + class StripeIdempotencyError extends StripeError { + readonly type: 'StripeIdempotencyError'; + readonly rawType: 'idempotency_error'; + } + } +} diff --git a/types/shared.d.ts b/types/shared.d.ts new file mode 100644 index 0000000000..d343ebdde4 --- /dev/null +++ b/types/shared.d.ts @@ -0,0 +1,224 @@ +declare module 'stripe' { + namespace Stripe { + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + interface Metadata { + [name: string]: string; + } + + /** + * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * While you can send values as numbers, they will be returned as strings. + */ + interface MetadataParam { + [name: string]: string | number | null; + } + + /** + * The Address object. + */ + interface Address { + /** + * City/District/Suburb/Town/Village. + */ + city: string | null; + + /** + * 2-letter country code. + */ + country: string | null; + + /** + * Address line 1 (Street address/PO Box/Company name). + */ + line1: string | null; + + /** + * Address line 2 (Apartment/Suite/Unit/Building). + */ + line2: string | null; + + /** + * ZIP or postal code. + */ + postal_code: string | null; + + /** + * State/County/Province/Region. + */ + state: string | null; + } + + interface JapanAddress { + /** + * City/Ward. + */ + city: string | null; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string | null; + + /** + * Block/Building number. + */ + line1: string | null; + + /** + * Building details. + */ + line2: string | null; + + /** + * Zip/Postal Code. + */ + postal_code: string | null; + + /** + * Prefecture. + */ + state: string | null; + + /** + * Town/cho-me. + */ + town: string | null; + } + + interface AccountAddressParam { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State, county, province, or region. + */ + state?: string; + } + + interface AddressParam extends AccountAddressParam { + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1: string; + } + + interface JapanAddressParam { + /** + * City or ward. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country?: string; + + /** + * Block or building number. + */ + line1?: string; + + /** + * Building details. + */ + line2?: string; + + /** + * Postal code. + */ + postal_code?: string; + + /** + * Prefecture. + */ + state?: string; + + /** + * Town or cho-me. + */ + town?: string; + } + + /** + * The resulting source of [a Connect platform debiting a connected account](https://stripe.com/docs/connect/account-debits#charging-a-connected-account). + */ + type AccountDebitSource = { + id: string; + object: 'account'; + }; + + type CustomerSource = + | AccountDebitSource + | AlipayAccount + | BankAccount + | BitcoinReceiver + | Card + | Source; + + interface RangeQueryParam { + /** + * Minimum value to filter by (exclusive) + */ + gt?: number; + + /** + * Minimum value to filter by (inclusive) + */ + gte?: number; + + /** + * Maximum value to filter by (exclusive) + */ + lt?: number; + + /** + * Maximum value to filter by (inclusive) + */ + lte?: number; + } + + /** + * @docs https://stripe.com/docs/api/pagination + */ + interface PaginationParams { + /** + * 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. + */ + ending_before?: string; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + */ + limit?: number; + + /** + * 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. + */ + starting_after?: string; + } + } +} diff --git a/types/test/tsconfig.json b/types/test/tsconfig.json new file mode 100644 index 0000000000..cc54eb6506 --- /dev/null +++ b/types/test/tsconfig.json @@ -0,0 +1,67 @@ +{ + "files": ["./typescriptTest.ts"], + "compilerOptions": { + /* Basic Options */ + "incremental": false /* Enable incremental compilation */, + "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + "lib": ["esnext"], + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + "rootDir": "./" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + "noEmit": true /* Do not emit outputs. */, + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, + "strictNullChecks": true /* Enable strict null checks. */, + "strictFunctionTypes": true /* Enable strict checking of function types. */, + "strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */, + "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, + "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, + "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + // "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} diff --git a/types/test/typescriptTest.ts b/types/test/typescriptTest.ts new file mode 100644 index 0000000000..c14e51b02e --- /dev/null +++ b/types/test/typescriptTest.ts @@ -0,0 +1,137 @@ +/** + * This file does not exist to be executed, just compiled, + * so that we can ensure that the definition files + * only reference names that exist, + * and to perform a basic sanity check that types are exported as intended. + */ + +/// +import Stripe from 'stripe'; + +let stripe = new Stripe('sk_test_123', { + apiVersion: '2019-12-03', + typescript: true, +}); + +// @ts-ignore lazily ignore apiVersion requirement. +stripe = new Stripe('sk_test_123'); + +stripe = new Stripe('sk_test_123', { + // @ts-ignore ignore specific apiVersion. + apiVersion: '2019-11-05', +}); + +stripe = new Stripe('sk_test_123', { + // @ts-ignore ignore default apiVersion. + apiVersion: null, +}); + +// Check config object. +stripe = new Stripe('sk_test_123', { + apiVersion: '2019-12-03', + typescript: true, + maxNetworkRetries: 1, + timeout: 1000, + host: 'api.example.com', + port: 123, + telemetry: true, +}); + +stripe.setTimeout(3000); +stripe.setAppInfo({ + name: 'my-wordpress-plugin', +}); + +stripe.setHost('host', 'port', 'protocol'); + +(async (): Promise => { + const params: Stripe.CustomerCreateParams = { + description: 'test', + }; + const opts: Stripe.RequestOptions = { + stripeVersion: '2019-12-03', + }; + const customer: Stripe.Customer = await stripe.customers.create(params, opts); + + // Check no opts: + await stripe.customers.create(params); + + // Check multiple dispatch: + let product = await stripe.products.retrieve('prod_123', opts); + product = await stripe.products.retrieve('prod_123', {expand: []}, opts); + + const charge: Stripe.Charge = await stripe.charges.retrieve('ch_123', { + expand: ['customer'], + }); + + // Ignore null case. + if (!charge.customer) throw Error('guard'); + + // Check you can cast an expandable field to the object: + const cusEmail: string | null = (charge.customer as Stripe.Customer).email; + // Check you can cast an expandable field to a string: + const btId: string = charge.balance_transaction as string; + + // Check you can deal with deleted: + if ( + typeof charge.customer !== 'string' && + // Not sure why `!charge.customer.deleted` doesn't work, it seems to in a playground: + // https://www.typescriptlang.org/play/index.html#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChnJwBcyAzmFKAOYDc+yADpQgNYA2AnieZSLfXABGiFtwrVkAH2QgArmzZSZsgLaDodAmA4MIJAOQxM+zcgAmENhEhmA-CQBu6YGboBfXKEixEKACKW1hBmGFh4Wjp6yIbGphZWNiQUshDuuLjausgAsnAc6qHIALxomEoBCcGh6RYIbHBQKAjoIOTIAB4kufkQ1Z4wyAAUAITtAHTxQWYAlDj0za1ghGK8VMUdY3C4Hri19Y3IC21cpVjSFVOF0jwS0nIK6cADgxzIAGRvyJkQ6AOvw0USvobnx9O9PsMOBNAjZZuFDi02sQyOI+OsoVsPEA + // Might be a complexity limit with our resources: https://github.com/microsoft/TypeScript/pull/30779/files#diff-c3ed224e4daa84352f7f1abcd23e8ccaR13219 + !('deleted' in charge.customer) + ) { + const created: number = charge.customer.created; + } + const r = Math.random() - 0.5; + // Okay, this is how I hope people can deal with deleted: + const maybeCoupon: Stripe.Coupon | Stripe.DeletedCoupon = await (r + ? stripe.coupons.retrieve('25_off') + : stripe.coupons.del('25_off')); + if (maybeCoupon.deleted) { + const d: true = maybeCoupon.deleted; + } else { + // Here, TS knows it's a full Coupon. + const created: number = maybeCoupon.created; + } + + for await (const customer of stripe.customers.list()) { + const {id} = customer as Stripe.Customer; + if (id === 'hi') { + break; + } + } + + const cusList: Stripe.ApiList< + Stripe.Customer + > = await stripe.customers.list(); + + const aThousandCustomers: Array< + Stripe.Customer + > = await stripe.customers.list().autoPagingToArray({limit: 1000}); + + const nothing: void = await stripe.customers + .list() + .autoPagingEach((customer: Stripe.Customer) => { + if (customer.id === 'one') { + return false; + } + if (customer.id === 'two') { + return Promise.resolve(false); + } + if (customer.id === 'three') { + return Promise.resolve(); + } + return undefined; + }); + + try { + await stripe.paymentIntents.create({amount: 100, currency: 'USD'}); + } catch (err) { + if (err instanceof stripe.errors.StripeCardError) { + const declineCode: string = err.decline_code; + } + if (err instanceof Stripe.errors.StripeCardError) { + const declineCode: string = err.decline_code; + } + } +})(); diff --git a/yarn.lock b/yarn.lock index f2d177f08b..ad57c92f11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -90,15 +90,83 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" - integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + +"@types/json-schema@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" + integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== + +"@types/node@^13.1.0": + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.0.tgz#225cbaac5fdb2b9ac651b02c070d8aa3c37cc812" + integrity sha512-zwrxviZS08kRX40nqBrmERElF2vpw4IUTd5khkhBTfFH8AOaeoLVx48EC4+ZzS2/Iga7NevncqnsUSYjM4OWYA== + +"@typescript-eslint/eslint-plugin@^2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.13.0.tgz#57e933fe16a2fc66dbac059af0d6d85d921d748e" + integrity sha512-QoiANo0MMGNa8ej/yX3BrW5dZj5d8HYcKiM2fyYUlezECqn8Xc7T/e4EUdiGinn8jhBrn+9X47E9TWaaup3u1g== + dependencies: + "@typescript-eslint/experimental-utils" "2.13.0" + eslint-utils "^1.4.3" + functional-red-black-tree "^1.0.1" + regexpp "^3.0.0" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.13.0.tgz#958614faa6f77599ee2b241740e0ea402482533d" + integrity sha512-+Hss3clwa6aNiC8ZjA45wEm4FutDV5HsVXPl/rDug1THq6gEtOYRGLqS3JlTk7mSnL5TbJz0LpEbzbPnKvY6sw== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.13.0" + eslint-scope "^5.0.0" -acorn@^6.0.7: - version "6.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" - integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== +"@typescript-eslint/parser@^2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.13.0.tgz#ea1ab394cf9ca17467e3da7f96eca9309f57c326" + integrity sha512-vbDeLr5QRJ1K7x5iRK8J9wuGwR9OVyd1zDAY9XFAQvAosHVjSVbDgkm328ayE6hx2QWVGhwvGaEhedcqAbfQcA== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.13.0" + "@typescript-eslint/typescript-estree" "2.13.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.13.0.tgz#a2e746867da772c857c13853219fced10d2566bc" + integrity sha512-t21Mg5cc8T3ADEUGwDisHLIubgXKjuNRbkpzDMLb7/JMmgCe/gHM9FaaujokLey+gwTuLF5ndSQ7/EfQqrQx4g== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + +acorn-jsx@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" + integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== + +acorn@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" + integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== + +ajv@^6.10.0: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" ajv@^6.5.5, ajv@^6.9.1: version "6.10.0" @@ -115,10 +183,12 @@ ansi-colors@3.2.3: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== -ansi-escapes@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" - integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== +ansi-escapes@^4.2.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== + dependencies: + type-fest "^0.8.1" ansi-regex@^2.0.0: version "2.1.1" @@ -135,6 +205,11 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -291,12 +366,12 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== dependencies: - restore-cursor "^2.0.0" + restore-cursor "^3.1.0" cli-width@^2.0.0: version "2.2.0" @@ -504,6 +579,11 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + end-of-stream@^1.1.0: version "1.4.1" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" @@ -568,76 +648,77 @@ eslint-plugin-prettier@^3.0.1: dependencies: prettier-linter-helpers "^1.0.0" -eslint-scope@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" - integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.3.1: - version "1.4.2" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" - integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== +eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== dependencies: - eslint-visitor-keys "^1.0.0" + eslint-visitor-keys "^1.1.0" -eslint-visitor-keys@^1.0.0: +eslint-visitor-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" - integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== +eslint@^6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^5.0.1" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" + glob-parent "^5.0.0" + globals "^12.1.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.2.2" - js-yaml "^3.13.0" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.11" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" + optionator "^0.8.3" progress "^2.0.0" regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" -espree@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" - integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== +espree@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" + integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.1.0" + acorn-jsx "^5.1.0" + eslint-visitor-keys "^1.1.0" esprima@^4.0.0: version "4.0.1" @@ -720,15 +801,15 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= -fast-levenshtein@~2.0.4: +fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= +figures@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" + integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== dependencies: escape-string-regexp "^1.0.5" @@ -847,6 +928,13 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +glob-parent@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + glob@7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" @@ -859,7 +947,7 @@ glob@7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.2, glob@^7.1.3: +glob@^7.1.3: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -871,11 +959,30 @@ glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0, globals@^11.7.0: +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globals@^12.1.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" + integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== + dependencies: + type-fest "^0.8.1" + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" @@ -991,22 +1098,22 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -inquirer@^6.2.2: - version "6.3.1" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.3.1.tgz#7a413b5e7950811013a3db491c61d1f3b776e8e7" - integrity sha512-MmL624rfkFt4TG9y/Jvmt8vdmOo836U7Y0Hxr2aFk3RelZEGX4Igk0KabWrcaaZaTv9uzglOqWh1Vly+FAWAXA== +inquirer@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.1.tgz#13f7980eedc73c689feff3994b109c4e799c6ebb" + integrity sha512-V1FFQ3TIO15det8PijPLFR9M9baSlnRs9nL7zWu1MNVA2T9YVl9ZbrHJhYs7e9X8jeMZ3lr2JH/rdHFgNCBdYw== dependencies: - ansi-escapes "^3.2.0" + ansi-escapes "^4.2.1" chalk "^2.4.2" - cli-cursor "^2.1.0" + cli-cursor "^3.1.0" cli-width "^2.0.0" external-editor "^3.0.3" - figures "^2.0.0" - lodash "^4.17.11" - mute-stream "0.0.7" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" run-async "^2.2.0" - rxjs "^6.4.0" - string-width "^2.1.0" + rxjs "^6.5.3" + string-width "^4.1.0" strip-ansi "^5.1.0" through "^2.3.6" @@ -1040,6 +1147,11 @@ is-date-object@^1.0.1: resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -1052,6 +1164,18 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -1148,7 +1272,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.13.1, js-yaml@^3.11.0, js-yaml@^3.13.0, js-yaml@^3.13.1: +js-yaml@3.13.1, js-yaml@^3.11.0, js-yaml@^3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -1244,7 +1368,12 @@ lodash.flattendeep@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= -lodash@^4.17.11, lodash@^4.17.5: +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + +lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.5: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -1321,12 +1450,7 @@ mime-types@^2.1.12, mime-types@~2.1.19: dependencies: mime-db "1.40.0" -mimic-fn@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" - integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== - -mimic-fn@^2.0.0: +mimic-fn@^2.0.0, mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== @@ -1410,10 +1534,10 @@ ms@2.1.1, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== natural-compare@^1.4.0: version "1.4.0" @@ -1546,12 +1670,12 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" -onetime@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== dependencies: - mimic-fn "^1.0.0" + mimic-fn "^2.1.0" optimist@^0.6.1: version "0.6.1" @@ -1561,17 +1685,17 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= +optionator@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== dependencies: deep-is "~0.1.3" - fast-levenshtein "~2.0.4" + fast-levenshtein "~2.0.6" levn "~0.3.0" prelude-ls "~1.1.2" type-check "~0.3.2" - wordwrap "~1.0.0" + word-wrap "~1.2.3" os-homedir@^1.0.1: version "1.0.2" @@ -1661,11 +1785,6 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= - path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -1797,6 +1916,11 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +regexpp@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" + integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== + release-zalgo@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/release-zalgo/-/release-zalgo-1.0.0.tgz#09700b7e5074329739330e535c5a90fb67851730" @@ -1857,12 +1981,12 @@ resolve@^1.10.0: dependencies: path-parse "^1.0.6" -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== dependencies: - onetime "^2.0.0" + onetime "^5.1.0" signal-exit "^3.0.2" rimraf@2.6.3, rimraf@^2.6.2, rimraf@^2.6.3: @@ -1879,10 +2003,10 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" -rxjs@^6.4.0: - version "6.5.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.1.tgz#f7a005a9386361921b8524f38f54cbf80e5d08f4" - integrity sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg== +rxjs@^6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" @@ -1896,7 +2020,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -"semver@2 || 3 || 4 || 5", semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: +"semver@2 || 3 || 4 || 5", semver@^5.5.0, semver@^5.6.0, semver@^5.7.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== @@ -1906,6 +2030,11 @@ semver@^6.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65" integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ== +semver@^6.1.2, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -2014,7 +2143,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -2031,6 +2160,15 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -2045,13 +2183,20 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.1.0: +strip-ansi@^5.1.0, strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" @@ -2062,11 +2207,16 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= -strip-json-comments@2.0.1, strip-json-comments@^2.0.1: +strip-json-comments@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + supports-color@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a" @@ -2143,11 +2293,23 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= +tslib@^1.8.1: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -2172,6 +2334,16 @@ type-detect@^4.0.0, type-detect@^4.0.5: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +typescript@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== + uglify-js@^3.1.4: version "3.5.11" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.11.tgz#833442c0aa29b3a7d34344c7c63adaa3f3504f6a" @@ -2192,6 +2364,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -2228,16 +2405,16 @@ wide-align@1.1.3: dependencies: string-width "^1.0.2 || 2" +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= - wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"