Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1605

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v223
v226
10 changes: 6 additions & 4 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,11 +1186,13 @@ type AccountTOSAcceptance struct {
}

// This is an object representing a Stripe account. You can retrieve it to see
// properties on the account like its current e-mail address or if the account is
// enabled yet to make live charges.
// properties on the account like its current requirements or if the account is
// enabled to make live charges or receive payouts.
//
// Some properties, marked below, are available only to platforms that want to
// [create and manage Express or Custom accounts](https://stripe.com/docs/connect/accounts).
// For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that
// account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links)
// for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express**
// below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts).
type Account struct {
APIResource
// Business information about the account.
Expand Down
1 change: 1 addition & 0 deletions billingportal_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate string
const (
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateAddress BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "address"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateEmail BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "email"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateName BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "name"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdatePhone BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "phone"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateShipping BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "shipping"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateTaxID BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "tax_id"
Expand Down
8 changes: 4 additions & 4 deletions billingportal_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type BillingPortalSessionFlowDataSubscriptionCancelParams struct {
Subscription *string `form:"subscription"`
}

// Information about a specific flow for the customer to go through.
// Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
type BillingPortalSessionFlowDataParams struct {
// Behavior after the flow is completed.
AfterCompletion *BillingPortalSessionFlowDataAfterCompletionParams `form:"after_completion"`
Expand All @@ -70,7 +70,7 @@ type BillingPortalSessionParams struct {
Configuration *string `form:"configuration"`
// The ID of an existing customer.
Customer *string `form:"customer"`
// Information about a specific flow for the customer to go through.
// Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
FlowData *BillingPortalSessionFlowDataParams `form:"flow_data"`
// The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer's `preferred_locales` or browser's locale is used.
Locale *string `form:"locale"`
Expand Down Expand Up @@ -106,7 +106,7 @@ type BillingPortalSessionFlowSubscriptionCancel struct {
Subscription string `json:"subscription"`
}

// Information about a specific flow for the customer to go through.
// Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
type BillingPortalSessionFlow struct {
AfterCompletion *BillingPortalSessionFlowAfterCompletion `json:"after_completion"`
// Configuration when `flow.type=subscription_cancel`.
Expand Down Expand Up @@ -137,7 +137,7 @@ type BillingPortalSession struct {
Created int64 `json:"created"`
// The ID of the customer for this session.
Customer string `json:"customer"`
// Information about a specific flow for the customer to go through.
// Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
Flow *BillingPortalSessionFlow `json:"flow"`
// Unique identifier for the object.
ID string `json:"id"`
Expand Down
120 changes: 114 additions & 6 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ const (
CheckoutSessionConsentCollectionTermsOfServiceRequired CheckoutSessionConsentCollectionTermsOfService = "required"
)

// The type of the label.
type CheckoutSessionCustomFieldLabelType string

// List of values that CheckoutSessionCustomFieldLabelType can take
const (
CheckoutSessionCustomFieldLabelTypeCustom CheckoutSessionCustomFieldLabelType = "custom"
)

// The type of the field.
type CheckoutSessionCustomFieldType string

// List of values that CheckoutSessionCustomFieldType can take
const (
CheckoutSessionCustomFieldTypeDropdown CheckoutSessionCustomFieldType = "dropdown"
CheckoutSessionCustomFieldTypeNumeric CheckoutSessionCustomFieldType = "numeric"
CheckoutSessionCustomFieldTypeText CheckoutSessionCustomFieldType = "text"
)

// Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
type CheckoutSessionCustomerCreation string

Expand Down Expand Up @@ -630,6 +648,42 @@ type CheckoutSessionConsentCollectionParams struct {
TermsOfService *string `form:"terms_of_service"`
}

// The options available for the customer to select. Up to 200 options allowed.
type CheckoutSessionCustomFieldDropdownOptionParams struct {
// The label for the option, displayed to the customer. Up to 100 characters.
Label *string `form:"label"`
// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
Value *string `form:"value"`
}

// Configuration for `type=dropdown` fields.
type CheckoutSessionCustomFieldDropdownParams struct {
// The options available for the customer to select. Up to 200 options allowed.
Options []*CheckoutSessionCustomFieldDropdownOptionParams `form:"options"`
}

// The label for the field, displayed to the customer.
type CheckoutSessionCustomFieldLabelParams struct {
// Custom text for the label, displayed to the customer. Up to 50 characters.
Custom *string `form:"custom"`
// The type of the label.
Type *string `form:"type"`
}

// Collect additional information from your customer using custom fields. Up to 2 fields are supported.
type CheckoutSessionCustomFieldParams struct {
// Configuration for `type=dropdown` fields.
Dropdown *CheckoutSessionCustomFieldDropdownParams `form:"dropdown"`
// String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
Key *string `form:"key"`
// The label for the field, displayed to the customer.
Label *CheckoutSessionCustomFieldLabelParams `form:"label"`
// Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
Optional *bool `form:"optional"`
// The type of the field.
Type *string `form:"type"`
}

// Custom text that should be displayed alongside shipping address collection.
type CheckoutSessionCustomTextShippingAddressParams struct {
// Text may be up to 1000 characters in length.
Expand Down Expand Up @@ -1426,6 +1480,8 @@ type CheckoutSessionParams struct {
CustomerEmail *string `form:"customer_email"`
// Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when `customer` is provided.
CustomerUpdate *CheckoutSessionCustomerUpdateParams `form:"customer_update"`
// Collect additional information from your customer using custom fields. Up to 2 fields are supported.
CustomFields []*CheckoutSessionCustomFieldParams `form:"custom_fields"`
// Display additional text for your customers using custom text.
CustomText *CheckoutSessionCustomTextParams `form:"custom_text"`
// The coupon or promotion code to apply to this Session. Currently, only up to one may be specified.
Expand Down Expand Up @@ -1554,6 +1610,57 @@ type CheckoutSessionConsentCollection struct {
TermsOfService CheckoutSessionConsentCollectionTermsOfService `json:"terms_of_service"`
}

// The options available for the customer to select. Up to 200 options allowed.
type CheckoutSessionCustomFieldDropdownOption struct {
// The label for the option, displayed to the customer. Up to 100 characters.
Label string `json:"label"`
// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
Value string `json:"value"`
}

// Configuration for `type=dropdown` fields.
type CheckoutSessionCustomFieldDropdown struct {
// The options available for the customer to select. Up to 200 options allowed.
Options []*CheckoutSessionCustomFieldDropdownOption `json:"options"`
// The option selected by the customer. This will be the `value` for the option.
Value string `json:"value"`
}
type CheckoutSessionCustomFieldLabel struct {
// Custom text for the label, displayed to the customer. Up to 50 characters.
Custom string `json:"custom"`
// The type of the label.
Type CheckoutSessionCustomFieldLabelType `json:"type"`
}

// Configuration for `type=numeric` fields.
type CheckoutSessionCustomFieldNumeric struct {
// The value entered by the customer, containing only digits.
Value string `json:"value"`
}

// Configuration for `type=text` fields.
type CheckoutSessionCustomFieldText struct {
// The value entered by the customer.
Value string `json:"value"`
}

// Collect additional information from your customer using custom fields. Up to 2 fields are supported.
type CheckoutSessionCustomField struct {
// Configuration for `type=dropdown` fields.
Dropdown *CheckoutSessionCustomFieldDropdown `json:"dropdown"`
// String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
Key string `json:"key"`
Label *CheckoutSessionCustomFieldLabel `json:"label"`
// Configuration for `type=numeric` fields.
Numeric *CheckoutSessionCustomFieldNumeric `json:"numeric"`
// Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
Optional bool `json:"optional"`
// Configuration for `type=text` fields.
Text *CheckoutSessionCustomFieldText `json:"text"`
// The type of the field.
Type CheckoutSessionCustomFieldType `json:"type"`
}

// Custom text that should be displayed alongside shipping address collection.
type CheckoutSessionCustomTextShippingAddress struct {
// Text may be up to 1000 characters in length.
Expand Down Expand Up @@ -1999,8 +2106,8 @@ type CheckoutSessionTotalDetails struct {
// [PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active
// [Subscription](https://stripe.com/docs/api/subscriptions).
//
// You can create a Checkout Session on your server and pass its ID to the
// client to begin Checkout.
// You can create a Checkout Session on your server and redirect to its URL
// to begin Checkout.
//
// Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart).
type CheckoutSession struct {
Expand Down Expand Up @@ -2045,12 +2152,13 @@ type CheckoutSession struct {
// Use this parameter to prefill customer data if you already have an email
// on file. To access information about the customer once the payment flow is
// complete, use the `customer` attribute.
CustomerEmail string `json:"customer_email"`
CustomText *CheckoutSessionCustomText `json:"custom_text"`
CustomerEmail string `json:"customer_email"`
// Collect additional information from your customer using custom fields. Up to 2 fields are supported.
CustomFields []*CheckoutSessionCustomField `json:"custom_fields"`
CustomText *CheckoutSessionCustomText `json:"custom_text"`
// The timestamp at which the Checkout Session will expire.
ExpiresAt int64 `json:"expires_at"`
// Unique identifier for the object. Used to pass to `redirectToCheckout`
// in Stripe.js.
// Unique identifier for the object.
ID string `json:"id"`
// ID of the invoice created by the Checkout Session, if it exists.
Invoice *Invoice `json:"invoice"`
Expand Down
Loading