diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 3c560ddf20..04aaf95dc6 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v482 \ No newline at end of file +v499 \ No newline at end of file diff --git a/accountsession.go b/accountsession.go new file mode 100644 index 0000000000..c6c458d376 --- /dev/null +++ b/accountsession.go @@ -0,0 +1,69 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +// Configuration for the account onboarding embedded component. +type AccountSessionComponentsAccountOnboardingParams struct { + // Whether the embedded component is enabled. + Enabled *bool `form:"enabled"` +} + +// Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not). +type AccountSessionComponentsParams struct { + // Configuration for the account onboarding embedded component. + AccountOnboarding *AccountSessionComponentsAccountOnboardingParams `form:"account_onboarding"` +} + +// Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access. +type AccountSessionParams struct { + Params `form:"*"` + // The identifier of the account to create an Account Session for. + Account *string `form:"account"` + // Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not). + Components *AccountSessionComponentsParams `form:"components"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *AccountSessionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +type AccountSessionComponentsAccountOnboarding struct { + // Whether the embedded component is enabled. + Enabled bool `json:"enabled"` +} +type AccountSessionComponents struct { + AccountOnboarding *AccountSessionComponentsAccountOnboarding `json:"account_onboarding"` +} + +// An AccountSession allows a Connect platform to grant access to a connected account in Connect embedded components. +// +// We recommend that you create an AccountSession each time you need to display an embedded component +// to your user. Do not save AccountSessions to your database as they expire relatively +// quickly, and cannot be used more than once. +// +// Related guide: [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components) +type AccountSession struct { + APIResource + // The ID of the account the AccountSession was created for + Account string `json:"account"` + // The client secret of this AccountSession. Used on the client to set up secure access to the given `account`. + // + // The client secret can be used to provide access to `account` from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret. + // + // Refer to our docs to [setup Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components) and learn about how `client_secret` should be handled. + ClientSecret string `json:"client_secret"` + Components *AccountSessionComponents `json:"components"` + // The timestamp at which this AccountSession will expire. + ExpiresAt int64 `json:"expires_at"` + // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + Livemode bool `json:"livemode"` + // String representing the object's type. Objects of the same type share the same value. + Object string `json:"object"` +} diff --git a/accountsession/client.go b/accountsession/client.go new file mode 100644 index 0000000000..b471923ba2 --- /dev/null +++ b/accountsession/client.go @@ -0,0 +1,42 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package accountsession provides the /account_sessions APIs +package accountsession + +import ( + "net/http" + + stripe "github.com/stripe/stripe-go/v75" +) + +// Client is used to invoke /account_sessions APIs. +type Client struct { + B stripe.Backend + Key string +} + +// New creates a new account session. +func New(params *stripe.AccountSessionParams) (*stripe.AccountSession, error) { + return getC().New(params) +} + +// New creates a new account session. +func (c Client) New(params *stripe.AccountSessionParams) (*stripe.AccountSession, error) { + accountsession := &stripe.AccountSession{} + err := c.B.Call( + http.MethodPost, + "/v1/account_sessions", + c.Key, + params, + accountsession, + ) + return accountsession, err +} + +func getC() Client { + return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} +} diff --git a/balancetransaction.go b/balancetransaction.go index a747cc6d41..234eb72abf 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -72,7 +72,7 @@ const ( BalanceTransactionStatusPending BalanceTransactionStatus = "pending" ) -// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead. +// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead. type BalanceTransactionType string // List of values that BalanceTransactionType can take @@ -90,6 +90,12 @@ const ( BalanceTransactionTypeIssuingAuthorizationRelease BalanceTransactionType = "issuing_authorization_release" BalanceTransactionTypeIssuingDispute BalanceTransactionType = "issuing_dispute" BalanceTransactionTypeIssuingTransaction BalanceTransactionType = "issuing_transaction" + BalanceTransactionTypeObligationInbound BalanceTransactionType = "obligation_inbound" + BalanceTransactionTypeObligationOutbound BalanceTransactionType = "obligation_outbound" + BalanceTransactionTypeObligationPayout BalanceTransactionType = "obligation_payout" + BalanceTransactionTypeObligationPayoutFailure BalanceTransactionType = "obligation_payout_failure" + BalanceTransactionTypeObligationReversalInbound BalanceTransactionType = "obligation_reversal_inbound" + BalanceTransactionTypeObligationReversalOutbound BalanceTransactionType = "obligation_reversal_outbound" BalanceTransactionTypePayment BalanceTransactionType = "payment" BalanceTransactionTypePaymentFailureRefund BalanceTransactionType = "payment_failure_refund" BalanceTransactionTypePaymentRefund BalanceTransactionType = "payment_refund" @@ -127,7 +133,7 @@ type BalanceTransactionListParams struct { Payout *string `form:"payout"` // Only returns the original transaction. Source *string `form:"source"` - // Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. + // Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Type *string `form:"type"` } @@ -198,7 +204,7 @@ type BalanceTransaction struct { Source *BalanceTransactionSource `json:"source"` // If the transaction's net funds are available in the Stripe balance yet. Either `available` or `pending`. Status BalanceTransactionStatus `json:"status"` - // Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead. + // Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead. Type BalanceTransactionType `json:"type"` } type BalanceTransactionSource struct { diff --git a/bankaccount.go b/bankaccount.go index aff972a2a4..e4ac47e5e8 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -337,7 +337,7 @@ type BankAccountFutureRequirementsError struct { Requirement string `json:"requirement"` } -// Information about upcoming new requirements for the bank account, including what information needs to be collected. +// Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. type BankAccountFutureRequirements struct { // Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. CurrentlyDue []string `json:"currently_due"` @@ -403,7 +403,7 @@ type BankAccount struct { Deleted bool `json:"deleted"` // Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. Fingerprint string `json:"fingerprint"` - // Information about upcoming new requirements for the bank account, including what information needs to be collected. + // Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. FutureRequirements *BankAccountFutureRequirements `json:"future_requirements"` // Unique identifier for the object. ID string `json:"id"` diff --git a/capability.go b/capability.go index dc222f6010..f0173f2dc1 100644 --- a/capability.go +++ b/capability.go @@ -56,7 +56,9 @@ type CapabilityParams struct { Account *string `form:"-"` // Included in URL // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` - // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + // To request a new capability for an account, pass true. There can be a delay before the requested capability becomes active. If the capability has any activation requirements, the response includes them in the `requirements` arrays. + // + // If a capability isn't permanent, you can remove it from the account by passing false. Most capabilities are permanent after they've been requested. Attempting to remove a permanent capability returns an error. Requested *bool `form:"requested"` } diff --git a/checkout_session.go b/checkout_session.go index 43b1129af7..eefbb57f12 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -1197,7 +1197,7 @@ type CheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferParams struct // // Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`. RequestedAddressTypes []*string `form:"requested_address_types"` - // The list of bank transfer types that this PaymentIntent is allowed to use for funding. Permitted values include: `us_bank_account`, `eu_bank_account`, `id_bank_account`, `gb_bank_account`, `jp_bank_account`, `mx_bank_account`, `eu_bank_transfer`, `gb_bank_transfer`, `id_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + // The list of bank transfer types that this PaymentIntent is allowed to use for funding. Type *string `form:"type"` } @@ -1682,7 +1682,7 @@ type CheckoutSessionParams struct { // If the Customer already has a valid [email](https://stripe.com/docs/api/customers/object#customer_object-email) set, the email will be prefilled and not editable in Checkout. // If the Customer does not have a valid `email`, Checkout will set the email entered during the session on the Customer. // - // If blank for Checkout Sessions in `payment` or `subscription` mode, Checkout will create a new Customer object based on information provided during the payment flow. + // If blank for Checkout Sessions in `subscription` mode or with `customer_creation` set as `always` in `payment` mode, Checkout will create a new Customer object based on information provided during the payment flow. // // You can set [`payment_intent_data.setup_future_usage`](https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage) to have Checkout automatically attach the payment method to the Customer you pass in for future reuse. Customer *string `form:"customer"` @@ -2442,7 +2442,7 @@ type CheckoutSession struct { // Currency conversion details for automatic currency conversion sessions CurrencyConversion *CheckoutSessionCurrencyConversion `json:"currency_conversion"` // The ID of the customer for this Session. - // For Checkout Sessions in `payment` or `subscription` mode, Checkout + // For Checkout Sessions in `subscription` mode or Checkout Sessions with `customer_creation` set as `always` in `payment` mode, Checkout // will create a new customer object based on information provided // during the payment flow unless an existing customer was provided when // the Session was created. diff --git a/client/api.go b/client/api.go index 20354904fa..9c9e39faa2 100644 --- a/client/api.go +++ b/client/api.go @@ -11,6 +11,7 @@ import ( stripe "github.com/stripe/stripe-go/v75" "github.com/stripe/stripe-go/v75/account" "github.com/stripe/stripe-go/v75/accountlink" + "github.com/stripe/stripe-go/v75/accountsession" "github.com/stripe/stripe-go/v75/applepaydomain" "github.com/stripe/stripe-go/v75/applicationfee" appssecret "github.com/stripe/stripe-go/v75/apps/secret" @@ -122,6 +123,8 @@ type API struct { AccountLinks *accountlink.Client // Accounts is the client used to invoke /accounts APIs. Accounts *account.Client + // AccountSessions is the client used to invoke /account_sessions APIs. + AccountSessions *accountsession.Client // ApplePayDomains is the client used to invoke /apple_pay/domains APIs. ApplePayDomains *applepaydomain.Client // ApplicationFees is the client used to invoke /application_fees APIs. @@ -342,6 +345,7 @@ func (a *API) Init(key string, backends *stripe.Backends) { a.AccountLinks = &accountlink.Client{B: backends.API, Key: key} a.Accounts = &account.Client{B: backends.API, Key: key} + a.AccountSessions = &accountsession.Client{B: backends.API, Key: key} a.ApplePayDomains = &applepaydomain.Client{B: backends.API, Key: key} a.ApplicationFees = &applicationfee.Client{B: backends.API, Key: key} a.AppsSecrets = &appssecret.Client{B: backends.API, Key: key} diff --git a/event.go b/event.go index a803e02cc2..ed543991a0 100644 --- a/event.go +++ b/event.go @@ -12,6 +12,208 @@ import ( "strconv" ) +// Description of the event (e.g., `invoice.created` or `charge.refunded`). +type EventType string + +// List of values that EventType can take +const ( + EventTypeAccountApplicationAuthorized EventType = "account.application.authorized" + EventTypeAccountApplicationDeauthorized EventType = "account.application.deauthorized" + EventTypeAccountExternalAccountCreated EventType = "account.external_account.created" + EventTypeAccountExternalAccountDeleted EventType = "account.external_account.deleted" + EventTypeAccountExternalAccountUpdated EventType = "account.external_account.updated" + EventTypeAccountUpdated EventType = "account.updated" + EventTypeApplicationFeeCreated EventType = "application_fee.created" + EventTypeApplicationFeeRefundUpdated EventType = "application_fee.refund.updated" + EventTypeApplicationFeeRefunded EventType = "application_fee.refunded" + EventTypeBalanceAvailable EventType = "balance.available" + EventTypeBillingPortalConfigurationCreated EventType = "billing_portal.configuration.created" + EventTypeBillingPortalConfigurationUpdated EventType = "billing_portal.configuration.updated" + EventTypeBillingPortalSessionCreated EventType = "billing_portal.session.created" + EventTypeCapabilityUpdated EventType = "capability.updated" + EventTypeCashBalanceFundsAvailable EventType = "cash_balance.funds_available" + EventTypeChargeCaptured EventType = "charge.captured" + EventTypeChargeDisputeClosed EventType = "charge.dispute.closed" + EventTypeChargeDisputeCreated EventType = "charge.dispute.created" + EventTypeChargeDisputeFundsReinstated EventType = "charge.dispute.funds_reinstated" + EventTypeChargeDisputeFundsWithdrawn EventType = "charge.dispute.funds_withdrawn" + EventTypeChargeDisputeUpdated EventType = "charge.dispute.updated" + EventTypeChargeExpired EventType = "charge.expired" + EventTypeChargeFailed EventType = "charge.failed" + EventTypeChargePending EventType = "charge.pending" + EventTypeChargeRefundUpdated EventType = "charge.refund.updated" + EventTypeChargeRefunded EventType = "charge.refunded" + EventTypeChargeSucceeded EventType = "charge.succeeded" + EventTypeChargeUpdated EventType = "charge.updated" + EventTypeCheckoutSessionAsyncPaymentFailed EventType = "checkout.session.async_payment_failed" + EventTypeCheckoutSessionAsyncPaymentSucceeded EventType = "checkout.session.async_payment_succeeded" + EventTypeCheckoutSessionCompleted EventType = "checkout.session.completed" + EventTypeCheckoutSessionExpired EventType = "checkout.session.expired" + EventTypeCouponCreated EventType = "coupon.created" + EventTypeCouponDeleted EventType = "coupon.deleted" + EventTypeCouponUpdated EventType = "coupon.updated" + EventTypeCreditNoteCreated EventType = "credit_note.created" + EventTypeCreditNoteUpdated EventType = "credit_note.updated" + EventTypeCreditNoteVoided EventType = "credit_note.voided" + EventTypeCustomerCreated EventType = "customer.created" + EventTypeCustomerDeleted EventType = "customer.deleted" + EventTypeCustomerDiscountCreated EventType = "customer.discount.created" + EventTypeCustomerDiscountDeleted EventType = "customer.discount.deleted" + EventTypeCustomerDiscountUpdated EventType = "customer.discount.updated" + EventTypeCustomerSourceCreated EventType = "customer.source.created" + EventTypeCustomerSourceDeleted EventType = "customer.source.deleted" + EventTypeCustomerSourceExpiring EventType = "customer.source.expiring" + EventTypeCustomerSourceUpdated EventType = "customer.source.updated" + EventTypeCustomerSubscriptionCreated EventType = "customer.subscription.created" + EventTypeCustomerSubscriptionDeleted EventType = "customer.subscription.deleted" + EventTypeCustomerSubscriptionPaused EventType = "customer.subscription.paused" + EventTypeCustomerSubscriptionPendingUpdateApplied EventType = "customer.subscription.pending_update_applied" + EventTypeCustomerSubscriptionPendingUpdateExpired EventType = "customer.subscription.pending_update_expired" + EventTypeCustomerSubscriptionResumed EventType = "customer.subscription.resumed" + EventTypeCustomerSubscriptionTrialWillEnd EventType = "customer.subscription.trial_will_end" + EventTypeCustomerSubscriptionUpdated EventType = "customer.subscription.updated" + EventTypeCustomerTaxIDCreated EventType = "customer.tax_id.created" + EventTypeCustomerTaxIDDeleted EventType = "customer.tax_id.deleted" + EventTypeCustomerTaxIDUpdated EventType = "customer.tax_id.updated" + EventTypeCustomerUpdated EventType = "customer.updated" + EventTypeCustomerCashBalanceTransactionCreated EventType = "customer_cash_balance_transaction.created" + EventTypeFileCreated EventType = "file.created" + EventTypeFinancialConnectionsAccountCreated EventType = "financial_connections.account.created" + EventTypeFinancialConnectionsAccountDeactivated EventType = "financial_connections.account.deactivated" + EventTypeFinancialConnectionsAccountDisconnected EventType = "financial_connections.account.disconnected" + EventTypeFinancialConnectionsAccountReactivated EventType = "financial_connections.account.reactivated" + EventTypeFinancialConnectionsAccountRefreshedBalance EventType = "financial_connections.account.refreshed_balance" + EventTypeIdentityVerificationSessionCanceled EventType = "identity.verification_session.canceled" + EventTypeIdentityVerificationSessionCreated EventType = "identity.verification_session.created" + EventTypeIdentityVerificationSessionProcessing EventType = "identity.verification_session.processing" + EventTypeIdentityVerificationSessionRedacted EventType = "identity.verification_session.redacted" + EventTypeIdentityVerificationSessionRequiresInput EventType = "identity.verification_session.requires_input" + EventTypeIdentityVerificationSessionVerified EventType = "identity.verification_session.verified" + EventTypeInvoiceCreated EventType = "invoice.created" + EventTypeInvoiceDeleted EventType = "invoice.deleted" + EventTypeInvoiceFinalizationFailed EventType = "invoice.finalization_failed" + EventTypeInvoiceFinalized EventType = "invoice.finalized" + EventTypeInvoiceMarkedUncollectible EventType = "invoice.marked_uncollectible" + EventTypeInvoicePaid EventType = "invoice.paid" + EventTypeInvoicePaymentActionRequired EventType = "invoice.payment_action_required" + EventTypeInvoicePaymentFailed EventType = "invoice.payment_failed" + EventTypeInvoicePaymentSucceeded EventType = "invoice.payment_succeeded" + EventTypeInvoiceSent EventType = "invoice.sent" + EventTypeInvoiceUpcoming EventType = "invoice.upcoming" + EventTypeInvoiceUpdated EventType = "invoice.updated" + EventTypeInvoiceVoided EventType = "invoice.voided" + EventTypeInvoiceItemCreated EventType = "invoiceitem.created" + EventTypeInvoiceItemDeleted EventType = "invoiceitem.deleted" + EventTypeInvoiceItemUpdated EventType = "invoiceitem.updated" + EventTypeIssuingAuthorizationCreated EventType = "issuing_authorization.created" + EventTypeIssuingAuthorizationRequest EventType = "issuing_authorization.request" + EventTypeIssuingAuthorizationUpdated EventType = "issuing_authorization.updated" + EventTypeIssuingCardCreated EventType = "issuing_card.created" + EventTypeIssuingCardUpdated EventType = "issuing_card.updated" + EventTypeIssuingCardholderCreated EventType = "issuing_cardholder.created" + EventTypeIssuingCardholderUpdated EventType = "issuing_cardholder.updated" + EventTypeIssuingDisputeClosed EventType = "issuing_dispute.closed" + EventTypeIssuingDisputeCreated EventType = "issuing_dispute.created" + EventTypeIssuingDisputeFundsReinstated EventType = "issuing_dispute.funds_reinstated" + EventTypeIssuingDisputeSubmitted EventType = "issuing_dispute.submitted" + EventTypeIssuingDisputeUpdated EventType = "issuing_dispute.updated" + EventTypeIssuingTransactionCreated EventType = "issuing_transaction.created" + EventTypeIssuingTransactionUpdated EventType = "issuing_transaction.updated" + EventTypeMandateUpdated EventType = "mandate.updated" + EventTypeOrderCreated EventType = "order.created" + EventTypePaymentIntentAmountCapturableUpdated EventType = "payment_intent.amount_capturable_updated" + EventTypePaymentIntentCanceled EventType = "payment_intent.canceled" + EventTypePaymentIntentCreated EventType = "payment_intent.created" + EventTypePaymentIntentPartiallyFunded EventType = "payment_intent.partially_funded" + EventTypePaymentIntentPaymentFailed EventType = "payment_intent.payment_failed" + EventTypePaymentIntentProcessing EventType = "payment_intent.processing" + EventTypePaymentIntentRequiresAction EventType = "payment_intent.requires_action" + EventTypePaymentIntentSucceeded EventType = "payment_intent.succeeded" + EventTypePaymentLinkCreated EventType = "payment_link.created" + EventTypePaymentLinkUpdated EventType = "payment_link.updated" + EventTypePaymentMethodAttached EventType = "payment_method.attached" + EventTypePaymentMethodAutomaticallyUpdated EventType = "payment_method.automatically_updated" + EventTypePaymentMethodDetached EventType = "payment_method.detached" + EventTypePaymentMethodUpdated EventType = "payment_method.updated" + EventTypePayoutCanceled EventType = "payout.canceled" + EventTypePayoutCreated EventType = "payout.created" + EventTypePayoutFailed EventType = "payout.failed" + EventTypePayoutPaid EventType = "payout.paid" + EventTypePayoutReconciliationCompleted EventType = "payout.reconciliation_completed" + EventTypePayoutUpdated EventType = "payout.updated" + EventTypePersonCreated EventType = "person.created" + EventTypePersonDeleted EventType = "person.deleted" + EventTypePersonUpdated EventType = "person.updated" + EventTypePlanCreated EventType = "plan.created" + EventTypePlanDeleted EventType = "plan.deleted" + EventTypePlanUpdated EventType = "plan.updated" + EventTypePriceCreated EventType = "price.created" + EventTypePriceDeleted EventType = "price.deleted" + EventTypePriceUpdated EventType = "price.updated" + EventTypeProductCreated EventType = "product.created" + EventTypeProductDeleted EventType = "product.deleted" + EventTypeProductUpdated EventType = "product.updated" + EventTypePromotionCodeCreated EventType = "promotion_code.created" + EventTypePromotionCodeUpdated EventType = "promotion_code.updated" + EventTypeQuoteAccepted EventType = "quote.accepted" + EventTypeQuoteCanceled EventType = "quote.canceled" + EventTypeQuoteCreated EventType = "quote.created" + EventTypeQuoteFinalized EventType = "quote.finalized" + EventTypeRadarEarlyFraudWarningCreated EventType = "radar.early_fraud_warning.created" + EventTypeRadarEarlyFraudWarningUpdated EventType = "radar.early_fraud_warning.updated" + EventTypeRecipientCreated EventType = "recipient.created" + EventTypeRecipientDeleted EventType = "recipient.deleted" + EventTypeRecipientUpdated EventType = "recipient.updated" + EventTypeRefundCreated EventType = "refund.created" + EventTypeRefundUpdated EventType = "refund.updated" + EventTypeReportingReportRunFailed EventType = "reporting.report_run.failed" + EventTypeReportingReportRunSucceeded EventType = "reporting.report_run.succeeded" + EventTypeReportingReportTypeUpdated EventType = "reporting.report_type.updated" + EventTypeReviewClosed EventType = "review.closed" + EventTypeReviewOpened EventType = "review.opened" + EventTypeSetupIntentCanceled EventType = "setup_intent.canceled" + EventTypeSetupIntentCreated EventType = "setup_intent.created" + EventTypeSetupIntentRequiresAction EventType = "setup_intent.requires_action" + EventTypeSetupIntentSetupFailed EventType = "setup_intent.setup_failed" + EventTypeSetupIntentSucceeded EventType = "setup_intent.succeeded" + EventTypeSigmaScheduledQueryRunCreated EventType = "sigma.scheduled_query_run.created" + EventTypeSKUCreated EventType = "sku.created" + EventTypeSKUDeleted EventType = "sku.deleted" + EventTypeSKUUpdated EventType = "sku.updated" + EventTypeSourceCanceled EventType = "source.canceled" + EventTypeSourceChargeable EventType = "source.chargeable" + EventTypeSourceFailed EventType = "source.failed" + EventTypeSourceMandateNotification EventType = "source.mandate_notification" + EventTypeSourceRefundAttributesRequired EventType = "source.refund_attributes_required" + EventTypeSourceTransactionCreated EventType = "source.transaction.created" + EventTypeSourceTransactionUpdated EventType = "source.transaction.updated" + EventTypeSubscriptionScheduleAborted EventType = "subscription_schedule.aborted" + EventTypeSubscriptionScheduleCanceled EventType = "subscription_schedule.canceled" + EventTypeSubscriptionScheduleCompleted EventType = "subscription_schedule.completed" + EventTypeSubscriptionScheduleCreated EventType = "subscription_schedule.created" + EventTypeSubscriptionScheduleExpiring EventType = "subscription_schedule.expiring" + EventTypeSubscriptionScheduleReleased EventType = "subscription_schedule.released" + EventTypeSubscriptionScheduleUpdated EventType = "subscription_schedule.updated" + EventTypeTaxSettingsUpdated EventType = "tax.settings.updated" + EventTypeTaxRateCreated EventType = "tax_rate.created" + EventTypeTaxRateUpdated EventType = "tax_rate.updated" + EventTypeTerminalReaderActionFailed EventType = "terminal.reader.action_failed" + EventTypeTerminalReaderActionSucceeded EventType = "terminal.reader.action_succeeded" + EventTypeTestHelpersTestClockAdvancing EventType = "test_helpers.test_clock.advancing" + EventTypeTestHelpersTestClockCreated EventType = "test_helpers.test_clock.created" + EventTypeTestHelpersTestClockDeleted EventType = "test_helpers.test_clock.deleted" + EventTypeTestHelpersTestClockInternalFailure EventType = "test_helpers.test_clock.internal_failure" + EventTypeTestHelpersTestClockReady EventType = "test_helpers.test_clock.ready" + EventTypeTopupCanceled EventType = "topup.canceled" + EventTypeTopupCreated EventType = "topup.created" + EventTypeTopupFailed EventType = "topup.failed" + EventTypeTopupReversed EventType = "topup.reversed" + EventTypeTopupSucceeded EventType = "topup.succeeded" + EventTypeTransferCreated EventType = "transfer.created" + EventTypeTransferReversed EventType = "transfer.reversed" + EventTypeTransferUpdated EventType = "transfer.updated" +) + // List events, going back up to 30 days. Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://stripe.com/docs/api/events/object) api_version attribute (not according to your current Stripe API version or Stripe-Version header). type EventListParams struct { ListParams `form:"*"` @@ -118,7 +320,7 @@ type Event struct { // Information on the API request that instigated the event. Request *EventRequest `json:"request"` // Description of the event (e.g., `invoice.created` or `charge.refunded`). - Type string `json:"type"` + Type EventType `json:"type"` } // EventList is a list of Events as retrieved from a list endpoint. diff --git a/invoice.go b/invoice.go index 2f6b21f47b..65fcd49b6a 100644 --- a/invoice.go +++ b/invoice.go @@ -21,7 +21,15 @@ const ( InvoiceAutomaticTaxStatusRequiresLocationInputs InvoiceAutomaticTaxStatus = "requires_location_inputs" ) -// Indicates the reason why the invoice was created. `subscription_cycle` indicates an invoice created by a subscription advancing into a new period. `subscription_create` indicates an invoice created due to creating a subscription. `subscription_update` indicates an invoice created due to updating a subscription. `subscription` is set for all old invoices to indicate either a change to a subscription or a period advancement. `manual` is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The `upcoming` value is reserved for simulated invoices per the upcoming invoice endpoint. `subscription_threshold` indicates an invoice created due to a billing threshold being reached. +// Indicates the reason why the invoice was created. +// +// * `manual`: Unrelated to a subscription, for example, created via the invoice editor. +// * `subscription`: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds. +// * `subscription_create`: A new subscription was created. +// * `subscription_cycle`: A subscription advanced into a new period. +// * `subscription_threshold`: A subscription reached a billing threshold. +// * `subscription_update`: A subscription was updated. +// * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint. type InvoiceBillingReason string // List of values that InvoiceBillingReason can take @@ -1357,7 +1365,15 @@ type Invoice struct { // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. AutoAdvance bool `json:"auto_advance"` AutomaticTax *InvoiceAutomaticTax `json:"automatic_tax"` - // Indicates the reason why the invoice was created. `subscription_cycle` indicates an invoice created by a subscription advancing into a new period. `subscription_create` indicates an invoice created due to creating a subscription. `subscription_update` indicates an invoice created due to updating a subscription. `subscription` is set for all old invoices to indicate either a change to a subscription or a period advancement. `manual` is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The `upcoming` value is reserved for simulated invoices per the upcoming invoice endpoint. `subscription_threshold` indicates an invoice created due to a billing threshold being reached. + // Indicates the reason why the invoice was created. + // + // * `manual`: Unrelated to a subscription, for example, created via the invoice editor. + // * `subscription`: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds. + // * `subscription_create`: A new subscription was created. + // * `subscription_cycle`: A subscription advanced into a new period. + // * `subscription_threshold`: A subscription reached a billing threshold. + // * `subscription_update`: A subscription was updated. + // * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint. BillingReason InvoiceBillingReason `json:"billing_reason"` // ID of the latest charge generated for this invoice, if any. Charge *Charge `json:"charge"` diff --git a/paymentlink.go b/paymentlink.go index 78a853edd8..0a1139e651 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -693,6 +693,8 @@ type PaymentLink struct { AfterCompletion *PaymentLinkAfterCompletion `json:"after_completion"` // Whether user redeemable promotion codes are enabled. AllowPromotionCodes bool `json:"allow_promotion_codes"` + // The ID of the Connect application that created the Payment Link. + Application *Application `json:"application"` // The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. ApplicationFeeAmount int64 `json:"application_fee_amount"` // This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. diff --git a/person.go b/person.go index 4ed9613743..bcc9d74bf6 100644 --- a/person.go +++ b/person.go @@ -337,7 +337,7 @@ type PersonFutureRequirementsError struct { Requirement string `json:"requirement"` } -// Information about the upcoming new requirements for this person, including what information needs to be collected, and by when. +// Information about the [upcoming new requirements for this person](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. type PersonFutureRequirements struct { // Fields that are due and can be satisfied by providing the corresponding alternative fields instead. Alternatives []*PersonFutureRequirementsAlternative `json:"alternatives"` @@ -443,7 +443,7 @@ type Person struct { FirstNameKanji string `json:"first_name_kanji"` // A list of alternate names or aliases that the person is known by. FullNameAliases []string `json:"full_name_aliases"` - // Information about the upcoming new requirements for this person, including what information needs to be collected, and by when. + // Information about the [upcoming new requirements for this person](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. FutureRequirements *PersonFutureRequirements `json:"future_requirements"` // The person's gender (International regulations require either "male" or "female"). Gender string `json:"gender"` diff --git a/token.go b/token.go index a7f9692c33..b2ae1692a0 100644 --- a/token.go +++ b/token.go @@ -25,7 +25,8 @@ type TokenParams struct { Account *TokenAccountParams `form:"account"` // The bank account this token will represent. BankAccount *BankAccountParams `form:"bank_account"` - Card *CardParams `form:"card"` + // The card this token will represent. If you also pass in a customer, the card must be the ID of a card belonging to the customer. Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below. + Card *CardParams `form:"card"` // The customer (owned by the application's account) for which to create a token. This can be used only with an [OAuth access token](https://stripe.com/docs/connect/standard-accounts) or [Stripe-Account header](https://stripe.com/docs/connect/authentication). For more details, see [Cloning Saved Payment Methods](https://stripe.com/docs/connect/cloning-saved-payment-methods). Customer *string `form:"customer"` // The updated CVC value this token will represent.