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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen.
    10  type TreasuryReceivedCreditFailureCode string
    11  
    12  // List of values that TreasuryReceivedCreditFailureCode can take
    13  const (
    14  	TreasuryReceivedCreditFailureCodeAccountClosed TreasuryReceivedCreditFailureCode = "account_closed"
    15  	TreasuryReceivedCreditFailureCodeAccountFrozen TreasuryReceivedCreditFailureCode = "account_frozen"
    16  	TreasuryReceivedCreditFailureCodeOther         TreasuryReceivedCreditFailureCode = "other"
    17  )
    18  
    19  // Set when `type` is `balance`.
    20  type TreasuryReceivedCreditInitiatingPaymentMethodDetailsBalance string
    21  
    22  // List of values that TreasuryReceivedCreditInitiatingPaymentMethodDetailsBalance can take
    23  const (
    24  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsBalancePayments TreasuryReceivedCreditInitiatingPaymentMethodDetailsBalance = "payments"
    25  )
    26  
    27  // The rails the ReceivedCredit was sent over. A FinancialAccount can only send funds over `stripe`.
    28  type TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccountNetwork string
    29  
    30  // List of values that TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccountNetwork can take
    31  const (
    32  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccountNetworkStripe TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccountNetwork = "stripe"
    33  )
    34  
    35  // Polymorphic type matching the originating money movement's source. This can be an external account, a Stripe balance, or a FinancialAccount.
    36  type TreasuryReceivedCreditInitiatingPaymentMethodDetailsType string
    37  
    38  // List of values that TreasuryReceivedCreditInitiatingPaymentMethodDetailsType can take
    39  const (
    40  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsTypeBalance          TreasuryReceivedCreditInitiatingPaymentMethodDetailsType = "balance"
    41  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsTypeFinancialAccount TreasuryReceivedCreditInitiatingPaymentMethodDetailsType = "financial_account"
    42  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsTypeIssuingCard      TreasuryReceivedCreditInitiatingPaymentMethodDetailsType = "issuing_card"
    43  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsTypeStripe           TreasuryReceivedCreditInitiatingPaymentMethodDetailsType = "stripe"
    44  	TreasuryReceivedCreditInitiatingPaymentMethodDetailsTypeUSBankAccount    TreasuryReceivedCreditInitiatingPaymentMethodDetailsType = "us_bank_account"
    45  )
    46  
    47  // The type of the source flow that originated the ReceivedCredit.
    48  type TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType string
    49  
    50  // List of values that TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType can take
    51  const (
    52  	TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeCreditReversal  TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "credit_reversal"
    53  	TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOther           TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "other"
    54  	TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOutboundPayment TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "outbound_payment"
    55  	TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypePayout          TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "payout"
    56  )
    57  
    58  // The rails used to send the funds.
    59  type TreasuryReceivedCreditNetwork string
    60  
    61  // List of values that TreasuryReceivedCreditNetwork can take
    62  const (
    63  	TreasuryReceivedCreditNetworkACH            TreasuryReceivedCreditNetwork = "ach"
    64  	TreasuryReceivedCreditNetworkCard           TreasuryReceivedCreditNetwork = "card"
    65  	TreasuryReceivedCreditNetworkStripe         TreasuryReceivedCreditNetwork = "stripe"
    66  	TreasuryReceivedCreditNetworkUSDomesticWire TreasuryReceivedCreditNetwork = "us_domestic_wire"
    67  )
    68  
    69  // Set if a ReceivedCredit cannot be reversed.
    70  type TreasuryReceivedCreditReversalDetailsRestrictedReason string
    71  
    72  // List of values that TreasuryReceivedCreditReversalDetailsRestrictedReason can take
    73  const (
    74  	TreasuryReceivedCreditReversalDetailsRestrictedReasonAlreadyReversed      TreasuryReceivedCreditReversalDetailsRestrictedReason = "already_reversed"
    75  	TreasuryReceivedCreditReversalDetailsRestrictedReasonDeadlinePassed       TreasuryReceivedCreditReversalDetailsRestrictedReason = "deadline_passed"
    76  	TreasuryReceivedCreditReversalDetailsRestrictedReasonNetworkRestricted    TreasuryReceivedCreditReversalDetailsRestrictedReason = "network_restricted"
    77  	TreasuryReceivedCreditReversalDetailsRestrictedReasonOther                TreasuryReceivedCreditReversalDetailsRestrictedReason = "other"
    78  	TreasuryReceivedCreditReversalDetailsRestrictedReasonSourceFlowRestricted TreasuryReceivedCreditReversalDetailsRestrictedReason = "source_flow_restricted"
    79  )
    80  
    81  // Status of the ReceivedCredit. ReceivedCredits are created either `succeeded` (approved) or `failed` (declined). If a ReceivedCredit is declined, the failure reason can be found in the `failure_code` field.
    82  type TreasuryReceivedCreditStatus string
    83  
    84  // List of values that TreasuryReceivedCreditStatus can take
    85  const (
    86  	TreasuryReceivedCreditStatusFailed    TreasuryReceivedCreditStatus = "failed"
    87  	TreasuryReceivedCreditStatusSucceeded TreasuryReceivedCreditStatus = "succeeded"
    88  )
    89  
    90  // Only return ReceivedCredits described by the flow.
    91  type TreasuryReceivedCreditListLinkedFlowsParams struct {
    92  	// The source flow type.
    93  	SourceFlowType *string `form:"source_flow_type"`
    94  }
    95  
    96  // Returns a list of ReceivedCredits.
    97  type TreasuryReceivedCreditListParams struct {
    98  	ListParams `form:"*"`
    99  	// Specifies which fields in the response should be expanded.
   100  	Expand []*string `form:"expand"`
   101  	// The FinancialAccount that received the funds.
   102  	FinancialAccount *string `form:"financial_account"`
   103  	// Only return ReceivedCredits described by the flow.
   104  	LinkedFlows *TreasuryReceivedCreditListLinkedFlowsParams `form:"linked_flows"`
   105  	// Only return ReceivedCredits that have the given status: `succeeded` or `failed`.
   106  	Status *string `form:"status"`
   107  }
   108  
   109  // AddExpand appends a new field to expand.
   110  func (p *TreasuryReceivedCreditListParams) AddExpand(f string) {
   111  	p.Expand = append(p.Expand, &f)
   112  }
   113  
   114  // Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
   115  type TreasuryReceivedCreditParams struct {
   116  	Params `form:"*"`
   117  	// Specifies which fields in the response should be expanded.
   118  	Expand []*string `form:"expand"`
   119  }
   120  
   121  // AddExpand appends a new field to expand.
   122  func (p *TreasuryReceivedCreditParams) AddExpand(f string) {
   123  	p.Expand = append(p.Expand, &f)
   124  }
   125  
   126  type TreasuryReceivedCreditInitiatingPaymentMethodDetailsBillingDetails struct {
   127  	Address *Address `json:"address"`
   128  	// Email address.
   129  	Email string `json:"email"`
   130  	// Full name.
   131  	Name string `json:"name"`
   132  }
   133  type TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccount struct {
   134  	// The FinancialAccount ID.
   135  	ID string `json:"id"`
   136  	// The rails the ReceivedCredit was sent over. A FinancialAccount can only send funds over `stripe`.
   137  	Network TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccountNetwork `json:"network"`
   138  }
   139  type TreasuryReceivedCreditInitiatingPaymentMethodDetailsUSBankAccount struct {
   140  	// Bank name.
   141  	BankName string `json:"bank_name"`
   142  	// The last four digits of the bank account number.
   143  	Last4 string `json:"last4"`
   144  	// The routing number for the bank account.
   145  	RoutingNumber string `json:"routing_number"`
   146  }
   147  type TreasuryReceivedCreditInitiatingPaymentMethodDetails struct {
   148  	// Set when `type` is `balance`.
   149  	Balance          TreasuryReceivedCreditInitiatingPaymentMethodDetailsBalance           `json:"balance"`
   150  	BillingDetails   *TreasuryReceivedCreditInitiatingPaymentMethodDetailsBillingDetails   `json:"billing_details"`
   151  	FinancialAccount *TreasuryReceivedCreditInitiatingPaymentMethodDetailsFinancialAccount `json:"financial_account"`
   152  	// Set when `type` is `issuing_card`. This is an [Issuing Card](https://stripe.com/docs/api#issuing_cards) ID.
   153  	IssuingCard string `json:"issuing_card"`
   154  	// Polymorphic type matching the originating money movement's source. This can be an external account, a Stripe balance, or a FinancialAccount.
   155  	Type          TreasuryReceivedCreditInitiatingPaymentMethodDetailsType           `json:"type"`
   156  	USBankAccount *TreasuryReceivedCreditInitiatingPaymentMethodDetailsUSBankAccount `json:"us_bank_account"`
   157  }
   158  
   159  // The expandable object of the source flow.
   160  type TreasuryReceivedCreditLinkedFlowsSourceFlowDetails struct {
   161  	// You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal.
   162  	CreditReversal *TreasuryCreditReversal `json:"credit_reversal"`
   163  	// 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).
   164  	//
   165  	// Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
   166  	OutboundPayment *TreasuryOutboundPayment `json:"outbound_payment"`
   167  	// A `Payout` object is created when you receive funds from Stripe, or when you
   168  	// initiate a payout to either a bank account or debit card of a [connected
   169  	// Stripe account](https://stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts,
   170  	// and list all payouts. Payouts are made on [varying
   171  	// schedules](https://stripe.com/docs/connect/manage-payout-schedule), depending on your country and
   172  	// industry.
   173  	//
   174  	// Related guide: [Receiving payouts](https://stripe.com/docs/payouts)
   175  	Payout *Payout `json:"payout"`
   176  	// The type of the source flow that originated the ReceivedCredit.
   177  	Type TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType `json:"type"`
   178  }
   179  type TreasuryReceivedCreditLinkedFlows struct {
   180  	// The CreditReversal created as a result of this ReceivedCredit being reversed.
   181  	CreditReversal string `json:"credit_reversal"`
   182  	// Set if the ReceivedCredit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object.
   183  	IssuingAuthorization string `json:"issuing_authorization"`
   184  	// Set if the ReceivedCredit is also viewable as an [Issuing transaction](https://stripe.com/docs/api#issuing_transactions) object.
   185  	IssuingTransaction string `json:"issuing_transaction"`
   186  	// ID of the source flow. Set if `network` is `stripe` and the source flow is visible to the user. Examples of source flows include OutboundPayments, payouts, or CreditReversals.
   187  	SourceFlow string `json:"source_flow"`
   188  	// The expandable object of the source flow.
   189  	SourceFlowDetails *TreasuryReceivedCreditLinkedFlowsSourceFlowDetails `json:"source_flow_details"`
   190  	// The type of flow that originated the ReceivedCredit (for example, `outbound_payment`).
   191  	SourceFlowType string `json:"source_flow_type"`
   192  }
   193  
   194  // Details describing when a ReceivedCredit may be reversed.
   195  type TreasuryReceivedCreditReversalDetails struct {
   196  	// Time before which a ReceivedCredit can be reversed.
   197  	Deadline int64 `json:"deadline"`
   198  	// Set if a ReceivedCredit cannot be reversed.
   199  	RestrictedReason TreasuryReceivedCreditReversalDetailsRestrictedReason `json:"restricted_reason"`
   200  }
   201  
   202  // ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount.
   203  type TreasuryReceivedCredit struct {
   204  	APIResource
   205  	// Amount (in cents) transferred.
   206  	Amount int64 `json:"amount"`
   207  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   208  	Created int64 `json:"created"`
   209  	// 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).
   210  	Currency Currency `json:"currency"`
   211  	// An arbitrary string attached to the object. Often useful for displaying to users.
   212  	Description string `json:"description"`
   213  	// Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen.
   214  	FailureCode TreasuryReceivedCreditFailureCode `json:"failure_code"`
   215  	// The FinancialAccount that received the funds.
   216  	FinancialAccount string `json:"financial_account"`
   217  	// 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.
   218  	HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"`
   219  	// Unique identifier for the object.
   220  	ID                             string                                                `json:"id"`
   221  	InitiatingPaymentMethodDetails *TreasuryReceivedCreditInitiatingPaymentMethodDetails `json:"initiating_payment_method_details"`
   222  	LinkedFlows                    *TreasuryReceivedCreditLinkedFlows                    `json:"linked_flows"`
   223  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   224  	Livemode bool `json:"livemode"`
   225  	// The rails used to send the funds.
   226  	Network TreasuryReceivedCreditNetwork `json:"network"`
   227  	// String representing the object's type. Objects of the same type share the same value.
   228  	Object string `json:"object"`
   229  	// Details describing when a ReceivedCredit may be reversed.
   230  	ReversalDetails *TreasuryReceivedCreditReversalDetails `json:"reversal_details"`
   231  	// Status of the ReceivedCredit. ReceivedCredits are created either `succeeded` (approved) or `failed` (declined). If a ReceivedCredit is declined, the failure reason can be found in the `failure_code` field.
   232  	Status TreasuryReceivedCreditStatus `json:"status"`
   233  	// The Transaction associated with this object.
   234  	Transaction *TreasuryTransaction `json:"transaction"`
   235  }
   236  
   237  // TreasuryReceivedCreditList is a list of ReceivedCredits as retrieved from a list endpoint.
   238  type TreasuryReceivedCreditList struct {
   239  	APIResource
   240  	ListMeta
   241  	Data []*TreasuryReceivedCredit `json:"data"`
   242  }