Skip to content

Instantly share code, notes, and snippets.

@LinusU LinusU/generate.js
Last active Jul 29, 2018

Embed
What would you like to do?
Stripe TypeScript definition generation
const input = require('./spec3.json')
function titleCase(snake) {
return snake.replace(/(^|_)([a-z])/g, (s) => s.replace('_', '').toUpperCase())
}
function isPrimitive(schema) {
switch (schema.type) {
case 'boolean':
case 'number':
case 'string':
case 'integer':
return true
}
return false
}
function primitiveType(schema) {
switch (schema.type) {
case 'boolean':
case 'number':
case 'string':
return schema.type
case 'integer':
return 'number'
}
throw new Error(`primitiveType called on non-primitve schema`)
}
function isReference(schema) {
return Boolean(schema['$ref'])
}
function referenceType(schema) {
return titleCase(schema['$ref'].replace('#/components/schemas/', ''))
}
function isEnum(schema) {
return Boolean(schema.enum)
}
function enumType(schema) {
return schema.enum.map(v => JSON.stringify(v)).join(' | ')
}
function isAnyOf(schema) {
return Boolean(schema.anyOf)
}
function anyOfType(schema, extra) {
return schema.anyOf.map(a => generateInlineType(a, extra)).join(' | ')
}
function isArray(schema) {
return (schema.type === 'array')
}
function arrayType(schema, extra) {
return schema.items ? `(${generateInlineType(schema.items, extra)})[]` : 'any[]'
}
function objectType(schema, extra) {
const keys = Object.keys(schema.properties)
const properties = []
for (const key of keys) {
const propertySchema = schema.properties[key]
const nullable = propertySchema.nullable || false
const optional = !(schema.required || []).includes(key)
properties.push(`${key}${optional ? '?' : ''}: ${generateInlineType(propertySchema, extra)}${nullable ? ' | null' : ''}`)
}
return `{ ${properties.join(', ')} }`
}
function generateInlineType(schema, extra) {
if (isEnum(schema)) {
return enumType(schema)
} else if (isPrimitive(schema)) {
return primitiveType(schema)
} else if (isReference(schema)) {
return referenceType(schema)
} else if (isAnyOf(schema)) {
return anyOfType(schema, extra)
} else if (isArray(schema)) {
return arrayType(schema, extra)
} else if (schema.type === 'object' && !schema.properties) {
return '{ [key: string]: string }'
} else if (schema.type === 'object' && schema.title) {
extra.push(generateType(schema.title, schema))
return schema.title
} else if (schema.type === 'object') {
return objectType(schema)
} else {
throw new Error('Not implemented')
}
}
function generateType(name, schema) {
if (schema.type === 'object') {
const keys = Object.keys(schema.properties)
const properties = []
const extra = []
for (const key of keys) {
const propertySchema = schema.properties[key]
const nullable = propertySchema.nullable || false
const optional = !(schema.required || []).includes(key)
if (propertySchema.description) {
properties.push(' /**')
properties.push(' * ' + propertySchema.description)
properties.push(' */')
}
properties.push(` ${key}${optional ? '?' : ''}: ${generateInlineType(propertySchema, extra)}${nullable ? ' | null' : ''}`)
}
return `${extra.length ? extra.join('\n') + '\n' : ''}interface ${name} {\n${properties.join('\n')}\n}\n`
} else if (schema.anyOf) {
return `type ${name} = ${generateInlineType(schema)}\n`
} else {
console.error('Unknown schema type (not object nor anyOf)')
}
}
for (const [id, schema] of Object.entries(input.components.schemas)) {
if (id === 'error') continue
console.log(generateType(titleCase(id), schema))
}
interface ExternalAccountList {
/**
* The list contains all external accounts that have been attached to the Stripe account. These may be bank accounts or cards.
*/
data: (Card | BankAccount)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface Account {
/**
* (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for this account (at least 128px x 128px)
*/
business_logo?: string | FileUpload | null
/**
* The publicly visible name of the business
*/
business_name?: string | null
/**
* The publicly visible website of the business
*/
business_url?: string | null
/**
* Whether the account can create live charges
*/
charges_enabled: boolean
/**
* The country of the account
*/
country: string
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created?: number
/**
* A Boolean indicating if Stripe should try to reclaim negative balances from an attached bank account. See our [Understanding Connect Account Balances](/docs/connect/account-balances) documentation for details.
*/
debit_negative_balances?: boolean | null
/**
* Account-level settings to automatically decline certain types of charges regardless of the decision of the card issuer
*/
decline_charge_on?: AccountDeclineChargeOn | null
/**
* The currency this account has chosen to use as the default
*/
default_currency: string
/**
* Whether account details have been submitted. Standard accounts cannot receive payouts before this is true.
*/
details_submitted: boolean
/**
* The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts.
*/
display_name?: string | null
/**
* The primary user's email address.
*/
email?: string | null
/**
* External accounts (bank accounts and debit cards) currently attached to this account
*/
external_accounts?: ExternalAccountList
/**
* Unique identifier for the object.
*/
id: string
/**
* Information about the legal entity itself, including about the associated account representative
*/
legal_entity?: LegalEntity | 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?: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "account"
/**
* Details on when funds from charges are available, and when they are paid out to an external account. See our [Setting Bank and Debit Card Payouts](/docs/connect/bank-transfers#payout-information) documentation for details.
*/
payout_schedule?: TransferSchedule | null
/**
* 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.
*/
payout_statement_descriptor?: string | null
/**
* Whether Stripe can send payouts to this account
*/
payouts_enabled: boolean
/**
* 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
/**
* The default text that appears on credit card statements when a charge is made [directly on the account](/docs/connect/direct-charges)
*/
statement_descriptor?: string | null
/**
* A publicly shareable support email address for the business
*/
support_email?: string | null
/**
* A publicly shareable support phone number for the business
*/
support_phone?: 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
tos_acceptance?: AccountTosAcceptance
/**
* The Stripe account type. Can be `standard`, `express`, or `custom`.
*/
type: string
verification?: AccountVerification
}
interface AccountDebitAccount {
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "account"
}
interface AccountDeclineChargeOn {
/**
* Whether Stripe should automatically decline charges with an incorrect ZIP or postal code. This setting only applies when a ZIP or postal code is provided and the bank specifically marks it as failed.
*/
avs_failure: boolean
/**
* Whether Stripe should automatically decline charges with an incorrect CVC. This setting only applies when a CVC is provided and the bank specifically marks it as failed.
*/
cvc_failure: boolean
}
interface AccountTosAcceptance {
/**
* 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
}
interface AccountVerification {
/**
* A string describing the reason for this account being unable to create charges or receive payouts, if that is the case. Can be `rejected.fraud`, `rejected.terms_of_service`, `rejected.listed`, `rejected.other`, `fields_needed`, `listed`, `under_review`, or `other`.
*/
disabled_reason?: string | null
/**
* By what time the `fields_needed` must be provided. If this date is in the past, the account is already in bad standing, and providing `fields_needed` is necessary to re-enable payouts and prevent other consequences. If this date is in the future, `fields_needed` must be provided to ensure the account remains in good standing.
*/
due_by?: number | null
/**
* Field names that need to be provided for the account to remain in good standing. Nested fields are separated by `.` (for example, `legal_entity.first_name`).
*/
fields_needed: any[]
}
interface ExternalAccountList {
/**
* The list contains all external accounts that have been attached to the Stripe account. These may be bank accounts or cards.
*/
data: (Card | BankAccount)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface AccountWithKeys {
/**
* (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for this account (at least 128px x 128px)
*/
business_logo?: string | FileUpload | null
/**
* The publicly visible name of the business
*/
business_name?: string | null
/**
* The publicly visible website of the business
*/
business_url?: string | null
/**
* Whether the account can create live charges
*/
charges_enabled: boolean
/**
* The country of the account
*/
country: string
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created?: number
/**
* A Boolean indicating if Stripe should try to reclaim negative balances from an attached bank account. See our [Understanding Connect Account Balances](/docs/connect/account-balances) documentation for details.
*/
debit_negative_balances?: boolean | null
/**
* Account-level settings to automatically decline certain types of charges regardless of the decision of the card issuer
*/
decline_charge_on?: AccountDeclineChargeOn | null
/**
* The currency this account has chosen to use as the default
*/
default_currency: string
/**
* Whether account details have been submitted. Standard accounts cannot receive payouts before this is true.
*/
details_submitted: boolean
/**
* The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts.
*/
display_name?: string | null
/**
* The primary user's email address.
*/
email?: string | null
/**
* External accounts (bank accounts and debit cards) currently attached to this account
*/
external_accounts?: ExternalAccountList
/**
* Unique identifier for the object.
*/
id: string
keys: { [key: string]: string }
/**
* Information about the legal entity itself, including about the associated account representative
*/
legal_entity?: LegalEntity | 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?: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "account"
/**
* Details on when funds from charges are available, and when they are paid out to an external account. See our [Setting Bank and Debit Card Payouts](/docs/connect/bank-transfers#payout-information) documentation for details.
*/
payout_schedule?: TransferSchedule | null
/**
* 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.
*/
payout_statement_descriptor?: string | null
/**
* Whether Stripe can send payouts to this account
*/
payouts_enabled: boolean
/**
* 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
/**
* The default text that appears on credit card statements when a charge is made [directly on the account](/docs/connect/direct-charges)
*/
statement_descriptor?: string | null
/**
* A publicly shareable support email address for the business
*/
support_email?: string | null
/**
* A publicly shareable support phone number for the business
*/
support_phone?: 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
tos_acceptance?: AccountTosAcceptance
/**
* The Stripe account type. Can be `standard`, `express`, or `custom`.
*/
type: string
verification?: AccountVerification
}
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 AlipayAccount {
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number
customer?: string | Customer | DeletedCustomer | null
/**
* Uniquely identifies the account and will be the same across all Alipay account objects that are linked to the same Alipay account.
*/
fingerprint: string
/**
* Unique identifier for the object.
*/
id: 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?: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "alipay_account"
/**
* 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
}
interface ApplePayDomain {
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number
domain_name: string
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "apple_pay_domain"
}
interface Application {
/**
* Unique identifier for the object.
*/
id: string
/**
* The name of the application.
*/
name?: string | null
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "application"
}
interface FeeRefundList {
data: (FeeRefund)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface BackwardsCompatiblePlatformEarning {
/**
* 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
/**
* 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
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "application_fee"
/**
* 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 | Transfer | 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: FeeRefundList
}
interface Balance {
/**
* Funds that are available to be paid out, whether automatically by Stripe or explicitly via the [transfers API](#transfers). The available balance for each currency and payment type can be found in the `source_types` property.
*/
available: any[]
/**
* 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?: any[]
/**
* Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
*/
livemode: boolean
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "balance"
/**
* 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: any[]
}
interface BalanceTransaction {
/**
* 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: (Fee)[]
/**
* Unique identifier for the object.
*/
id: string
/**
* Net amount of the transaction, in %s.
*/
net: number
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "balance_transaction"
/**
* The Stripe object to which this transaction is related.
*/
source?: string | BitcoinTransaction | Charge | Dispute | FeeRefund | Payout | Transfer | TransferRecipientTransfer | PlatformFee | Refund | ReserveTransaction | TransferReversal | IssuingAuthorization | IssuingTransaction | ConnectCollectionTransfer | Topup | null
/**
* If the transaction's net funds are available in the Stripe balance yet. Either `available` or `pending`.
*/
status: string
/**
* Transaction type: `adjustment`, `application_fee`, `application_fee_refund`, `charge`, `payment`, `payment_failure_refund`, `payment_refund`, `refund`, `transfer`, `transfer_refund`, `payout`, `payout_cancel`, `payout_failure`, `validation`, `stripe_fee`, or `network_cost`.
*/
type: string
}
interface BankAccount {
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
/**
* Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
*/
fingerprint?: string | null
/**
* Unique identifier for the object.
*/
id: string
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?: { [key: string]: string } | null
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "bank_account"
/**
* The routing transit number for the bank account.
*/
routing_number?: string | null
/**
* 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.
*/
status: string
}
interface BitcoinTransactionList {
data: (BitcoinTransaction)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface BitcoinReceiver {
/**
* 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
/**
* 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
/**
* Unique identifier for the object.
*/
id: string
/**
* 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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "bitcoin_receiver"
/**
* 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?: BitcoinTransactionList
/**
* This receiver contains uncaptured funds that can be used for a payment or refunded.
*/
uncaptured_funds: boolean
used_for_payment?: boolean | null
}
interface BitcoinTransaction {
/**
* 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
/**
* 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 receiver to which this transaction was sent.
*/
receiver: string
}
interface 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?: (string)[] | 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
/**
* Three-letter [ISO code for currency](https://stripe.com/docs/payouts). Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency.
*/
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
/**
* Only applicable on accounts (not customers or recipients). This indicates whether this card is the default external account for its currency.
*/
default_for_currency?: boolean | null
/**
* (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
/**
* Unique identifier for the object.
*/
id: 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: { [key: string]: string }
/**
* Cardholder name.
*/
name?: string | null
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "card"
/**
* 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 | TransferRecipient | null
/**
* If the card number is tokenized, this is the method that was used. Can be `apple_pay` or `android_pay`.
*/
tokenization_method?: string | null
}
interface RefundList {
data: (Refund)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface Charge {
/**
* A positive integer 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) representing how much to charge. The minimum amount is $0.50 US or [equivalent in charge currency](https://support.stripe.com/questions/what-is-the-minimum-amount-i-can-charge-with-stripe).
*/
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](/docs/connect/direct-charges#collecting-fees) for details.
*/
application_fee?: string | BackwardsCompatiblePlatformEarning | PlatformFee | null
/**
* 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
/**
* 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
/**
* The account (if any) the charge was made on behalf of, with an automatic transfer. [See the Connect documentation](/docs/connect/destination-charges) for details.
*/
destination?: string | Account | null
/**
* Details about the dispute if the charge has been disputed.
*/
dispute?: string | Dispute | null
/**
* Error code explaining reason for charge failure if available (see [the errors section](/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
/**
* Hash with information on fraud assessments for the charge. Assessments reported by you have the key `user_report` and, if set, possible values of `safe` and `fraudulent`. Assessments from Stripe have the key `stripe_report` and, if set, the value `fraudulent`.
*/
fraud_details?: { [key: string]: string } | null
/**
* Unique identifier for the object.
*/
id: string
/**
* ID of the invoice this charge is for if one exists.
*/
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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "charge"
/**
* The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the [Connect documentation](/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](/docs/declines) for details.
*/
outcome?: ChargeOutcome | null
/**
* `true` if the charge succeeded, or was successfully authorized for later capture.
*/
paid: boolean
/**
* 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
/**
* 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: RefundList
/**
* ID of the review associated with this charge if one exists.
*/
review?: string | RadarReview | null
/**
* Shipping information for the charge.
*/
shipping?: Shipping | null
/**
* For most Stripe users, the source of every charge is a credit or debit card. This hash is then the [card object](#card_object) describing that card.
*/
source: AccountDebitAccount | AlipayAccount | BankAccount | BitcoinReceiver | Card | LimitedAccount | Source
/**
* The transfer ID which created this charge. Only present if the charge came from another Stripe account. [See the Connect documentation](/docs/connect/destination-charges) for details.
*/
source_transfer?: string | Transfer | null
/**
* Extra information about a charge. This will appear on your customer's credit card statement. It must contain at least one letter.
*/
statement_descriptor?: 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
/**
* A string that identifies this transaction as part of a group. See the [Connect documentation](/docs/connect/charges-transfers#grouping-transactions) for details.
*/
transfer_group?: string | null
}
interface ChargeOutcome {
/**
* 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](/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](/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 | RadarRule
/**
* 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](/docs/declines) and [Radar reviews](radar/review) for details.
*/
type: string
}
interface ConnectCollectionTransfer {
/**
* 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
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "connect_collection_transfer"
}
interface CountrySpec {
/**
* The default currency for this country. This applies to both payment methods and bank accounts.
*/
default_currency: string
/**
* 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"
/**
* Currencies that can be accepted in the specific country (for transfers).
*/
supported_bank_account_currencies: { [key: string]: string }
/**
* Currencies that can be accepted in the specified country (for payments).
*/
supported_payment_currencies: (string)[]
/**
* 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: (string)[]
/**
* Countries that can accept transfers from the specified country.
*/
supported_transfer_countries: (string)[]
/**
* Lists the types of verification data needed to keep an account open. Includes 'minimum' fields, which every account must eventually provide, as well as a 'additional' fields, which are only required for some users.
*/
verification_fields: { [key: string]: string }
}
interface 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
/**
* One of `forever`, `once`, and `repeating`. Describes how long a customer who applies this coupon will get the discount.
*/
duration: "forever" | "once" | "repeating"
/**
* If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`.
*/
duration_in_months?: number | null
/**
* Unique identifier for the object.
*/
id: 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
/**
* Maximum number of times this coupon can be redeemed, in total, 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: { [key: string]: string }
/**
* Name of the coupon displayed to customers on for instance invoices or receipts.
*/
name?: string | null
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "coupon"
/**
* 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
/**
* A percise version of `percent_off` that shows floating point values.
*/
percent_off_precise?: 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
}
interface ApmsSourcesSourceList {
/**
* The list contains all payment sources that have been attached to the customer.
*/
data: (AccountDebitAccount | AlipayAccount | BankAccount | BitcoinReceiver | Card | Source)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface SubscriptionList {
data: (Subscription)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface Customer {
/**
* Current balance, if any, being stored on the customer's account. If negative, the customer has credit to apply to the next invoice. If positive, the customer has an amount owed that will be added to the 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 for recurring billing purposes (i.e., subscriptions, invoices, invoice items).
*/
account_balance?: number
/**
* The customer's VAT identification number. Appears on invoices emailed to this customer.
*/
business_vat_id?: 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) the customer can be charged in for recurring billing purposes.
*/
currency?: string | null
/**
* ID of the default source attached to this customer.
*/
default_source?: string | AccountDebitAccount | AlipayAccount | BankAccount | BitcoinReceiver | Card | Source | null
/**
* 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
/**
* Unique identifier for the object.
*/
id: string
/**
* The prefix for the customer used to generate unique invoice numbers.
*/
invoice_prefix?: 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?: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "customer"
/**
* Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
*/
shipping?: CustomerShipping | null
/**
* The customer's payment sources, if any.
*/
sources: ApmsSourcesSourceList
/**
* The customer's current subscriptions, if any.
*/
subscriptions?: SubscriptionList
}
interface CustomerShipping {
address: Address
/**
* Customer name.
*/
name: string
/**
* Customer phone (including extension).
*/
phone?: string | null
}
type CustomerSource = BankAccount | AlipayAccount | BitcoinReceiver | BankAccount | Card | Source
type CustomerSourceCreate = BankAccount | Card | Source
interface DeletedAccount {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "account"
}
interface DeletedApplePayDomain {
/**
* Always true for a deleted object
*/
deleted: true
/**
* 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"
}
interface DeletedBankAccount {
/**
* 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
/**
* 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"
}
interface DeletedCard {
/**
* 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
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "card"
}
interface DeletedCoupon {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "coupon"
}
interface DeletedCustomer {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "customer"
}
interface DeletedDiscount {
/**
* Always true for a deleted object
*/
deleted: true
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "discount"
}
interface DeletedObject {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
}
interface DeletedPlan {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "plan"
}
interface DeletedProduct {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "product"
}
interface DeletedSku {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "sku"
}
interface DeletedSubscriptionItem {
/**
* Always true for a deleted object
*/
deleted: true
/**
* 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"
}
interface DeletedTaxRateTemplate {
/**
* Always true for a deleted object
*/
deleted: true
/**
* 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_template"
}
interface DeletedTransferRecipient {
/**
* Always true for a deleted object
*/
deleted: true
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "recipient"
}
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 Discount {
coupon: Coupon
customer?: string | Customer | DeletedCustomer | null
/**
* 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "discount"
/**
* 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
}
interface 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: (BalanceTransaction)[]
/**
* 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: DisputeEvidence
evidence_details: DisputeEvidenceDetails
/**
* Unique identifier for the object.
*/
id: string
/**
* 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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "dispute"
/**
* Reason given by cardholder for dispute. Possible values are `duplicate`, `fraudulent`, `subscription_canceled`, `product_unacceptable`, `product_not_received`, `unrecognized`, `credit_not_processed`, `general`, `incorrect_account_details`, `insufficient_funds`, `bank_cannot_process`, `debit_not_authorized`, or `customer_initiated`. Read more about [dispute reasons](/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: "charge_refunded" | "lost" | "needs_response" | "under_review" | "warning_closed" | "warning_needs_response" | "warning_under_review" | "won"
}
interface DisputeEvidence {
/**
* 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 | FileUpload | 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 | FileUpload | 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 | FileUpload | 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 | FileUpload | 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 | FileUpload | null
/**
* (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your refund policy, as shown to the customer.
*/
refund_policy?: string | FileUpload | 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 | FileUpload | 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 | FileUpload | 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 | FileUpload | null
/**
* Any additional evidence or statements.
*/
uncategorized_text?: string | null
}
interface DisputeEvidenceDetails {
/**
* 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
}
interface EphemeralKey {
/**
* 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
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "ephemeral_key"
}
interface EphemeralKeyWithSecret {
/**
* 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
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "ephemeral_key"
/**
* The key's secret. You can use this value to make authorized requests to the Stripe API.
*/
secret: string
}
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]: string }
}
type ExternalAccountSource = BankAccount | Card
interface Fee {
/**
* 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
}
interface FeeRefund {
/**
* 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 | PlatformFee
/**
* Unique identifier for the object.
*/
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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "fee_refund"
}
interface 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
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "file"
/**
* The purpose of the file. Possible values are `finance_report_run`, `founders_stock_document`, or `sigma_scheduled_query`.
*/
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 FileUpload {
/**
* 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
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "file_upload"
/**
* The purpose of the uploaded file. Possible values are `business_logo`, `customer_signature`, `dispute_evidence`, `identity_document`, `pci_document`, or `tax_document_user_upload`.
*/
purpose: string
/**
* The size in bytes of the file upload object.
*/
size: number
/**
* The type of the file returned. Returns one of the following: `csv`, `docx`, `gif`, `jpg`, `pdf`, `png`, `xls`, or `xlsx`.
*/
type?: string | null
/**
* A read-only URL where the uploaded file can be accessed. Will be nil if the purpose of the uploaded file is `identity_document`. Also nil if retrieved with the publishable API key.
*/
url?: string | null
}
interface FinancialReportingFinanceReportRunRunParameters {
/**
* 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 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 InvoiceLinesList {
data: (InvoiceLineItem)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface Invoice {
/**
* 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?: 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
/**
* When set to false the Invoice will not attempt to advance itself in collecting payment, so won't send emails, run smart dunning, or automatically issue a draft invoice.
*/
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.
*/
billing?: "charge_automatically" | "send_invoice" | null
/**
* Indicates the reason why the invoice was created. `subscription_cycle` indicates an invoice created by a subscription advancing into a new period. `subscription_update` indicates an invoice created due to creating or 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.
*/
billing_reason?: "manual" | "subscription" | "subscription_cycle" | "subscription_threshold" | "subscription_update" | "upcoming" | null
/**
* ID of the latest charge generated for this invoice, if any.
*/
charge?: string | Charge | null
/**
* Whether the invoice is still trying to collect payment. An invoice is closed if it's either paid or it has been marked closed. A closed invoice will no longer attempt to collect payment.
*/
closed: 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
customer: string | Customer | DeletedCustomer
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
date: number
/**
* An arbitrary string attached to the object. Often useful for displaying to users.
*/
description?: string | null
discount?: Discount | null
/**
* The date on which payment for this invoice is due. This value will be `null` for invoices where `billing=charge_automatically`.
*/
due_date?: number | null
/**
* Ending customer balance after the invoice is frozen. Invoices are frozen approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been frozen yet, this will be null.
*/
ending_balance?: number | null
/**
* Whether the invoice has been forgiven. Forgiving an invoice instructs us to update the subscription status as if the invoice were successfully paid. Once an invoice has been forgiven, it cannot be unforgiven or reopened.
*/
forgiven: boolean
/**
* The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been frozen yet, this will be null.
*/
hosted_invoice_url?: string | null
/**
* Unique identifier for the object.
*/
id: string
/**
* The link to download the PDF for the invoice. If the invoice has not been frozen 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: InvoiceLinesList
/**
* 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?: { [key: string]: string } | null
/**
* The time at which payment will next be attempted. This value will be `null` for invoices where `billing=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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "invoice"
/**
* 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
/**
* 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
/**
* 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 frozen. If the invoice has not been frozen 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 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 is applied.
*/
subtotal: number
/**
* The amount of tax included in the total, calculated from `tax_percent` and the subtotal. If no `tax_percent` is defined, this value will be null.
*/
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
/**
* Total after discount.
*/
total: number
/**
* The time at which webhooks for this invoice were successfully delivered (if the invoice had no webhooks to deliver, this will match `date`). Invoice payment is delayed until webhooks are delivered, or until all webhook delivery attempts have been exhausted.
*/
webhooks_delivered_at?: number | null
}
interface 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
date: number
/**
* 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
/**
* Unique identifier for the object.
*/
id: string
/**
* 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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "invoiceitem"
period?: { [key: string]: string } | null
/**
* 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
subscription_item?: string
/**
* Unit Amount (in the `currency` specified) of the invoice item.
*/
unit_amount: number
}
interface InvoiceLineItem {
/**
* 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
/**
* Unique identifier for the object.
*/
id: string
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.
*/
metadata: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "line_item"
period: InvoiceLineItemPeriod
/**
* 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
/**
* A string identifying the type of the source of this line item, either an `invoiceitem` or a `subscription`.
*/
type: "invoiceitem" | "subscription"
}
interface InvoiceLineItemPeriod {
/**
* End of the line item's billing period
*/
end: number
/**
* Start of the line item's billing period
*/
start: number
}
interface IssuerFraudRecord {
/**
* 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
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuer_fraud_record"
/**
* The timestamp at which the card issuer posted the issuer fraud record.
*/
post_date: number
}
interface IssuingAuthorization {
/**
* Whether the authorization has been approved.
*/
approved: boolean
/**
* How the card details were provided. One of `keyed_in`, `swipe`, `chip`, `contactless`, or `online`.
*/
authorization_method: string
/**
* 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: (BalanceTransaction)[]
card: IssuingCard
/**
* The cardholder to whom this authorization belongs.
*/
cardholder?: string | IssuingCardholder | null
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number
/**
* The amount Stripe has held from your account to fund the authorization. This will be 0 when the object is created, and increase after it has been approved.
*/
held_amount: number
/**
* The currency of the [held amount](/docs/api#issuing_authorization_object-held_amount)
*/
held_currency: string
/**
* Unique identifier for the object.
*/
id: 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: IssuingAuthorizationMerchantData
/**
* 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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuing.authorization"
/**
* 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: (IssuingAuthorizationRequest)[]
/**
* One of `pending`, `reversed`, or `closed`.
*/
status: string
transactions: (IssuingTransaction)[]
verification_data: IssuingAuthorizationVerificationData
}
interface IssuingAuthorizationMerchantData {
/**
* A categorization of the seller's type of business. See our [merchant categories guide](/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
}
interface IssuingAuthorizationRequest {
/**
* 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](/docs/api#issuing_authorization_object-held_amount)
*/
held_currency: string
/**
* One of `card_inactive`, `insufficient_funds`, `authorization_controls`, `webhook_approved`, `webhook_declined`, `webhook_timeout`, or `card_active`.
*/
reason: string
}
interface IssuingAuthorizationVerificationData {
/**
* One of `match`, `mismatch`, or `not_provided`.
*/
address_line1_check: string
/**
* One of `match`, `mismatch`, or `not_provided`.
*/
address_zip_check: string
/**
* One of `match`, `mismatch`, or `not_provided`.
*/
cvc_check: string
}
interface IssuingCard {
authorization_controls: IssuingCardAuthorizationControls
/**
* The brand of the card.
*/
brand: string
/**
* The [Cardholder](/docs/api#issuing_cardholder_object) object to which the card belongs.
*/
cardholder?: IssuingCardholder | 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
/**
* Unique identifier for the object.
*/
id: string
/**
* 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: { [key: string]: string }
/**
* The name of the cardholder, printed on the card.
*/
name: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuing.card"
/**
* Where and how the card will be shipped.
*/
shipping?: IssuingCardShipping | null
/**
* One of `active`, `inactive`, `pending`, or `canceled`.
*/
status: string
/**
* One of `virtual` or `physical`.
*/
type: string
}
interface IssuingCardAuthorizationControls {
/**
* Array of strings containing [categories](/docs/api#issuing_authorization_object-merchant_data-category) of authorizations permitted on this card.
*/
allowed_categories?: any[] | null
/**
* Array of strings containing [categories](/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to always decline on this card.
*/
blocked_categories?: any[] | null
/**
* The currency of the card. See [max_amount](/docs/api#issuing_card_object-authorization_controls-max_amount)
*/
currency?: string | null
/**
* Maximum amount allowed per authorization on this card, in the currency of the card. Authorization amounts in a different currency will be converted to the card's currency when evaluating this control.
*/
max_amount?: number | null
/**
* Maximum count of approved authorizations on this card. Counts all authorizations retroactively.
*/
max_approvals?: number | null
}
interface IssuingCardDetails {
card: IssuingCard
/**
* 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuing.card_details"
}
interface IssuingCardShipping {
address: Address
/**
* The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
*/
carrier?: string | null
/**
* A unix timestamp representing a best estimate of when the card will be delivered.
*/
eta?: number | null
/**
* Recipient name.
*/
name: string
/**
* Recipient phone (including extension).
*/
phone?: string | null
/**
* The delivery status of the card. One of `pending`, `shipped`, `delivered`, `returned`, or `failure`.
*/
status?: 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
/**
* A link to the shipping carrier's site where you can view detailed information about a card shipment.
*/
tracking_url?: string | null
}
interface IssuingCardholder {
billing: IssuingCardholderAddress
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number
/**
* The cardholder's email address.
*/
email?: string | null
/**
* Unique identifier for the object.
*/
id: 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: { [key: string]: string }
/**
* The cardholder's name. This will be printed on cards issued to them.
*/
name: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuing.cardholder"
/**
* The cardholder's phone number.
*/
phone_number?: string | null
/**
* One of `active` or `inactive`.
*/
status: string
/**
* One of `individual` or `business_entity`.
*/
type: string
}
interface IssuingCardholderAddress {
address: Address
name?: string | null
}
interface IssuingDispute {
/**
* Disputed amount. Usually the amount of the 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 transaction was made in.
*/
currency: string
evidence: IssuingDisputesEvidence
/**
* Unique identifier for the object.
*/
id: 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. 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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuing.dispute"
/**
* Reason for this dispute. One of `other` or `fraudulent`.
*/
reason: string
/**
* Current status of dispute. One of `unsubmitted`, `under_review`, `won`, or `lost`.
*/
status: string
/**
* The transaction being disputed.
*/
transaction: string | IssuingTransaction
}
interface IssuingDisputesEvidence {
/**
* Evidence to support a fraudulent dispute. This will only be present if your dispute's `reason` is `fraudulent`.
*/
fraudulent?: IssuingDisputesFraudulentEvidence | null
/**
* Evidence to support an uncategorized dispute. This will only be present if your dispute's `reason` is `other`.
*/
other?: IssuingDisputesOtherEvidence | null
}
interface IssuingDisputesFraudulentEvidence {
/**
* 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 | FileUpload | null
}
interface IssuingDisputesOtherEvidence {
/**
* 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 | FileUpload | null
}
interface IssuingTransaction {
amount: number
/**
* The `Authorization` object that led to this transaction.
*/
authorization?: string | IssuingAuthorization | null
balance_transaction?: string | BalanceTransaction | null
/**
* The card used to make this transaction.
*/
card: string | IssuingCard
/**
* The cardholder to whom this transaction belongs.
*/
cardholder?: string | IssuingCardholder | 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 | IssuingDispute | null
/**
* Unique identifier for the object.
*/
id: 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
merchant_data: IssuingAuthorizationMerchantData
/**
* 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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "issuing.transaction"
/**
* One of `capture`, `refund`, `cash_withdrawal`, or `refund_reversal`.
*/
type: string
}
interface LegacyTransferReversal {
/**
* 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
/**
* Unique identifier for the object.
*/
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: { [key: string]: string }
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "transfer_reversal"
/**
* ID of the transfer that was reversed.
*/
transfer: string | Payout | Transfer | TransferRecipientTransfer
}
interface LegalEntity {
/**
* An array of any owners with at least 25% ownership of the company, excluding the individual responsible for the account.
*/
additional_owners?: (LegalEntityAdditionalOwner)[] | null
address?: LegalEntityAddress
/**
* The Kana variation of the primary address of the legal entity (Japan only).
*/
address_kana?: LegalEntityJapanAddress | null
/**
* The Kanji variation of the primary address of the legal entity (Japan only).
*/
address_kanji?: LegalEntityJapanAddress | null
/**
* The legal name of the company.
*/
business_name?: string | null
/**
* The Kana variation of the legal name of the company (Japan only).
*/
business_name_kana?: string | null
/**
* The Kanji variation of the legal name of the company (Japan only).
*/
business_name_kanji?: string | null
/**
* Whether the business ID number of the legal entity has been provided.
*/
business_tax_id_provided?: boolean
/**
* Whether the business VAT number of the legal entity has been provided.
*/
business_vat_id_provided?: boolean
dob?: LegalEntityDob
/**
* The first name of the individual responsible for the account.
*/
first_name?: string | null
/**
* The Kana variation of the first name of the individual responsible for the account (Japan only).
*/
first_name_kana?: string | null
/**
* The Kanji variation of the first name of the individual responsible for the account (Japan only).
*/
first_name_kanji?: string | null
/**
* The gender of the individual responsible for the account (International regulations require either "male" or "female").
*/
gender?: string | null
/**
* The last name of the individual responsible for the account.
*/
last_name?: string | null
/**
* The Kana varation of the last name of the individual responsible for the account (Japan only).
*/
last_name_kana?: string | null
/**
* The Kanji varation of the last name of the individual responsible for the account (Japan only).
*/
last_name_kanji?: string | null
/**
* The maiden name of the individual responsible for the account.
*/
maiden_name?: string | null
personal_address?: LegalEntityAddress
/**
* The Kana variation of the address of the individual responsible for the account (Japan only).
*/
personal_address_kana?: LegalEntityJapanAddress | null
/**
* The Kanji variation of the address of the individual responsible for the account (Japan only).
*/
personal_address_kanji?: LegalEntityJapanAddress | null
/**
* Whether the personal ID number of the individual responsible for the account has been provided.
*/
personal_id_number_provided?: boolean
/**
* The phone number of the company, used for verification.
*/
phone_number?: string | null
/**
* Whether the last 4 ssn digits of the individual responsible for the account have been provided.
*/
ssn_last_4_provided?: boolean
tax_id_registrar?: string
/**
* Either "individual" or "company", for what kind of legal entity the account owner is for.
*/
type?: string | null
verification?: LegalEntityVerification
}
interface LegalEntityAdditionalOwner {
address?: LegalEntityAddress
dob: LegalEntityDob
/**
* The first name of this additional owner.
*/
first_name?: string | null
/**
* The last name of this additional owner.
*/
last_name?: string | null
/**
* The maiden name of this additional owner.
*/
maiden_name?: string | null
/**
* Whether the personal ID number of this additional owner has been provided.
*/
personal_id_number_provided?: boolean | null
verification: LegalEntityVerification
}
interface LegalEntityAddress {
/**
* 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 LegalEntityDob {
/**
* 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 LegalEntityJapanAddress {
/**
* 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 LegalEntityVerification {
/**
* A user-displayable string describing the verification state for this legal entity. 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 `scan_corrupt`, `scan_not_readable`, `scan_failed_greyscale`, `scan_not_uploaded`, `scan_id_type_not_supported`, `scan_id_country_not_supported`, `scan_name_mismatch`, `scan_failed_other`, `failed_keyed_identity`, or `failed_other`. A machine-readable code specifying the verification state for this legal entity.
*/
details_code?: string | null
/**
* (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A photo (jpg or png) of the front of an identifying document, either a passport or local ID card.
*/
document?: string | FileUpload | null
/**
* (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A photo (jpg or png) of the back of an identifying document, either a passport or local ID card.
*/
document_back?: string | FileUpload | null
/**
* The state of verification for this legal entity. Possible values are `unverified`, `pending`, or `verified`.
*/
status: string
}
interface LightAccountLogout {
}
interface LimitedAccount {
application_icon?: string
application_logo?: string
application_name?: string | null
application_url?: string
/**
* Unique identifier for the object.
*/
id: string
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "account"
}
interface LoginLink {
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "login_link"
/**
* The URL for the login link.
*/
url: string
}
interface NotificationEvent {
/**
* 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: NotificationEventData
/**
* Unique identifier for the object.
*/
id: 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
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: "event"
/**
* 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?: NotificationEventRequest | null
/**
* Description of the event (e.g., `invoice.created` or `charge.refunded`).
*/
type: string
}
interface NotificationEventData {
/**
* 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: { [key: string]: string }
/**
* Object containing the names of the attributes that have changed, and their previous values (sent along only with *.updated events).
*/
previous_attributes?: { [key: string]: string }
}
interface NotificationEventRequest {
/**
* 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 OrderReturnList {
data: (OrderReturn)[]
/**
* True if this list has another page of items after this one that can be fetched.
*/
has_more: boolean
/**
* String representing the object's type. Objects of the same type share the same value. Always has the value `list`.
*/
object: "list"
/**
* The URL where this list can be accessed.
*/
url: string
}
interface 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