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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // If the capability is disabled, this string describes why. Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`.
    10  //
    11  // `rejected.unsupported_business` means that the account's business is not supported by the capability. For example, payment methods may restrict the businesses they support in their terms of service:
    12  //
    13  // - [Afterpay Clearpay's terms of service](https://stripe.com/afterpay-clearpay/legal#restricted-businesses)
    14  //
    15  // If you believe that the rejection is in error, please contact support at https://support.stripe.com/contact/ for assistance.
    16  type CapabilityDisabledReason string
    17  
    18  // List of values that CapabilityDisabledReason can take
    19  const (
    20  	CapabilityDisabledReasonPendingOnboarding        CapabilityDisabledReason = "pending.onboarding"
    21  	CapabilityDisabledReasonPendingReview            CapabilityDisabledReason = "pending.review"
    22  	CapabilityDisabledReasonRejectedFraud            CapabilityDisabledReason = "rejected_fraud"
    23  	CapabilityDisabledReasonRejectedListed           CapabilityDisabledReason = "rejected.listed"
    24  	CapabilityDisabledReasonRejectedOther            CapabilityDisabledReason = "rejected.other"
    25  	CapabilityDisabledReasonRequirementsFieldsNeeded CapabilityDisabledReason = "requirement.fields_needed"
    26  )
    27  
    28  // The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`.
    29  type CapabilityStatus string
    30  
    31  // List of values that CapabilityStatus can take
    32  const (
    33  	CapabilityStatusActive      CapabilityStatus = "active"
    34  	CapabilityStatusDisabled    CapabilityStatus = "disabled"
    35  	CapabilityStatusInactive    CapabilityStatus = "inactive"
    36  	CapabilityStatusPending     CapabilityStatus = "pending"
    37  	CapabilityStatusUnrequested CapabilityStatus = "unrequested"
    38  )
    39  
    40  // Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first.
    41  type CapabilityListParams struct {
    42  	ListParams `form:"*"`
    43  	Account    *string `form:"-"` // Included in URL
    44  	// Specifies which fields in the response should be expanded.
    45  	Expand []*string `form:"expand"`
    46  }
    47  
    48  // AddExpand appends a new field to expand.
    49  func (p *CapabilityListParams) AddExpand(f string) {
    50  	p.Expand = append(p.Expand, &f)
    51  }
    52  
    53  // Retrieves information about the specified Account Capability.
    54  type CapabilityParams struct {
    55  	Params  `form:"*"`
    56  	Account *string `form:"-"` // Included in URL
    57  	// Specifies which fields in the response should be expanded.
    58  	Expand []*string `form:"expand"`
    59  	// 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.
    60  	//
    61  	// 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.
    62  	Requested *bool `form:"requested"`
    63  }
    64  
    65  // AddExpand appends a new field to expand.
    66  func (p *CapabilityParams) AddExpand(f string) {
    67  	p.Expand = append(p.Expand, &f)
    68  }
    69  
    70  // Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
    71  type CapabilityFutureRequirementsAlternative struct {
    72  	// Fields that can be provided to satisfy all fields in `original_fields_due`.
    73  	AlternativeFieldsDue []string `json:"alternative_fields_due"`
    74  	// Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`.
    75  	OriginalFieldsDue []string `json:"original_fields_due"`
    76  }
    77  
    78  // Fields that are `currently_due` and need to be collected again because validation or verification failed.
    79  type CapabilityFutureRequirementsError struct {
    80  	// The code for the type of error.
    81  	Code string `json:"code"`
    82  	// An informative message that indicates the error type and provides additional details about the error.
    83  	Reason string `json:"reason"`
    84  	// The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
    85  	Requirement string `json:"requirement"`
    86  }
    87  type CapabilityFutureRequirements struct {
    88  	// Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
    89  	Alternatives []*CapabilityFutureRequirementsAlternative `json:"alternatives"`
    90  	// Date on which `future_requirements` merges with the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning.
    91  	CurrentDeadline int64 `json:"current_deadline"`
    92  	// Fields that need to be collected to keep the capability enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash.
    93  	CurrentlyDue []string `json:"currently_due"`
    94  	// This is typed as a string for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is empty because fields in `future_requirements` will never disable the account.
    95  	DisabledReason string `json:"disabled_reason"`
    96  	// Fields that are `currently_due` and need to be collected again because validation or verification failed.
    97  	Errors []*CapabilityFutureRequirementsError `json:"errors"`
    98  	// Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well.
    99  	EventuallyDue []string `json:"eventually_due"`
   100  	// Fields that weren't collected by `requirements.current_deadline`. These fields need to be collected to enable the capability on the account. New fields will never appear here; `future_requirements.past_due` will always be a subset of `requirements.past_due`.
   101  	PastDue []string `json:"past_due"`
   102  	// Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due` or `currently_due`.
   103  	PendingVerification []string `json:"pending_verification"`
   104  }
   105  
   106  // Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
   107  type CapabilityRequirementsAlternative struct {
   108  	// Fields that can be provided to satisfy all fields in `original_fields_due`.
   109  	AlternativeFieldsDue []string `json:"alternative_fields_due"`
   110  	// Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`.
   111  	OriginalFieldsDue []string `json:"original_fields_due"`
   112  }
   113  type CapabilityRequirements struct {
   114  	// Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
   115  	Alternatives []*CapabilityRequirementsAlternative `json:"alternatives"`
   116  	// Date by which the fields in `currently_due` must be collected to keep the capability enabled for the account. These fields may disable the capability sooner if the next threshold is reached before they are collected.
   117  	CurrentDeadline int64 `json:"current_deadline"`
   118  	// Fields that need to be collected to keep the capability enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
   119  	CurrentlyDue []string `json:"currently_due"`
   120  	// If the capability is disabled, this string describes why. Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`.
   121  	//
   122  	// `rejected.unsupported_business` means that the account's business is not supported by the capability. For example, payment methods may restrict the businesses they support in their terms of service:
   123  	//
   124  	// - [Afterpay Clearpay's terms of service](https://stripe.com/afterpay-clearpay/legal#restricted-businesses)
   125  	//
   126  	// If you believe that the rejection is in error, please contact support at https://support.stripe.com/contact/ for assistance.
   127  	DisabledReason CapabilityDisabledReason `json:"disabled_reason"`
   128  	// Fields that are `currently_due` and need to be collected again because validation or verification failed.
   129  	Errors []*AccountRequirementsError `json:"errors"`
   130  	// Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set.
   131  	EventuallyDue []string `json:"eventually_due"`
   132  	// Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the capability on the account.
   133  	PastDue []string `json:"past_due"`
   134  	// Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`.
   135  	PendingVerification []string `json:"pending_verification"`
   136  }
   137  
   138  // This is an object representing a capability for a Stripe account.
   139  //
   140  // Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities)
   141  type Capability struct {
   142  	APIResource
   143  	// The account for which the capability enables functionality.
   144  	Account            *Account                      `json:"account"`
   145  	FutureRequirements *CapabilityFutureRequirements `json:"future_requirements"`
   146  	// The identifier for the capability.
   147  	ID string `json:"id"`
   148  	// String representing the object's type. Objects of the same type share the same value.
   149  	Object string `json:"object"`
   150  	// Whether the capability has been requested.
   151  	Requested bool `json:"requested"`
   152  	// Time at which the capability was requested. Measured in seconds since the Unix epoch.
   153  	RequestedAt  int64                   `json:"requested_at"`
   154  	Requirements *CapabilityRequirements `json:"requirements"`
   155  	// The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`.
   156  	Status CapabilityStatus `json:"status"`
   157  }
   158  
   159  // CapabilityList is a list of Capabilities as retrieved from a list endpoint.
   160  type CapabilityList struct {
   161  	APIResource
   162  	ListMeta
   163  	Data []*Capability `json:"data"`
   164  }