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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // The rails used to send funds.
    10  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccountNetwork string
    11  
    12  // List of values that TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccountNetwork can take
    13  const (
    14  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccountNetworkStripe TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccountNetwork = "stripe"
    15  )
    16  
    17  // The type of the payment method used in the OutboundPayment.
    18  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsType string
    19  
    20  // List of values that TreasuryOutboundPaymentDestinationPaymentMethodDetailsType can take
    21  const (
    22  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsTypeFinancialAccount TreasuryOutboundPaymentDestinationPaymentMethodDetailsType = "financial_account"
    23  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsTypeUSBankAccount    TreasuryOutboundPaymentDestinationPaymentMethodDetailsType = "us_bank_account"
    24  )
    25  
    26  // Account holder type: individual or company.
    27  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderType string
    28  
    29  // List of values that TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderType can take
    30  const (
    31  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderTypeCompany    TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderType = "company"
    32  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderTypeIndividual TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderType = "individual"
    33  )
    34  
    35  // Account type: checkings or savings. Defaults to checking if omitted.
    36  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountType string
    37  
    38  // List of values that TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountType can take
    39  const (
    40  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountTypeChecking TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountType = "checking"
    41  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountTypeSavings  TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountType = "savings"
    42  )
    43  
    44  // The network rails used. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type.
    45  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetwork string
    46  
    47  // List of values that TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetwork can take
    48  const (
    49  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetworkACH            TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetwork = "ach"
    50  	TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetworkUSDomesticWire TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetwork = "us_domestic_wire"
    51  )
    52  
    53  // Reason for the return.
    54  type TreasuryOutboundPaymentReturnedDetailsCode string
    55  
    56  // List of values that TreasuryOutboundPaymentReturnedDetailsCode can take
    57  const (
    58  	TreasuryOutboundPaymentReturnedDetailsCodeAccountClosed              TreasuryOutboundPaymentReturnedDetailsCode = "account_closed"
    59  	TreasuryOutboundPaymentReturnedDetailsCodeAccountFrozen              TreasuryOutboundPaymentReturnedDetailsCode = "account_frozen"
    60  	TreasuryOutboundPaymentReturnedDetailsCodeBankAccountRestricted      TreasuryOutboundPaymentReturnedDetailsCode = "bank_account_restricted"
    61  	TreasuryOutboundPaymentReturnedDetailsCodeBankOwnershipChanged       TreasuryOutboundPaymentReturnedDetailsCode = "bank_ownership_changed"
    62  	TreasuryOutboundPaymentReturnedDetailsCodeDeclined                   TreasuryOutboundPaymentReturnedDetailsCode = "declined"
    63  	TreasuryOutboundPaymentReturnedDetailsCodeIncorrectAccountHolderName TreasuryOutboundPaymentReturnedDetailsCode = "incorrect_account_holder_name"
    64  	TreasuryOutboundPaymentReturnedDetailsCodeInvalidAccountNumber       TreasuryOutboundPaymentReturnedDetailsCode = "invalid_account_number"
    65  	TreasuryOutboundPaymentReturnedDetailsCodeInvalidCurrency            TreasuryOutboundPaymentReturnedDetailsCode = "invalid_currency"
    66  	TreasuryOutboundPaymentReturnedDetailsCodeNoAccount                  TreasuryOutboundPaymentReturnedDetailsCode = "no_account"
    67  	TreasuryOutboundPaymentReturnedDetailsCodeOther                      TreasuryOutboundPaymentReturnedDetailsCode = "other"
    68  )
    69  
    70  // Current status of the OutboundPayment: `processing`, `failed`, `posted`, `returned`, `canceled`. An OutboundPayment is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundPayment has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundPayment fails to arrive at its destination, its status will change to `returned`.
    71  type TreasuryOutboundPaymentStatus string
    72  
    73  // List of values that TreasuryOutboundPaymentStatus can take
    74  const (
    75  	TreasuryOutboundPaymentStatusCanceled   TreasuryOutboundPaymentStatus = "canceled"
    76  	TreasuryOutboundPaymentStatusFailed     TreasuryOutboundPaymentStatus = "failed"
    77  	TreasuryOutboundPaymentStatusPosted     TreasuryOutboundPaymentStatus = "posted"
    78  	TreasuryOutboundPaymentStatusProcessing TreasuryOutboundPaymentStatus = "processing"
    79  	TreasuryOutboundPaymentStatusReturned   TreasuryOutboundPaymentStatus = "returned"
    80  )
    81  
    82  // Returns a list of OutboundPayments sent from the specified FinancialAccount.
    83  type TreasuryOutboundPaymentListParams struct {
    84  	ListParams `form:"*"`
    85  	// Only return OutboundPayments that were created during the given date interval.
    86  	Created *int64 `form:"created"`
    87  	// Only return OutboundPayments that were created during the given date interval.
    88  	CreatedRange *RangeQueryParams `form:"created"`
    89  	// Only return OutboundPayments sent to this customer.
    90  	Customer *string `form:"customer"`
    91  	// Specifies which fields in the response should be expanded.
    92  	Expand []*string `form:"expand"`
    93  	// Returns objects associated with this FinancialAccount.
    94  	FinancialAccount *string `form:"financial_account"`
    95  	// Only return OutboundPayments that have the given status: `processing`, `failed`, `posted`, `returned`, or `canceled`.
    96  	Status *string `form:"status"`
    97  }
    98  
    99  // AddExpand appends a new field to expand.
   100  func (p *TreasuryOutboundPaymentListParams) AddExpand(f string) {
   101  	p.Expand = append(p.Expand, &f)
   102  }
   103  
   104  // Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
   105  type TreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetailsParams struct {
   106  	// Billing address.
   107  	Address *AddressParams `form:"address"`
   108  	// Email address.
   109  	Email *string `form:"email"`
   110  	// Full name.
   111  	Name *string `form:"name"`
   112  	// Billing phone number (including extension).
   113  	Phone *string `form:"phone"`
   114  }
   115  
   116  // Required hash if type is set to `us_bank_account`.
   117  type TreasuryOutboundPaymentDestinationPaymentMethodDataUSBankAccountParams struct {
   118  	// Account holder type: individual or company.
   119  	AccountHolderType *string `form:"account_holder_type"`
   120  	// Account number of the bank account.
   121  	AccountNumber *string `form:"account_number"`
   122  	// Account type: checkings or savings. Defaults to checking if omitted.
   123  	AccountType *string `form:"account_type"`
   124  	// The ID of a Financial Connections Account to use as a payment method.
   125  	FinancialConnectionsAccount *string `form:"financial_connections_account"`
   126  	// Routing number of the bank account.
   127  	RoutingNumber *string `form:"routing_number"`
   128  }
   129  
   130  // Hash used to generate the PaymentMethod to be used for this OutboundPayment. Exclusive with `destination_payment_method`.
   131  type TreasuryOutboundPaymentDestinationPaymentMethodDataParams struct {
   132  	// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
   133  	BillingDetails *TreasuryOutboundPaymentDestinationPaymentMethodDataBillingDetailsParams `form:"billing_details"`
   134  	// Required if type is set to `financial_account`. The FinancialAccount ID to send funds to.
   135  	FinancialAccount *string `form:"financial_account"`
   136  	// 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`.
   137  	Metadata map[string]string `form:"metadata"`
   138  	// The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
   139  	Type *string `form:"type"`
   140  	// Required hash if type is set to `us_bank_account`.
   141  	USBankAccount *TreasuryOutboundPaymentDestinationPaymentMethodDataUSBankAccountParams `form:"us_bank_account"`
   142  }
   143  
   144  // AddMetadata adds a new key-value pair to the Metadata.
   145  func (p *TreasuryOutboundPaymentDestinationPaymentMethodDataParams) AddMetadata(key string, value string) {
   146  	if p.Metadata == nil {
   147  		p.Metadata = make(map[string]string)
   148  	}
   149  
   150  	p.Metadata[key] = value
   151  }
   152  
   153  // Optional fields for `us_bank_account`.
   154  type TreasuryOutboundPaymentDestinationPaymentMethodOptionsUSBankAccountParams struct {
   155  	// Specifies the network rails to be used. If not set, will default to the PaymentMethod's preferred network. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type.
   156  	Network *string `form:"network"`
   157  }
   158  
   159  // Payment method-specific configuration for this OutboundPayment.
   160  type TreasuryOutboundPaymentDestinationPaymentMethodOptionsParams struct {
   161  	// Optional fields for `us_bank_account`.
   162  	USBankAccount *TreasuryOutboundPaymentDestinationPaymentMethodOptionsUSBankAccountParams `form:"us_bank_account"`
   163  }
   164  
   165  // End user details.
   166  type TreasuryOutboundPaymentEndUserDetailsParams struct {
   167  	// IP address of the user initiating the OutboundPayment. Must be supplied if `present` is set to `true`.
   168  	IPAddress *string `form:"ip_address"`
   169  	// `True` if the OutboundPayment creation request is being made on behalf of an end user by a platform. Otherwise, `false`.
   170  	Present *bool `form:"present"`
   171  }
   172  
   173  // Creates an OutboundPayment.
   174  type TreasuryOutboundPaymentParams struct {
   175  	Params `form:"*"`
   176  	// Amount (in cents) to be transferred.
   177  	Amount *int64 `form:"amount"`
   178  	// 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).
   179  	Currency *string `form:"currency"`
   180  	// ID of the customer to whom the OutboundPayment is sent. Must match the Customer attached to the `destination_payment_method` passed in.
   181  	Customer *string `form:"customer"`
   182  	// An arbitrary string attached to the object. Often useful for displaying to users.
   183  	Description *string `form:"description"`
   184  	// The PaymentMethod to use as the payment instrument for the OutboundPayment. Exclusive with `destination_payment_method_data`.
   185  	DestinationPaymentMethod *string `form:"destination_payment_method"`
   186  	// Hash used to generate the PaymentMethod to be used for this OutboundPayment. Exclusive with `destination_payment_method`.
   187  	DestinationPaymentMethodData *TreasuryOutboundPaymentDestinationPaymentMethodDataParams `form:"destination_payment_method_data"`
   188  	// Payment method-specific configuration for this OutboundPayment.
   189  	DestinationPaymentMethodOptions *TreasuryOutboundPaymentDestinationPaymentMethodOptionsParams `form:"destination_payment_method_options"`
   190  	// End user details.
   191  	EndUserDetails *TreasuryOutboundPaymentEndUserDetailsParams `form:"end_user_details"`
   192  	// Specifies which fields in the response should be expanded.
   193  	Expand []*string `form:"expand"`
   194  	// The FinancialAccount to pull funds from.
   195  	FinancialAccount *string `form:"financial_account"`
   196  	// 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`.
   197  	Metadata map[string]string `form:"metadata"`
   198  	// The description that appears on the receiving end for this OutboundPayment (for example, bank statement for external bank transfer). Maximum 10 characters for `ach` payments, 140 characters for `us_domestic_wire` payments, or 500 characters for `stripe` network transfers. The default value is "payment".
   199  	StatementDescriptor *string `form:"statement_descriptor"`
   200  }
   201  
   202  // AddExpand appends a new field to expand.
   203  func (p *TreasuryOutboundPaymentParams) AddExpand(f string) {
   204  	p.Expand = append(p.Expand, &f)
   205  }
   206  
   207  // AddMetadata adds a new key-value pair to the Metadata.
   208  func (p *TreasuryOutboundPaymentParams) AddMetadata(key string, value string) {
   209  	if p.Metadata == nil {
   210  		p.Metadata = make(map[string]string)
   211  	}
   212  
   213  	p.Metadata[key] = value
   214  }
   215  
   216  // Cancel an OutboundPayment.
   217  type TreasuryOutboundPaymentCancelParams struct {
   218  	Params `form:"*"`
   219  	// Specifies which fields in the response should be expanded.
   220  	Expand []*string `form:"expand"`
   221  }
   222  
   223  // AddExpand appends a new field to expand.
   224  func (p *TreasuryOutboundPaymentCancelParams) AddExpand(f string) {
   225  	p.Expand = append(p.Expand, &f)
   226  }
   227  
   228  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsBillingDetails struct {
   229  	Address *Address `json:"address"`
   230  	// Email address.
   231  	Email string `json:"email"`
   232  	// Full name.
   233  	Name string `json:"name"`
   234  }
   235  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccount struct {
   236  	// Token of the FinancialAccount.
   237  	ID string `json:"id"`
   238  	// The rails used to send funds.
   239  	Network TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccountNetwork `json:"network"`
   240  }
   241  type TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccount struct {
   242  	// Account holder type: individual or company.
   243  	AccountHolderType TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountHolderType `json:"account_holder_type"`
   244  	// Account type: checkings or savings. Defaults to checking if omitted.
   245  	AccountType TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountAccountType `json:"account_type"`
   246  	// Name of the bank associated with the bank account.
   247  	BankName string `json:"bank_name"`
   248  	// Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
   249  	Fingerprint string `json:"fingerprint"`
   250  	// Last four digits of the bank account number.
   251  	Last4 string `json:"last4"`
   252  	// ID of the mandate used to make this payment.
   253  	Mandate *Mandate `json:"mandate"`
   254  	// The network rails used. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type.
   255  	Network TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccountNetwork `json:"network"`
   256  	// Routing number of the bank account.
   257  	RoutingNumber string `json:"routing_number"`
   258  }
   259  
   260  // Details about the PaymentMethod for an OutboundPayment.
   261  type TreasuryOutboundPaymentDestinationPaymentMethodDetails struct {
   262  	BillingDetails   *TreasuryOutboundPaymentDestinationPaymentMethodDetailsBillingDetails   `json:"billing_details"`
   263  	FinancialAccount *TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccount `json:"financial_account"`
   264  	// The type of the payment method used in the OutboundPayment.
   265  	Type          TreasuryOutboundPaymentDestinationPaymentMethodDetailsType           `json:"type"`
   266  	USBankAccount *TreasuryOutboundPaymentDestinationPaymentMethodDetailsUSBankAccount `json:"us_bank_account"`
   267  }
   268  
   269  // Details about the end user.
   270  type TreasuryOutboundPaymentEndUserDetails struct {
   271  	// IP address of the user initiating the OutboundPayment. Set if `present` is set to `true`. IP address collection is required for risk and compliance reasons. This will be used to help determine if the OutboundPayment is authorized or should be blocked.
   272  	IPAddress string `json:"ip_address"`
   273  	// `true` if the OutboundPayment creation request is being made on behalf of an end user by a platform. Otherwise, `false`.
   274  	Present bool `json:"present"`
   275  }
   276  
   277  // Details about a returned OutboundPayment. Only set when the status is `returned`.
   278  type TreasuryOutboundPaymentReturnedDetails struct {
   279  	// Reason for the return.
   280  	Code TreasuryOutboundPaymentReturnedDetailsCode `json:"code"`
   281  	// The Transaction associated with this object.
   282  	Transaction *TreasuryTransaction `json:"transaction"`
   283  }
   284  type TreasuryOutboundPaymentStatusTransitions struct {
   285  	// Timestamp describing when an OutboundPayment changed status to `canceled`.
   286  	CanceledAt int64 `json:"canceled_at"`
   287  	// Timestamp describing when an OutboundPayment changed status to `failed`.
   288  	FailedAt int64 `json:"failed_at"`
   289  	// Timestamp describing when an OutboundPayment changed status to `posted`.
   290  	PostedAt int64 `json:"posted_at"`
   291  	// Timestamp describing when an OutboundPayment changed status to `returned`.
   292  	ReturnedAt int64 `json:"returned_at"`
   293  }
   294  
   295  // Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
   296  //
   297  // Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
   298  type TreasuryOutboundPayment struct {
   299  	APIResource
   300  	// Amount (in cents) transferred.
   301  	Amount int64 `json:"amount"`
   302  	// Returns `true` if the object can be canceled, and `false` otherwise.
   303  	Cancelable bool `json:"cancelable"`
   304  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   305  	Created int64 `json:"created"`
   306  	// 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).
   307  	Currency Currency `json:"currency"`
   308  	// ID of the [customer](https://stripe.com/docs/api/customers) to whom an OutboundPayment is sent.
   309  	Customer string `json:"customer"`
   310  	// An arbitrary string attached to the object. Often useful for displaying to users.
   311  	Description string `json:"description"`
   312  	// The PaymentMethod via which an OutboundPayment is sent. This field can be empty if the OutboundPayment was created using `destination_payment_method_data`.
   313  	DestinationPaymentMethod string `json:"destination_payment_method"`
   314  	// Details about the PaymentMethod for an OutboundPayment.
   315  	DestinationPaymentMethodDetails *TreasuryOutboundPaymentDestinationPaymentMethodDetails `json:"destination_payment_method_details"`
   316  	// Details about the end user.
   317  	EndUserDetails *TreasuryOutboundPaymentEndUserDetails `json:"end_user_details"`
   318  	// The date when funds are expected to arrive in the destination account.
   319  	ExpectedArrivalDate int64 `json:"expected_arrival_date"`
   320  	// The FinancialAccount that funds were pulled from.
   321  	FinancialAccount string `json:"financial_account"`
   322  	// A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
   323  	HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"`
   324  	// Unique identifier for the object.
   325  	ID string `json:"id"`
   326  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   327  	Livemode bool `json:"livemode"`
   328  	// 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.
   329  	Metadata map[string]string `json:"metadata"`
   330  	// String representing the object's type. Objects of the same type share the same value.
   331  	Object string `json:"object"`
   332  	// Details about a returned OutboundPayment. Only set when the status is `returned`.
   333  	ReturnedDetails *TreasuryOutboundPaymentReturnedDetails `json:"returned_details"`
   334  	// The description that appears on the receiving end for an OutboundPayment (for example, bank statement for external bank transfer).
   335  	StatementDescriptor string `json:"statement_descriptor"`
   336  	// Current status of the OutboundPayment: `processing`, `failed`, `posted`, `returned`, `canceled`. An OutboundPayment is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundPayment has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundPayment fails to arrive at its destination, its status will change to `returned`.
   337  	Status            TreasuryOutboundPaymentStatus             `json:"status"`
   338  	StatusTransitions *TreasuryOutboundPaymentStatusTransitions `json:"status_transitions"`
   339  	// The Transaction associated with this object.
   340  	Transaction *TreasuryTransaction `json:"transaction"`
   341  }
   342  
   343  // TreasuryOutboundPaymentList is a list of OutboundPayments as retrieved from a list endpoint.
   344  type TreasuryOutboundPaymentList struct {
   345  	APIResource
   346  	ListMeta
   347  	Data []*TreasuryOutboundPayment `json:"data"`
   348  }