github.com/stripe/stripe-go/v76@v76.25.0/paymentlink.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  import "encoding/json"
    10  
    11  // The specified behavior after the purchase is complete.
    12  type PaymentLinkAfterCompletionType string
    13  
    14  // List of values that PaymentLinkAfterCompletionType can take
    15  const (
    16  	PaymentLinkAfterCompletionTypeHostedConfirmation PaymentLinkAfterCompletionType = "hosted_confirmation"
    17  	PaymentLinkAfterCompletionTypeRedirect           PaymentLinkAfterCompletionType = "redirect"
    18  )
    19  
    20  // Type of the account referenced.
    21  type PaymentLinkAutomaticTaxLiabilityType string
    22  
    23  // List of values that PaymentLinkAutomaticTaxLiabilityType can take
    24  const (
    25  	PaymentLinkAutomaticTaxLiabilityTypeAccount PaymentLinkAutomaticTaxLiabilityType = "account"
    26  	PaymentLinkAutomaticTaxLiabilityTypeSelf    PaymentLinkAutomaticTaxLiabilityType = "self"
    27  )
    28  
    29  // Configuration for collecting the customer's billing address. Defaults to `auto`.
    30  type PaymentLinkBillingAddressCollection string
    31  
    32  // List of values that PaymentLinkBillingAddressCollection can take
    33  const (
    34  	PaymentLinkBillingAddressCollectionAuto     PaymentLinkBillingAddressCollection = "auto"
    35  	PaymentLinkBillingAddressCollectionRequired PaymentLinkBillingAddressCollection = "required"
    36  )
    37  
    38  // Determines the position and visibility of the payment method reuse agreement in the UI. When set to `auto`, Stripe's defaults will be used.
    39  //
    40  // When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI.
    41  type PaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition string
    42  
    43  // List of values that PaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition can take
    44  const (
    45  	PaymentLinkConsentCollectionPaymentMethodReuseAgreementPositionAuto   PaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition = "auto"
    46  	PaymentLinkConsentCollectionPaymentMethodReuseAgreementPositionHidden PaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition = "hidden"
    47  )
    48  
    49  // If set to `auto`, enables the collection of customer consent for promotional communications.
    50  type PaymentLinkConsentCollectionPromotions string
    51  
    52  // List of values that PaymentLinkConsentCollectionPromotions can take
    53  const (
    54  	PaymentLinkConsentCollectionPromotionsAuto PaymentLinkConsentCollectionPromotions = "auto"
    55  	PaymentLinkConsentCollectionPromotionsNone PaymentLinkConsentCollectionPromotions = "none"
    56  )
    57  
    58  // If set to `required`, it requires cutomers to accept the terms of service before being able to pay. If set to `none`, customers won't be shown a checkbox to accept the terms of service.
    59  type PaymentLinkConsentCollectionTermsOfService string
    60  
    61  // List of values that PaymentLinkConsentCollectionTermsOfService can take
    62  const (
    63  	PaymentLinkConsentCollectionTermsOfServiceNone     PaymentLinkConsentCollectionTermsOfService = "none"
    64  	PaymentLinkConsentCollectionTermsOfServiceRequired PaymentLinkConsentCollectionTermsOfService = "required"
    65  )
    66  
    67  // The type of the label.
    68  type PaymentLinkCustomFieldLabelType string
    69  
    70  // List of values that PaymentLinkCustomFieldLabelType can take
    71  const (
    72  	PaymentLinkCustomFieldLabelTypeCustom PaymentLinkCustomFieldLabelType = "custom"
    73  )
    74  
    75  // The type of the field.
    76  type PaymentLinkCustomFieldType string
    77  
    78  // List of values that PaymentLinkCustomFieldType can take
    79  const (
    80  	PaymentLinkCustomFieldTypeDropdown PaymentLinkCustomFieldType = "dropdown"
    81  	PaymentLinkCustomFieldTypeNumeric  PaymentLinkCustomFieldType = "numeric"
    82  	PaymentLinkCustomFieldTypeText     PaymentLinkCustomFieldType = "text"
    83  )
    84  
    85  // Configuration for Customer creation during checkout.
    86  type PaymentLinkCustomerCreation string
    87  
    88  // List of values that PaymentLinkCustomerCreation can take
    89  const (
    90  	PaymentLinkCustomerCreationAlways     PaymentLinkCustomerCreation = "always"
    91  	PaymentLinkCustomerCreationIfRequired PaymentLinkCustomerCreation = "if_required"
    92  )
    93  
    94  // Type of the account referenced.
    95  type PaymentLinkInvoiceCreationInvoiceDataIssuerType string
    96  
    97  // List of values that PaymentLinkInvoiceCreationInvoiceDataIssuerType can take
    98  const (
    99  	PaymentLinkInvoiceCreationInvoiceDataIssuerTypeAccount PaymentLinkInvoiceCreationInvoiceDataIssuerType = "account"
   100  	PaymentLinkInvoiceCreationInvoiceDataIssuerTypeSelf    PaymentLinkInvoiceCreationInvoiceDataIssuerType = "self"
   101  )
   102  
   103  // Indicates when the funds will be captured from the customer's account.
   104  type PaymentLinkPaymentIntentDataCaptureMethod string
   105  
   106  // List of values that PaymentLinkPaymentIntentDataCaptureMethod can take
   107  const (
   108  	PaymentLinkPaymentIntentDataCaptureMethodAutomatic      PaymentLinkPaymentIntentDataCaptureMethod = "automatic"
   109  	PaymentLinkPaymentIntentDataCaptureMethodAutomaticAsync PaymentLinkPaymentIntentDataCaptureMethod = "automatic_async"
   110  	PaymentLinkPaymentIntentDataCaptureMethodManual         PaymentLinkPaymentIntentDataCaptureMethod = "manual"
   111  )
   112  
   113  // Indicates that you intend to make future payments with the payment method collected during checkout.
   114  type PaymentLinkPaymentIntentDataSetupFutureUsage string
   115  
   116  // List of values that PaymentLinkPaymentIntentDataSetupFutureUsage can take
   117  const (
   118  	PaymentLinkPaymentIntentDataSetupFutureUsageOffSession PaymentLinkPaymentIntentDataSetupFutureUsage = "off_session"
   119  	PaymentLinkPaymentIntentDataSetupFutureUsageOnSession  PaymentLinkPaymentIntentDataSetupFutureUsage = "on_session"
   120  )
   121  
   122  // Configuration for collecting a payment method during checkout. Defaults to `always`.
   123  type PaymentLinkPaymentMethodCollection string
   124  
   125  // List of values that PaymentLinkPaymentMethodCollection can take
   126  const (
   127  	PaymentLinkPaymentMethodCollectionAlways     PaymentLinkPaymentMethodCollection = "always"
   128  	PaymentLinkPaymentMethodCollectionIfRequired PaymentLinkPaymentMethodCollection = "if_required"
   129  )
   130  
   131  // The list of payment method types that customers can use. When `null`, Stripe will dynamically show relevant payment methods you've enabled in your [payment method settings](https://dashboard.stripe.com/settings/payment_methods).
   132  type PaymentLinkPaymentMethodType string
   133  
   134  // List of values that PaymentLinkPaymentMethodType can take
   135  const (
   136  	PaymentLinkPaymentMethodTypeAffirm           PaymentLinkPaymentMethodType = "affirm"
   137  	PaymentLinkPaymentMethodTypeAfterpayClearpay PaymentLinkPaymentMethodType = "afterpay_clearpay"
   138  	PaymentLinkPaymentMethodTypeAlipay           PaymentLinkPaymentMethodType = "alipay"
   139  	PaymentLinkPaymentMethodTypeAUBECSDebit      PaymentLinkPaymentMethodType = "au_becs_debit"
   140  	PaymentLinkPaymentMethodTypeBACSDebit        PaymentLinkPaymentMethodType = "bacs_debit"
   141  	PaymentLinkPaymentMethodTypeBancontact       PaymentLinkPaymentMethodType = "bancontact"
   142  	PaymentLinkPaymentMethodTypeBLIK             PaymentLinkPaymentMethodType = "blik"
   143  	PaymentLinkPaymentMethodTypeBoleto           PaymentLinkPaymentMethodType = "boleto"
   144  	PaymentLinkPaymentMethodTypeCard             PaymentLinkPaymentMethodType = "card"
   145  	PaymentLinkPaymentMethodTypeCashApp          PaymentLinkPaymentMethodType = "cashapp"
   146  	PaymentLinkPaymentMethodTypeEPS              PaymentLinkPaymentMethodType = "eps"
   147  	PaymentLinkPaymentMethodTypeFPX              PaymentLinkPaymentMethodType = "fpx"
   148  	PaymentLinkPaymentMethodTypeGiropay          PaymentLinkPaymentMethodType = "giropay"
   149  	PaymentLinkPaymentMethodTypeGrabpay          PaymentLinkPaymentMethodType = "grabpay"
   150  	PaymentLinkPaymentMethodTypeIDEAL            PaymentLinkPaymentMethodType = "ideal"
   151  	PaymentLinkPaymentMethodTypeKlarna           PaymentLinkPaymentMethodType = "klarna"
   152  	PaymentLinkPaymentMethodTypeKonbini          PaymentLinkPaymentMethodType = "konbini"
   153  	PaymentLinkPaymentMethodTypeLink             PaymentLinkPaymentMethodType = "link"
   154  	PaymentLinkPaymentMethodTypeOXXO             PaymentLinkPaymentMethodType = "oxxo"
   155  	PaymentLinkPaymentMethodTypeP24              PaymentLinkPaymentMethodType = "p24"
   156  	PaymentLinkPaymentMethodTypePayNow           PaymentLinkPaymentMethodType = "paynow"
   157  	PaymentLinkPaymentMethodTypePaypal           PaymentLinkPaymentMethodType = "paypal"
   158  	PaymentLinkPaymentMethodTypePix              PaymentLinkPaymentMethodType = "pix"
   159  	PaymentLinkPaymentMethodTypePromptPay        PaymentLinkPaymentMethodType = "promptpay"
   160  	PaymentLinkPaymentMethodTypeSEPADebit        PaymentLinkPaymentMethodType = "sepa_debit"
   161  	PaymentLinkPaymentMethodTypeSofort           PaymentLinkPaymentMethodType = "sofort"
   162  	PaymentLinkPaymentMethodTypeSwish            PaymentLinkPaymentMethodType = "swish"
   163  	PaymentLinkPaymentMethodTypeUSBankAccount    PaymentLinkPaymentMethodType = "us_bank_account"
   164  	PaymentLinkPaymentMethodTypeWeChatPay        PaymentLinkPaymentMethodType = "wechat_pay"
   165  )
   166  
   167  // Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
   168  type PaymentLinkSubmitType string
   169  
   170  // List of values that PaymentLinkSubmitType can take
   171  const (
   172  	PaymentLinkSubmitTypeAuto   PaymentLinkSubmitType = "auto"
   173  	PaymentLinkSubmitTypeBook   PaymentLinkSubmitType = "book"
   174  	PaymentLinkSubmitTypeDonate PaymentLinkSubmitType = "donate"
   175  	PaymentLinkSubmitTypePay    PaymentLinkSubmitType = "pay"
   176  )
   177  
   178  // Type of the account referenced.
   179  type PaymentLinkSubscriptionDataInvoiceSettingsIssuerType string
   180  
   181  // List of values that PaymentLinkSubscriptionDataInvoiceSettingsIssuerType can take
   182  const (
   183  	PaymentLinkSubscriptionDataInvoiceSettingsIssuerTypeAccount PaymentLinkSubscriptionDataInvoiceSettingsIssuerType = "account"
   184  	PaymentLinkSubscriptionDataInvoiceSettingsIssuerTypeSelf    PaymentLinkSubscriptionDataInvoiceSettingsIssuerType = "self"
   185  )
   186  
   187  // Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
   188  type PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod string
   189  
   190  // List of values that PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod can take
   191  const (
   192  	PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethodCancel        PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod = "cancel"
   193  	PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethodCreateInvoice PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod = "create_invoice"
   194  	PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethodPause         PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod = "pause"
   195  )
   196  
   197  // Returns a list of your payment links.
   198  type PaymentLinkListParams struct {
   199  	ListParams `form:"*"`
   200  	// Only return payment links that are active or inactive (e.g., pass `false` to list all inactive payment links).
   201  	Active *bool `form:"active"`
   202  	// Specifies which fields in the response should be expanded.
   203  	Expand []*string `form:"expand"`
   204  }
   205  
   206  // AddExpand appends a new field to expand.
   207  func (p *PaymentLinkListParams) AddExpand(f string) {
   208  	p.Expand = append(p.Expand, &f)
   209  }
   210  
   211  // Configuration when `type=hosted_confirmation`.
   212  type PaymentLinkAfterCompletionHostedConfirmationParams struct {
   213  	// A custom message to display to the customer after the purchase is complete.
   214  	CustomMessage *string `form:"custom_message"`
   215  }
   216  
   217  // Configuration when `type=redirect`.
   218  type PaymentLinkAfterCompletionRedirectParams struct {
   219  	// The URL the customer will be redirected to after the purchase is complete. You can embed `{CHECKOUT_SESSION_ID}` into the URL to have the `id` of the completed [checkout session](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-id) included.
   220  	URL *string `form:"url"`
   221  }
   222  
   223  // Behavior after the purchase is complete.
   224  type PaymentLinkAfterCompletionParams struct {
   225  	// Configuration when `type=hosted_confirmation`.
   226  	HostedConfirmation *PaymentLinkAfterCompletionHostedConfirmationParams `form:"hosted_confirmation"`
   227  	// Configuration when `type=redirect`.
   228  	Redirect *PaymentLinkAfterCompletionRedirectParams `form:"redirect"`
   229  	// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`.
   230  	Type *string `form:"type"`
   231  }
   232  
   233  // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
   234  type PaymentLinkAutomaticTaxLiabilityParams struct {
   235  	// The connected account being referenced when `type` is `account`.
   236  	Account *string `form:"account"`
   237  	// Type of the account referenced in the request.
   238  	Type *string `form:"type"`
   239  }
   240  
   241  // Configuration for automatic tax collection.
   242  type PaymentLinkAutomaticTaxParams struct {
   243  	// If `true`, tax will be calculated automatically using the customer's location.
   244  	Enabled *bool `form:"enabled"`
   245  	// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
   246  	Liability *PaymentLinkAutomaticTaxLiabilityParams `form:"liability"`
   247  }
   248  
   249  // Determines the display of payment method reuse agreement text in the UI. If set to `hidden`, it will hide legal text related to the reuse of a payment method.
   250  type PaymentLinkConsentCollectionPaymentMethodReuseAgreementParams struct {
   251  	// Determines the position and visibility of the payment method reuse agreement in the UI. When set to `auto`, Stripe's
   252  	// defaults will be used. When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI.
   253  	Position *string `form:"position"`
   254  }
   255  
   256  // Configure fields to gather active consent from customers.
   257  type PaymentLinkConsentCollectionParams struct {
   258  	// Determines the display of payment method reuse agreement text in the UI. If set to `hidden`, it will hide legal text related to the reuse of a payment method.
   259  	PaymentMethodReuseAgreement *PaymentLinkConsentCollectionPaymentMethodReuseAgreementParams `form:"payment_method_reuse_agreement"`
   260  	// If set to `auto`, enables the collection of customer consent for promotional communications. The Checkout
   261  	// Session will determine whether to display an option to opt into promotional communication
   262  	// from the merchant depending on the customer's locale. Only available to US merchants.
   263  	Promotions *string `form:"promotions"`
   264  	// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay.
   265  	// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public).
   266  	TermsOfService *string `form:"terms_of_service"`
   267  }
   268  
   269  // The options available for the customer to select. Up to 200 options allowed.
   270  type PaymentLinkCustomFieldDropdownOptionParams struct {
   271  	// The label for the option, displayed to the customer. Up to 100 characters.
   272  	Label *string `form:"label"`
   273  	// 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.
   274  	Value *string `form:"value"`
   275  }
   276  
   277  // Configuration for `type=dropdown` fields.
   278  type PaymentLinkCustomFieldDropdownParams struct {
   279  	// The options available for the customer to select. Up to 200 options allowed.
   280  	Options []*PaymentLinkCustomFieldDropdownOptionParams `form:"options"`
   281  }
   282  
   283  // The label for the field, displayed to the customer.
   284  type PaymentLinkCustomFieldLabelParams struct {
   285  	// Custom text for the label, displayed to the customer. Up to 50 characters.
   286  	Custom *string `form:"custom"`
   287  	// The type of the label.
   288  	Type *string `form:"type"`
   289  }
   290  
   291  // Configuration for `type=numeric` fields.
   292  type PaymentLinkCustomFieldNumericParams struct {
   293  	// The maximum character length constraint for the customer's input.
   294  	MaximumLength *int64 `form:"maximum_length"`
   295  	// The minimum character length requirement for the customer's input.
   296  	MinimumLength *int64 `form:"minimum_length"`
   297  }
   298  
   299  // Configuration for `type=text` fields.
   300  type PaymentLinkCustomFieldTextParams struct {
   301  	// The maximum character length constraint for the customer's input.
   302  	MaximumLength *int64 `form:"maximum_length"`
   303  	// The minimum character length requirement for the customer's input.
   304  	MinimumLength *int64 `form:"minimum_length"`
   305  }
   306  
   307  // Collect additional information from your customer using custom fields. Up to 3 fields are supported.
   308  type PaymentLinkCustomFieldParams struct {
   309  	// Configuration for `type=dropdown` fields.
   310  	Dropdown *PaymentLinkCustomFieldDropdownParams `form:"dropdown"`
   311  	// 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.
   312  	Key *string `form:"key"`
   313  	// The label for the field, displayed to the customer.
   314  	Label *PaymentLinkCustomFieldLabelParams `form:"label"`
   315  	// Configuration for `type=numeric` fields.
   316  	Numeric *PaymentLinkCustomFieldNumericParams `form:"numeric"`
   317  	// Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
   318  	Optional *bool `form:"optional"`
   319  	// Configuration for `type=text` fields.
   320  	Text *PaymentLinkCustomFieldTextParams `form:"text"`
   321  	// The type of the field.
   322  	Type *string `form:"type"`
   323  }
   324  
   325  // Custom text that should be displayed after the payment confirmation button.
   326  type PaymentLinkCustomTextAfterSubmitParams struct {
   327  	// Text may be up to 1200 characters in length.
   328  	Message *string `form:"message"`
   329  }
   330  
   331  // Custom text that should be displayed alongside shipping address collection.
   332  type PaymentLinkCustomTextShippingAddressParams struct {
   333  	// Text may be up to 1200 characters in length.
   334  	Message *string `form:"message"`
   335  }
   336  
   337  // Custom text that should be displayed alongside the payment confirmation button.
   338  type PaymentLinkCustomTextSubmitParams struct {
   339  	// Text may be up to 1200 characters in length.
   340  	Message *string `form:"message"`
   341  }
   342  
   343  // Custom text that should be displayed in place of the default terms of service agreement text.
   344  type PaymentLinkCustomTextTermsOfServiceAcceptanceParams struct {
   345  	// Text may be up to 1200 characters in length.
   346  	Message *string `form:"message"`
   347  }
   348  
   349  // Display additional text for your customers using custom text.
   350  type PaymentLinkCustomTextParams struct {
   351  	// Custom text that should be displayed after the payment confirmation button.
   352  	AfterSubmit *PaymentLinkCustomTextAfterSubmitParams `form:"after_submit"`
   353  	// Custom text that should be displayed alongside shipping address collection.
   354  	ShippingAddress *PaymentLinkCustomTextShippingAddressParams `form:"shipping_address"`
   355  	// Custom text that should be displayed alongside the payment confirmation button.
   356  	Submit *PaymentLinkCustomTextSubmitParams `form:"submit"`
   357  	// Custom text that should be displayed in place of the default terms of service agreement text.
   358  	TermsOfServiceAcceptance *PaymentLinkCustomTextTermsOfServiceAcceptanceParams `form:"terms_of_service_acceptance"`
   359  }
   360  
   361  // Default custom fields to be displayed on invoices for this customer.
   362  type PaymentLinkInvoiceCreationInvoiceDataCustomFieldParams struct {
   363  	// The name of the custom field. This may be up to 40 characters.
   364  	Name *string `form:"name"`
   365  	// The value of the custom field. This may be up to 140 characters.
   366  	Value *string `form:"value"`
   367  }
   368  
   369  // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
   370  type PaymentLinkInvoiceCreationInvoiceDataIssuerParams struct {
   371  	// The connected account being referenced when `type` is `account`.
   372  	Account *string `form:"account"`
   373  	// Type of the account referenced in the request.
   374  	Type *string `form:"type"`
   375  }
   376  
   377  // Default options for invoice PDF rendering for this customer.
   378  type PaymentLinkInvoiceCreationInvoiceDataRenderingOptionsParams struct {
   379  	// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
   380  	AmountTaxDisplay *string `form:"amount_tax_display"`
   381  }
   382  
   383  // Invoice PDF configuration.
   384  type PaymentLinkInvoiceCreationInvoiceDataParams struct {
   385  	// The account tax IDs associated with the invoice.
   386  	AccountTaxIDs []*string `form:"account_tax_ids"`
   387  	// Default custom fields to be displayed on invoices for this customer.
   388  	CustomFields []*PaymentLinkInvoiceCreationInvoiceDataCustomFieldParams `form:"custom_fields"`
   389  	// An arbitrary string attached to the object. Often useful for displaying to users.
   390  	Description *string `form:"description"`
   391  	// Default footer to be displayed on invoices for this customer.
   392  	Footer *string `form:"footer"`
   393  	// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
   394  	Issuer *PaymentLinkInvoiceCreationInvoiceDataIssuerParams `form:"issuer"`
   395  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
   396  	Metadata map[string]string `form:"metadata"`
   397  	// Default options for invoice PDF rendering for this customer.
   398  	RenderingOptions *PaymentLinkInvoiceCreationInvoiceDataRenderingOptionsParams `form:"rendering_options"`
   399  }
   400  
   401  // AddMetadata adds a new key-value pair to the Metadata.
   402  func (p *PaymentLinkInvoiceCreationInvoiceDataParams) AddMetadata(key string, value string) {
   403  	if p.Metadata == nil {
   404  		p.Metadata = make(map[string]string)
   405  	}
   406  
   407  	p.Metadata[key] = value
   408  }
   409  
   410  // Generate a post-purchase Invoice for one-time payments.
   411  type PaymentLinkInvoiceCreationParams struct {
   412  	// Whether the feature is enabled
   413  	Enabled *bool `form:"enabled"`
   414  	// Invoice PDF configuration.
   415  	InvoiceData *PaymentLinkInvoiceCreationInvoiceDataParams `form:"invoice_data"`
   416  }
   417  
   418  // When set, provides configuration for this item's quantity to be adjusted by the customer during checkout.
   419  type PaymentLinkLineItemAdjustableQuantityParams struct {
   420  	// Set to true if the quantity can be adjusted to any non-negative Integer.
   421  	Enabled *bool `form:"enabled"`
   422  	// The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999.
   423  	Maximum *int64 `form:"maximum"`
   424  	// The minimum quantity the customer can purchase. By default this value is 0. If there is only one item in the cart then that item's quantity cannot go down to 0.
   425  	Minimum *int64 `form:"minimum"`
   426  }
   427  
   428  // The line items representing what is being sold. Each line item represents an item being sold. Up to 20 line items are supported.
   429  type PaymentLinkLineItemParams struct {
   430  	// When set, provides configuration for this item's quantity to be adjusted by the customer during checkout.
   431  	AdjustableQuantity *PaymentLinkLineItemAdjustableQuantityParams `form:"adjustable_quantity"`
   432  	// The ID of an existing line item on the payment link.
   433  	ID *string `form:"id"`
   434  	// The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object.
   435  	Price *string `form:"price"`
   436  	// The quantity of the line item being purchased.
   437  	Quantity *int64 `form:"quantity"`
   438  }
   439  
   440  // A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
   441  type PaymentLinkPaymentIntentDataParams struct {
   442  	// Controls when the funds will be captured from the customer's account.
   443  	CaptureMethod *string `form:"capture_method"`
   444  	// An arbitrary string attached to the object. Often useful for displaying to users.
   445  	Description *string `form:"description"`
   446  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will declaratively set metadata on [Payment Intents](https://stripe.com/docs/api/payment_intents) generated from this payment link. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
   447  	Metadata map[string]string `form:"metadata"`
   448  	// Indicates that you intend to [make future payments](https://stripe.com/docs/payments/payment-intents#future-usage) with the payment method collected by this Checkout Session.
   449  	//
   450  	// When setting this to `on_session`, Checkout will show a notice to the customer that their payment details will be saved.
   451  	//
   452  	// When setting this to `off_session`, Checkout will show a notice to the customer that their payment details will be saved and used for future payments.
   453  	//
   454  	// If a Customer has been provided or Checkout creates a new Customer,Checkout will attach the payment method to the Customer.
   455  	//
   456  	// If Checkout does not create a Customer, the payment method is not attached to a Customer. To reuse the payment method, you can retrieve it from the Checkout Session's PaymentIntent.
   457  	//
   458  	// When processing card payments, Checkout also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.
   459  	SetupFutureUsage *string `form:"setup_future_usage"`
   460  	// Extra information about the payment. This will appear on your customer's statement when this payment succeeds in creating a charge.
   461  	StatementDescriptor *string `form:"statement_descriptor"`
   462  	// Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
   463  	StatementDescriptorSuffix *string `form:"statement_descriptor_suffix"`
   464  	// A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details.
   465  	TransferGroup *string `form:"transfer_group"`
   466  }
   467  
   468  // AddMetadata adds a new key-value pair to the Metadata.
   469  func (p *PaymentLinkPaymentIntentDataParams) AddMetadata(key string, value string) {
   470  	if p.Metadata == nil {
   471  		p.Metadata = make(map[string]string)
   472  	}
   473  
   474  	p.Metadata[key] = value
   475  }
   476  
   477  // Controls phone number collection settings during checkout.
   478  //
   479  // We recommend that you review your privacy policy and check with your legal contacts.
   480  type PaymentLinkPhoneNumberCollectionParams struct {
   481  	// Set to `true` to enable phone number collection.
   482  	Enabled *bool `form:"enabled"`
   483  }
   484  
   485  // Configuration for the `completed_sessions` restriction type.
   486  type PaymentLinkRestrictionsCompletedSessionsParams struct {
   487  	// The maximum number of checkout sessions that can be completed for the `completed_sessions` restriction to be met.
   488  	Limit *int64 `form:"limit"`
   489  }
   490  
   491  // Settings that restrict the usage of a payment link.
   492  type PaymentLinkRestrictionsParams struct {
   493  	// Configuration for the `completed_sessions` restriction type.
   494  	CompletedSessions *PaymentLinkRestrictionsCompletedSessionsParams `form:"completed_sessions"`
   495  }
   496  
   497  // Configuration for collecting the customer's shipping address.
   498  type PaymentLinkShippingAddressCollectionParams struct {
   499  	// An array of two-letter ISO country codes representing which countries Checkout should provide as options for
   500  	// shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`.
   501  	AllowedCountries []*string `form:"allowed_countries"`
   502  }
   503  
   504  // The shipping rate options to apply to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link.
   505  type PaymentLinkShippingOptionParams struct {
   506  	// The ID of the Shipping Rate to use for this shipping option.
   507  	ShippingRate *string `form:"shipping_rate"`
   508  }
   509  
   510  // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
   511  type PaymentLinkSubscriptionDataInvoiceSettingsIssuerParams struct {
   512  	// The connected account being referenced when `type` is `account`.
   513  	Account *string `form:"account"`
   514  	// Type of the account referenced in the request.
   515  	Type *string `form:"type"`
   516  }
   517  
   518  // All invoices will be billed using the specified settings.
   519  type PaymentLinkSubscriptionDataInvoiceSettingsParams struct {
   520  	// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
   521  	Issuer *PaymentLinkSubscriptionDataInvoiceSettingsIssuerParams `form:"issuer"`
   522  }
   523  
   524  // Defines how the subscription should behave when the user's free trial ends.
   525  type PaymentLinkSubscriptionDataTrialSettingsEndBehaviorParams struct {
   526  	// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
   527  	MissingPaymentMethod *string `form:"missing_payment_method"`
   528  }
   529  
   530  // Settings related to subscription trials.
   531  type PaymentLinkSubscriptionDataTrialSettingsParams struct {
   532  	// Defines how the subscription should behave when the user's free trial ends.
   533  	EndBehavior *PaymentLinkSubscriptionDataTrialSettingsEndBehaviorParams `form:"end_behavior"`
   534  }
   535  
   536  // When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`.
   537  type PaymentLinkSubscriptionDataParams struct {
   538  	// The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
   539  	Description *string `form:"description"`
   540  	// All invoices will be billed using the specified settings.
   541  	InvoiceSettings *PaymentLinkSubscriptionDataInvoiceSettingsParams `form:"invoice_settings"`
   542  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will declaratively set metadata on [Subscriptions](https://stripe.com/docs/api/subscriptions) generated from this payment link. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
   543  	Metadata map[string]string `form:"metadata"`
   544  	// Integer representing the number of trial period days before the customer is charged for the first time. Has to be at least 1.
   545  	TrialPeriodDays *int64 `form:"trial_period_days"`
   546  	// Settings related to subscription trials.
   547  	TrialSettings *PaymentLinkSubscriptionDataTrialSettingsParams `form:"trial_settings"`
   548  }
   549  
   550  // AddMetadata adds a new key-value pair to the Metadata.
   551  func (p *PaymentLinkSubscriptionDataParams) AddMetadata(key string, value string) {
   552  	if p.Metadata == nil {
   553  		p.Metadata = make(map[string]string)
   554  	}
   555  
   556  	p.Metadata[key] = value
   557  }
   558  
   559  // Controls tax ID collection during checkout.
   560  type PaymentLinkTaxIDCollectionParams struct {
   561  	// Set to `true` to enable tax ID collection.
   562  	Enabled *bool `form:"enabled"`
   563  }
   564  
   565  // The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
   566  type PaymentLinkTransferDataParams struct {
   567  	// The amount that will be transferred automatically when a charge succeeds.
   568  	Amount *int64 `form:"amount"`
   569  	// If specified, successful charges will be attributed to the destination
   570  	// account for tax reporting, and the funds from charges will be transferred
   571  	// to the destination account. The ID of the resulting transfer will be
   572  	// returned on the successful charge's `transfer` field.
   573  	Destination *string `form:"destination"`
   574  }
   575  
   576  // Creates a payment link.
   577  type PaymentLinkParams struct {
   578  	Params `form:"*"`
   579  	// Whether the payment link's `url` is active. If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated.
   580  	Active *bool `form:"active"`
   581  	// Behavior after the purchase is complete.
   582  	AfterCompletion *PaymentLinkAfterCompletionParams `form:"after_completion"`
   583  	// Enables user redeemable promotion codes.
   584  	AllowPromotionCodes *bool `form:"allow_promotion_codes"`
   585  	// 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. Can only be applied when there are no line items with recurring prices.
   586  	ApplicationFeeAmount *int64 `form:"application_fee_amount"`
   587  	// A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. There must be at least 1 line item with a recurring price to use this field.
   588  	ApplicationFeePercent *float64 `form:"application_fee_percent"`
   589  	// Configuration for automatic tax collection.
   590  	AutomaticTax *PaymentLinkAutomaticTaxParams `form:"automatic_tax"`
   591  	// Configuration for collecting the customer's billing address. Defaults to `auto`.
   592  	BillingAddressCollection *string `form:"billing_address_collection"`
   593  	// Configure fields to gather active consent from customers.
   594  	ConsentCollection *PaymentLinkConsentCollectionParams `form:"consent_collection"`
   595  	// 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) and supported by each line item's price.
   596  	Currency *string `form:"currency"`
   597  	// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers).
   598  	CustomerCreation *string `form:"customer_creation"`
   599  	// Collect additional information from your customer using custom fields. Up to 3 fields are supported.
   600  	CustomFields []*PaymentLinkCustomFieldParams `form:"custom_fields"`
   601  	// Display additional text for your customers using custom text.
   602  	CustomText *PaymentLinkCustomTextParams `form:"custom_text"`
   603  	// Specifies which fields in the response should be expanded.
   604  	Expand []*string `form:"expand"`
   605  	// The custom message to be displayed to a customer when a payment link is no longer active.
   606  	InactiveMessage *string `form:"inactive_message"`
   607  	// Generate a post-purchase Invoice for one-time payments.
   608  	InvoiceCreation *PaymentLinkInvoiceCreationParams `form:"invoice_creation"`
   609  	// The line items representing what is being sold. Each line item represents an item being sold. Up to 20 line items are supported.
   610  	LineItems []*PaymentLinkLineItemParams `form:"line_items"`
   611  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata associated with this Payment Link will automatically be copied to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link.
   612  	Metadata map[string]string `form:"metadata"`
   613  	// The account on behalf of which to charge.
   614  	OnBehalfOf *string `form:"on_behalf_of"`
   615  	// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
   616  	PaymentIntentData *PaymentLinkPaymentIntentDataParams `form:"payment_intent_data"`
   617  	// Specify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
   618  	//
   619  	// Can only be set in `subscription` mode. Defaults to `always`.
   620  	//
   621  	// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials).
   622  	PaymentMethodCollection *string `form:"payment_method_collection"`
   623  	// The list of payment method types that customers can use. If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://stripe.com/docs/payments/payment-methods/integration-options#payment-method-product-support)).
   624  	PaymentMethodTypes []*string `form:"payment_method_types"`
   625  	// Controls phone number collection settings during checkout.
   626  	//
   627  	// We recommend that you review your privacy policy and check with your legal contacts.
   628  	PhoneNumberCollection *PaymentLinkPhoneNumberCollectionParams `form:"phone_number_collection"`
   629  	// Settings that restrict the usage of a payment link.
   630  	Restrictions *PaymentLinkRestrictionsParams `form:"restrictions"`
   631  	// Configuration for collecting the customer's shipping address.
   632  	ShippingAddressCollection *PaymentLinkShippingAddressCollectionParams `form:"shipping_address_collection"`
   633  	// The shipping rate options to apply to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link.
   634  	ShippingOptions []*PaymentLinkShippingOptionParams `form:"shipping_options"`
   635  	// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`).
   636  	SubmitType *string `form:"submit_type"`
   637  	// When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`.
   638  	SubscriptionData *PaymentLinkSubscriptionDataParams `form:"subscription_data"`
   639  	// Controls tax ID collection during checkout.
   640  	TaxIDCollection *PaymentLinkTaxIDCollectionParams `form:"tax_id_collection"`
   641  	// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
   642  	TransferData *PaymentLinkTransferDataParams `form:"transfer_data"`
   643  }
   644  
   645  // AddExpand appends a new field to expand.
   646  func (p *PaymentLinkParams) AddExpand(f string) {
   647  	p.Expand = append(p.Expand, &f)
   648  }
   649  
   650  // AddMetadata adds a new key-value pair to the Metadata.
   651  func (p *PaymentLinkParams) AddMetadata(key string, value string) {
   652  	if p.Metadata == nil {
   653  		p.Metadata = make(map[string]string)
   654  	}
   655  
   656  	p.Metadata[key] = value
   657  }
   658  
   659  // When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
   660  type PaymentLinkListLineItemsParams struct {
   661  	ListParams  `form:"*"`
   662  	PaymentLink *string `form:"-"` // Included in URL
   663  	// Specifies which fields in the response should be expanded.
   664  	Expand []*string `form:"expand"`
   665  }
   666  
   667  // AddExpand appends a new field to expand.
   668  func (p *PaymentLinkListLineItemsParams) AddExpand(f string) {
   669  	p.Expand = append(p.Expand, &f)
   670  }
   671  
   672  type PaymentLinkAfterCompletionHostedConfirmation struct {
   673  	// The custom message that is displayed to the customer after the purchase is complete.
   674  	CustomMessage string `json:"custom_message"`
   675  }
   676  type PaymentLinkAfterCompletionRedirect struct {
   677  	// The URL the customer will be redirected to after the purchase is complete.
   678  	URL string `json:"url"`
   679  }
   680  type PaymentLinkAfterCompletion struct {
   681  	HostedConfirmation *PaymentLinkAfterCompletionHostedConfirmation `json:"hosted_confirmation"`
   682  	Redirect           *PaymentLinkAfterCompletionRedirect           `json:"redirect"`
   683  	// The specified behavior after the purchase is complete.
   684  	Type PaymentLinkAfterCompletionType `json:"type"`
   685  }
   686  
   687  // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
   688  type PaymentLinkAutomaticTaxLiability struct {
   689  	// The connected account being referenced when `type` is `account`.
   690  	Account *Account `json:"account"`
   691  	// Type of the account referenced.
   692  	Type PaymentLinkAutomaticTaxLiabilityType `json:"type"`
   693  }
   694  type PaymentLinkAutomaticTax struct {
   695  	// If `true`, tax will be calculated automatically using the customer's location.
   696  	Enabled bool `json:"enabled"`
   697  	// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
   698  	Liability *PaymentLinkAutomaticTaxLiability `json:"liability"`
   699  }
   700  
   701  // Settings related to the payment method reuse text shown in the Checkout UI.
   702  type PaymentLinkConsentCollectionPaymentMethodReuseAgreement struct {
   703  	// Determines the position and visibility of the payment method reuse agreement in the UI. When set to `auto`, Stripe's defaults will be used.
   704  	//
   705  	// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI.
   706  	Position PaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition `json:"position"`
   707  }
   708  
   709  // When set, provides configuration to gather active consent from customers.
   710  type PaymentLinkConsentCollection struct {
   711  	// Settings related to the payment method reuse text shown in the Checkout UI.
   712  	PaymentMethodReuseAgreement *PaymentLinkConsentCollectionPaymentMethodReuseAgreement `json:"payment_method_reuse_agreement"`
   713  	// If set to `auto`, enables the collection of customer consent for promotional communications.
   714  	Promotions PaymentLinkConsentCollectionPromotions `json:"promotions"`
   715  	// If set to `required`, it requires cutomers to accept the terms of service before being able to pay. If set to `none`, customers won't be shown a checkbox to accept the terms of service.
   716  	TermsOfService PaymentLinkConsentCollectionTermsOfService `json:"terms_of_service"`
   717  }
   718  
   719  // The options available for the customer to select. Up to 200 options allowed.
   720  type PaymentLinkCustomFieldDropdownOption struct {
   721  	// The label for the option, displayed to the customer. Up to 100 characters.
   722  	Label string `json:"label"`
   723  	// 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.
   724  	Value string `json:"value"`
   725  }
   726  type PaymentLinkCustomFieldDropdown struct {
   727  	// The options available for the customer to select. Up to 200 options allowed.
   728  	Options []*PaymentLinkCustomFieldDropdownOption `json:"options"`
   729  }
   730  type PaymentLinkCustomFieldLabel struct {
   731  	// Custom text for the label, displayed to the customer. Up to 50 characters.
   732  	Custom string `json:"custom"`
   733  	// The type of the label.
   734  	Type PaymentLinkCustomFieldLabelType `json:"type"`
   735  }
   736  type PaymentLinkCustomFieldNumeric struct {
   737  	// The maximum character length constraint for the customer's input.
   738  	MaximumLength int64 `json:"maximum_length"`
   739  	// The minimum character length requirement for the customer's input.
   740  	MinimumLength int64 `json:"minimum_length"`
   741  }
   742  type PaymentLinkCustomFieldText struct {
   743  	// The maximum character length constraint for the customer's input.
   744  	MaximumLength int64 `json:"maximum_length"`
   745  	// The minimum character length requirement for the customer's input.
   746  	MinimumLength int64 `json:"minimum_length"`
   747  }
   748  
   749  // Collect additional information from your customer using custom fields. Up to 3 fields are supported.
   750  type PaymentLinkCustomField struct {
   751  	Dropdown *PaymentLinkCustomFieldDropdown `json:"dropdown"`
   752  	// 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.
   753  	Key     string                         `json:"key"`
   754  	Label   *PaymentLinkCustomFieldLabel   `json:"label"`
   755  	Numeric *PaymentLinkCustomFieldNumeric `json:"numeric"`
   756  	// Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
   757  	Optional bool                        `json:"optional"`
   758  	Text     *PaymentLinkCustomFieldText `json:"text"`
   759  	// The type of the field.
   760  	Type PaymentLinkCustomFieldType `json:"type"`
   761  }
   762  
   763  // Custom text that should be displayed after the payment confirmation button.
   764  type PaymentLinkCustomTextAfterSubmit struct {
   765  	// Text may be up to 1200 characters in length.
   766  	Message string `json:"message"`
   767  }
   768  
   769  // Custom text that should be displayed alongside shipping address collection.
   770  type PaymentLinkCustomTextShippingAddress struct {
   771  	// Text may be up to 1200 characters in length.
   772  	Message string `json:"message"`
   773  }
   774  
   775  // Custom text that should be displayed alongside the payment confirmation button.
   776  type PaymentLinkCustomTextSubmit struct {
   777  	// Text may be up to 1200 characters in length.
   778  	Message string `json:"message"`
   779  }
   780  
   781  // Custom text that should be displayed in place of the default terms of service agreement text.
   782  type PaymentLinkCustomTextTermsOfServiceAcceptance struct {
   783  	// Text may be up to 1200 characters in length.
   784  	Message string `json:"message"`
   785  }
   786  type PaymentLinkCustomText struct {
   787  	// Custom text that should be displayed after the payment confirmation button.
   788  	AfterSubmit *PaymentLinkCustomTextAfterSubmit `json:"after_submit"`
   789  	// Custom text that should be displayed alongside shipping address collection.
   790  	ShippingAddress *PaymentLinkCustomTextShippingAddress `json:"shipping_address"`
   791  	// Custom text that should be displayed alongside the payment confirmation button.
   792  	Submit *PaymentLinkCustomTextSubmit `json:"submit"`
   793  	// Custom text that should be displayed in place of the default terms of service agreement text.
   794  	TermsOfServiceAcceptance *PaymentLinkCustomTextTermsOfServiceAcceptance `json:"terms_of_service_acceptance"`
   795  }
   796  
   797  // A list of up to 4 custom fields to be displayed on the invoice.
   798  type PaymentLinkInvoiceCreationInvoiceDataCustomField struct {
   799  	// The name of the custom field.
   800  	Name string `json:"name"`
   801  	// The value of the custom field.
   802  	Value string `json:"value"`
   803  }
   804  
   805  // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
   806  type PaymentLinkInvoiceCreationInvoiceDataIssuer struct {
   807  	// The connected account being referenced when `type` is `account`.
   808  	Account *Account `json:"account"`
   809  	// Type of the account referenced.
   810  	Type PaymentLinkInvoiceCreationInvoiceDataIssuerType `json:"type"`
   811  }
   812  
   813  // Options for invoice PDF rendering.
   814  type PaymentLinkInvoiceCreationInvoiceDataRenderingOptions struct {
   815  	// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
   816  	AmountTaxDisplay string `json:"amount_tax_display"`
   817  }
   818  
   819  // Configuration for the invoice. Default invoice values will be used if unspecified.
   820  type PaymentLinkInvoiceCreationInvoiceData struct {
   821  	// The account tax IDs associated with the invoice.
   822  	AccountTaxIDs []*TaxID `json:"account_tax_ids"`
   823  	// A list of up to 4 custom fields to be displayed on the invoice.
   824  	CustomFields []*PaymentLinkInvoiceCreationInvoiceDataCustomField `json:"custom_fields"`
   825  	// An arbitrary string attached to the object. Often useful for displaying to users.
   826  	Description string `json:"description"`
   827  	// Footer to be displayed on the invoice.
   828  	Footer string `json:"footer"`
   829  	// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
   830  	Issuer *PaymentLinkInvoiceCreationInvoiceDataIssuer `json:"issuer"`
   831  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
   832  	Metadata map[string]string `json:"metadata"`
   833  	// Options for invoice PDF rendering.
   834  	RenderingOptions *PaymentLinkInvoiceCreationInvoiceDataRenderingOptions `json:"rendering_options"`
   835  }
   836  
   837  // Configuration for creating invoice for payment mode payment links.
   838  type PaymentLinkInvoiceCreation struct {
   839  	// Enable creating an invoice on successful payment.
   840  	Enabled bool `json:"enabled"`
   841  	// Configuration for the invoice. Default invoice values will be used if unspecified.
   842  	InvoiceData *PaymentLinkInvoiceCreationInvoiceData `json:"invoice_data"`
   843  }
   844  
   845  // Indicates the parameters to be passed to PaymentIntent creation during checkout.
   846  type PaymentLinkPaymentIntentData struct {
   847  	// Indicates when the funds will be captured from the customer's account.
   848  	CaptureMethod PaymentLinkPaymentIntentDataCaptureMethod `json:"capture_method"`
   849  	// An arbitrary string attached to the object. Often useful for displaying to users.
   850  	Description string `json:"description"`
   851  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on [Payment Intents](https://stripe.com/docs/api/payment_intents) generated from this payment link.
   852  	Metadata map[string]string `json:"metadata"`
   853  	// Indicates that you intend to make future payments with the payment method collected during checkout.
   854  	SetupFutureUsage PaymentLinkPaymentIntentDataSetupFutureUsage `json:"setup_future_usage"`
   855  	// Extra information about the payment. This will appear on your customer's statement when this payment succeeds in creating a charge.
   856  	StatementDescriptor string `json:"statement_descriptor"`
   857  	// Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
   858  	StatementDescriptorSuffix string `json:"statement_descriptor_suffix"`
   859  	// A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details.
   860  	TransferGroup string `json:"transfer_group"`
   861  }
   862  type PaymentLinkPhoneNumberCollection struct {
   863  	// If `true`, a phone number will be collected during checkout.
   864  	Enabled bool `json:"enabled"`
   865  }
   866  type PaymentLinkRestrictionsCompletedSessions struct {
   867  	// The current number of checkout sessions that have been completed on the payment link which count towards the `completed_sessions` restriction to be met.
   868  	Count int64 `json:"count"`
   869  	// The maximum number of checkout sessions that can be completed for the `completed_sessions` restriction to be met.
   870  	Limit int64 `json:"limit"`
   871  }
   872  
   873  // Settings that restrict the usage of a payment link.
   874  type PaymentLinkRestrictions struct {
   875  	CompletedSessions *PaymentLinkRestrictionsCompletedSessions `json:"completed_sessions"`
   876  }
   877  
   878  // Configuration for collecting the customer's shipping address.
   879  type PaymentLinkShippingAddressCollection struct {
   880  	// An array of two-letter ISO country codes representing which countries Checkout should provide as options for shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`.
   881  	AllowedCountries []string `json:"allowed_countries"`
   882  }
   883  
   884  // The shipping rate options applied to the session.
   885  type PaymentLinkShippingOption struct {
   886  	// A non-negative integer in cents representing how much to charge.
   887  	ShippingAmount int64 `json:"shipping_amount"`
   888  	// The ID of the Shipping Rate to use for this shipping option.
   889  	ShippingRate *ShippingRate `json:"shipping_rate"`
   890  }
   891  type PaymentLinkSubscriptionDataInvoiceSettingsIssuer struct {
   892  	// The connected account being referenced when `type` is `account`.
   893  	Account *Account `json:"account"`
   894  	// Type of the account referenced.
   895  	Type PaymentLinkSubscriptionDataInvoiceSettingsIssuerType `json:"type"`
   896  }
   897  type PaymentLinkSubscriptionDataInvoiceSettings struct {
   898  	Issuer *PaymentLinkSubscriptionDataInvoiceSettingsIssuer `json:"issuer"`
   899  }
   900  
   901  // Defines how a subscription behaves when a free trial ends.
   902  type PaymentLinkSubscriptionDataTrialSettingsEndBehavior struct {
   903  	// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
   904  	MissingPaymentMethod PaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod `json:"missing_payment_method"`
   905  }
   906  
   907  // Settings related to subscription trials.
   908  type PaymentLinkSubscriptionDataTrialSettings struct {
   909  	// Defines how a subscription behaves when a free trial ends.
   910  	EndBehavior *PaymentLinkSubscriptionDataTrialSettingsEndBehavior `json:"end_behavior"`
   911  }
   912  
   913  // When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`.
   914  type PaymentLinkSubscriptionData struct {
   915  	// The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
   916  	Description     string                                      `json:"description"`
   917  	InvoiceSettings *PaymentLinkSubscriptionDataInvoiceSettings `json:"invoice_settings"`
   918  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on [Subscriptions](https://stripe.com/docs/api/subscriptions) generated from this payment link.
   919  	Metadata map[string]string `json:"metadata"`
   920  	// Integer representing the number of trial period days before the customer is charged for the first time.
   921  	TrialPeriodDays int64 `json:"trial_period_days"`
   922  	// Settings related to subscription trials.
   923  	TrialSettings *PaymentLinkSubscriptionDataTrialSettings `json:"trial_settings"`
   924  }
   925  type PaymentLinkTaxIDCollection struct {
   926  	// Indicates whether tax ID collection is enabled for the session.
   927  	Enabled bool `json:"enabled"`
   928  }
   929  
   930  // The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
   931  type PaymentLinkTransferData struct {
   932  	// The amount in cents (or local equivalent) that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
   933  	Amount int64 `json:"amount"`
   934  	// The connected account receiving the transfer.
   935  	Destination *Account `json:"destination"`
   936  }
   937  
   938  // A payment link is a shareable URL that will take your customers to a hosted payment page. A payment link can be shared and used multiple times.
   939  //
   940  // When a customer opens a payment link it will open a new [checkout session](https://stripe.com/docs/api/checkout/sessions) to render the payment page. You can use [checkout session events](https://stripe.com/docs/api/events/types#event_types-checkout.session.completed) to track payments through payment links.
   941  //
   942  // Related guide: [Payment Links API](https://stripe.com/docs/payment-links)
   943  type PaymentLink struct {
   944  	APIResource
   945  	// Whether the payment link's `url` is active. If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated.
   946  	Active          bool                        `json:"active"`
   947  	AfterCompletion *PaymentLinkAfterCompletion `json:"after_completion"`
   948  	// Whether user redeemable promotion codes are enabled.
   949  	AllowPromotionCodes bool `json:"allow_promotion_codes"`
   950  	// The ID of the Connect application that created the Payment Link.
   951  	Application *Application `json:"application"`
   952  	// 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.
   953  	ApplicationFeeAmount int64 `json:"application_fee_amount"`
   954  	// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
   955  	ApplicationFeePercent float64                  `json:"application_fee_percent"`
   956  	AutomaticTax          *PaymentLinkAutomaticTax `json:"automatic_tax"`
   957  	// Configuration for collecting the customer's billing address. Defaults to `auto`.
   958  	BillingAddressCollection PaymentLinkBillingAddressCollection `json:"billing_address_collection"`
   959  	// When set, provides configuration to gather active consent from customers.
   960  	ConsentCollection *PaymentLinkConsentCollection `json:"consent_collection"`
   961  	// 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).
   962  	Currency Currency `json:"currency"`
   963  	// Configuration for Customer creation during checkout.
   964  	CustomerCreation PaymentLinkCustomerCreation `json:"customer_creation"`
   965  	// Collect additional information from your customer using custom fields. Up to 3 fields are supported.
   966  	CustomFields []*PaymentLinkCustomField `json:"custom_fields"`
   967  	CustomText   *PaymentLinkCustomText    `json:"custom_text"`
   968  	// Unique identifier for the object.
   969  	ID string `json:"id"`
   970  	// The custom message to be displayed to a customer when a payment link is no longer active.
   971  	InactiveMessage string `json:"inactive_message"`
   972  	// Configuration for creating invoice for payment mode payment links.
   973  	InvoiceCreation *PaymentLinkInvoiceCreation `json:"invoice_creation"`
   974  	// The line items representing what is being sold.
   975  	LineItems *LineItemList `json:"line_items"`
   976  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   977  	Livemode bool `json:"livemode"`
   978  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
   979  	Metadata map[string]string `json:"metadata"`
   980  	// String representing the object's type. Objects of the same type share the same value.
   981  	Object string `json:"object"`
   982  	// The account on behalf of which to charge. See the [Connect documentation](https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details.
   983  	OnBehalfOf *Account `json:"on_behalf_of"`
   984  	// Indicates the parameters to be passed to PaymentIntent creation during checkout.
   985  	PaymentIntentData *PaymentLinkPaymentIntentData `json:"payment_intent_data"`
   986  	// Configuration for collecting a payment method during checkout. Defaults to `always`.
   987  	PaymentMethodCollection PaymentLinkPaymentMethodCollection `json:"payment_method_collection"`
   988  	// The list of payment method types that customers can use. When `null`, Stripe will dynamically show relevant payment methods you've enabled in your [payment method settings](https://dashboard.stripe.com/settings/payment_methods).
   989  	PaymentMethodTypes    []PaymentLinkPaymentMethodType    `json:"payment_method_types"`
   990  	PhoneNumberCollection *PaymentLinkPhoneNumberCollection `json:"phone_number_collection"`
   991  	// Settings that restrict the usage of a payment link.
   992  	Restrictions *PaymentLinkRestrictions `json:"restrictions"`
   993  	// Configuration for collecting the customer's shipping address.
   994  	ShippingAddressCollection *PaymentLinkShippingAddressCollection `json:"shipping_address_collection"`
   995  	// The shipping rate options applied to the session.
   996  	ShippingOptions []*PaymentLinkShippingOption `json:"shipping_options"`
   997  	// Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
   998  	SubmitType PaymentLinkSubmitType `json:"submit_type"`
   999  	// When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`.
  1000  	SubscriptionData *PaymentLinkSubscriptionData `json:"subscription_data"`
  1001  	TaxIDCollection  *PaymentLinkTaxIDCollection  `json:"tax_id_collection"`
  1002  	// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
  1003  	TransferData *PaymentLinkTransferData `json:"transfer_data"`
  1004  	// The public URL that can be shared with customers.
  1005  	URL string `json:"url"`
  1006  }
  1007  
  1008  // PaymentLinkList is a list of PaymentLinks as retrieved from a list endpoint.
  1009  type PaymentLinkList struct {
  1010  	APIResource
  1011  	ListMeta
  1012  	Data []*PaymentLink `json:"data"`
  1013  }
  1014  
  1015  // UnmarshalJSON handles deserialization of a PaymentLink.
  1016  // This custom unmarshaling is needed because the resulting
  1017  // property may be an id or the full struct if it was expanded.
  1018  func (p *PaymentLink) UnmarshalJSON(data []byte) error {
  1019  	if id, ok := ParseID(data); ok {
  1020  		p.ID = id
  1021  		return nil
  1022  	}
  1023  
  1024  	type paymentLink PaymentLink
  1025  	var v paymentLink
  1026  	if err := json.Unmarshal(data, &v); err != nil {
  1027  		return err
  1028  	}
  1029  
  1030  	*p = PaymentLink(v)
  1031  	return nil
  1032  }