Skip to content

Commit

Permalink
Next major release changes (#1512)
Browse files Browse the repository at this point in the history
# Changelog

Major version release for API version 2022-08-01. Default API version changed to "2022-08-01".

Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-go/wiki/Migration-guide-for-v73. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-08-01.

"⚠️" symbol highlights breaking changes.

### Added

- Add `CheckoutSessionSetupIntentDataParams.Metadata`.
- Add Invoice `UpcomingLines` method.
- Add `ShippingCost` and `ShippingDetails` properties to `CheckoutSession` resource.
- Add `CheckoutSessionShippingCostTax` and `CheckoutSessionShippingCost` classes
- Add `IssuingCardCancellationReasonDesignRejected` constant to `IssuingCardCancellationReason`.
- Add `Validate` field to `Customer` resource.
- Add `Validate` field to `PaymentSourceParams`.
- Add `SetupAttemptPaymentMethodDetailsCardThreeDSecureResultExempted` constant in `SetupAttemptPaymentMethodDetailsCardThreeDSecureResult`.
- Add `SKUPackageDimensionsParams` and `SKUPackageDimensions`.
- Add dedicated structs for different payment sources and transfers.
- Add `Subscription.DeleteDiscount` methods.
- Add `SubscriptionItemUsageRecordSummariesParams`
- Add `UsageRecordSummary` `UsageRecordSummaries`, and `UsageRecordSummaryList` methods in `SubscriptionItem`
- Add `SubscriptionSchedulePhaseBillingCycleAnchor`, `SubscriptionSchedulePhaseBillingCycleAnchorAutomatic`, and `SubscriptionSchedulePhaseBillingCycleAnchorPhaseStart`
- Add `SubscriptionSchedulePhaseInvoiceSettings` and `SubscriptionSchedulePhaseInvoiceSettingsParams `
- `TerminalLocation` `UnmarshalJSON` - make `TerminalLocation` expandable

### ⚠️ Changed

- Rename files to be consistent with the library's naming conventions.
    - `fee.go` to `applicationfee.go` 
    - `fee/client.go` to `applicationfee/client.go` 
    - `sub.go` to `subscription.go` 
    - `sub/client.go` to `subscription/client.go` 
    - `subitem.go` to `subscriptionitem.go` 
    - `subitem/client.go` to `subscriptionitem/client.go` 
    - `subschedule.go` to `subscriptionschedule.go` 
    - `subschedule/client.go` to `subscriptionschedule/client.go` 
    - `reversal.go` to `transferreversal.go` 
    - `reversal/client.go` to `transferreversal/client.go` 

- Change resource names on `client#API` to be plural to be consistent with the library's naming conventions: 
- Rename structs, fields, enums, and methods to be consistent with the library's naming conventions and with the other Stripe SDKs.
  - `Ach` to `ACH`
  - `Acss` to `ACSS`
  - `Bic` to `BIC`
  - `Eps` to `EPS`
  - `FEDEX` to `FedEx`
  - `Iban` to `IBAN`
  - `Ideal` to `IDEAL`
  - `Sepa` to `SEPA`
  - `Wechat` to `WeChat`
  - `ExternalAccount` to `AccountExternalAccount`
  - `InvoiceLine` to `InvoiceLineItem`
  - `Person` structs/enums to use `Person` prefix
  - and others (see Migration guide)

- Change types of various fields in `Account`, `ApplicationFee`, `BalanceTransaction`, `BillingPortalConfiguration`, `Card`, `Charge`, `Customer`, `Discount`, `Invoice`, `Issuing Card`,  `Issuing Dispute `, `Mandate `, `PaymentIntent`, `PaymentMethod`, `Payout`, `Plan `, `Plan `, `Refund`, `SetupIntent`, `Source`, `Source`, `Subscription`, `SubscriptionItem`, `SubscriptionSchedule`, `Terminal ConnectionToken`, `Terminal Location`, `Terminal Reader `, `Topup`, and `Transfer` (see Migration guide).

- Update the Webhook `ConstructEvent,` `ConstructEventIgnoringTolerance` and `ConstructEventWithTolerance` functions to return an error when the webhook event's API version does not match the stripe-go library API version.
- Update `ErrorType`and `ErrorCode` values.
- Move `BalanceTransaction` iterator from `balance.go` to `balancetransaction.go`
- Fix `BalanceTransactionSource` `UnmarshalJSON` for when `BalanceTransactionSource.Type == "transfer_reversal"` (previously, we were checking if `Type == "reversal"`, which was always false)
- For BankAccount and Card client methods, check that exactly one of `params.Account` and `params.Customer` is set (previously they could both be set, but only one would be used, and it was different between BankAccount and Card)
- Replace `CardVerification` with field-specific enums (with the same values)
- Move `Del` from `discount/client.go` to `customer/client.go` and rename to `DeleteDiscount`
- Move `DelSub` from `discount/client.go` to `subscription/client.go` and rename to `DeleteDiscount`
- Add separate parameter struct for CreditNote `ListPreviewLines` (renamed to `PreviewLines`) method (`[CreditNoteLineItemListPreviewParams -> CreditNotePreviewParams].Lines` `CreditNoteLineParams` -> `CreditNotePreviewLineParams`)
- Replace `FeeRefundParams.ApplicationFee` with `FeeRefundParams.Fee` and `FeeRefundParams.ID`
- Add separate parameter struct for Invoice `GetNext` (renamed to `Upcoming`) method (`InvoiceUpcomingParams`, and nested params `InvoiceUpcomingLinesInvoiceItemPriceDataParams`, `InvoiceUpcomingLinesInvoiceItemDiscountParams`, `InvoiceUpcomingLinesDiscountParams`, `InvoiceUpcomingLinesInvoiceItemPeriodParams`). `Upcoming`-only fields `Coupon`, `CustomerDetails`, `InvoiceItems`, `Subscription`, `SubscriptionBillingCycleAnchor`, `Schedule`, `SubscriptionBillingCycleAnchor`, `SubscriptionBillingCycleAnchorNow`, `SubscriptionBillingCycleAnchorUnchanged`, `SubscriptionCancelAt`, `SubscriptionCancelAtPeriodEnd`, `SubscriptionCancelNow`, `SubscriptionDefaultTaxRates`, `SubscriptionItems`, `SubscriptionProrationBehavior`, `SubscriptionProrationDate`, `SubscriptionStartDate`, `SubscriptionTrialEnd`, `SubscriptionTrialEndNow`, and `SubscriptionTrialFromPlan` are removed from `InvoiceParams`.
- Add separate structs for `BillingDetails` and `BillingDetailsParams`: `PaymentMethodBillingDetails`, `PaymentMethodBillingDetailsParams`
- Add separate structs for `PaymentMethodCardNetwork`: `PaymentMethodCardNetworksAvailable`, `PaymentMethodCardNetworksPreferred`

### Deprecated

- The `SKU` resource has been deprecated. This will be replaced by https://stripe.com/docs/api/orders_v2.

### ⚠️ Removed

- Remove the legacy Orders API
- Remove `AccountCapability` enum definition. This was not referenced in the library.
- Remove `UnmarshalJSON` for resources that are not expandable: `BillingPortalSession`, `Capability`, `CheckoutSession`, `FileLink`, `InvoiceItem`, `LineItem`, `Person`, `WebhookEndpoint`
- Remove `AccountRejectReason` (was only referenced in `account/client_test.go`, actual `AccountRejectParams.Reason` is `*string`)
- Remove `AccountParams.RequestedCapabilities` (use Capabilities instead: https://stripe.com/docs/connect/account-capabilities)
- Remove `AccountSettingsParams.Dashboard` and `AccountSettingsDashboardParams` (Note: `Dashboard` are still available on `AccountSettings`, but it's not available as parameters for any of the methods)
- Remove `AccountCompany.RegistrationNumber` (Note: `RegistrationNumber` is still available on `AccountCompanyParams`, but is not returned in the response)
- Remove `BalanceTransactionStatus`. It was meant to be an enum, but none of the enum values were defined, so it was just an alias for string.
- Remove `CardParams.AccountType`. `AccountType` does not exist on any client method for Card. It does on BankAccount, which is similar.
- Remove `id` param from CheckoutSessions `ListLineItems`. Use `CheckoutSessionListLineItemsParams.Session` instead.
- Remove `CheckoutSessionLineItemPriceDataRecurringParams.AggregateUsage`, `CheckoutSessionLineItemPriceDataRecurringParams.TrialPeriodDays`, and `CheckoutSessionLineItemPriceDataRecurringParams.UsageType`
- Remove `CheckoutSessionPaymentIntentDataParams.Params`, `CheckoutSessionSetupIntentDataParams.Params`, `CheckoutSessionSubscriptionDataParams.Params`. `Params` should only be embedded in root method struct, and has extraneous fields not applicable to child/sub structs.
- Remove `CheckoutSessionTotalDetailsBreakdownTax.TaxRate`. Use `CheckoutSessionTotalDetailsBreakdownTax.Rate`
- Remove `CheckoutSessionTotalDetailsBreakdownTax.Deleted`
- Remove `CustomerParams.Token`
- Remove `Discount` `APIResource` embed
- Remove `DiscountParams`
- Remove `FilePurposeFoundersStockDocument` (`"founders_stock_document"` option for `File.Purpose`)
- Remove `InvoiceParams.Paid`. Use `invoice.status` to check for status. `invoice.status` is a read-only field.
- Remove `InvoiceParams.SubscriptionPlan` and `InvoiceParams.SubscriptionQuantity` (note: these would have been on `InvoiceUpcomingParams`)
- Remove `InvoiceListLinesParams.Customer` and `InvoiceListLinesParams.Subscription` (these are not available for Invoice `ListLines`, but are available for `List`)
- Remove `IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity` and `IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName` (unused enums)
- Remove `IssuingCardSpendingControlsParams.SpendingLimitsCurrency`. `issuing_card` has `currency`, and `issuing_card.spending_controls.spending_limits.amount` will use that currency
- Remove `IssuingDisputeEvidenceServiceNotAsDescribed.ProductDescription`, `IssuingDisputeEvidenceServiceNotAsDescribed.ProductType`, `IssuingDisputeEvidenceServiceNotAsDescribedParams.ProductDescription`, `IssuingDisputeEvidenceServiceNotAsDescribedParams.ProductType`, and `IssuingDisputeEvidenceServiceNotAsDescribedProductType`. `issuing_dispute.evidence.service_not_as_described` does not have `product_description` or `product_type`. `issuing_dispute.evidence.canceled` does.
- Remove `LineItemTax.TaxRate`. Use `LineItemTax.Rate` instead.
- Remove `LineItem.Deleted`
- Remove `LoginLink.RedirectURL`
- Remove `PaymentIntentOffSession` (unused enum)
- Remove `PaymentIntentConfirmParams.PaymentMethodTypes`
- Remove `PaymentMethodFPX.TransactionID`
- Remove `Payout.BankAccount` and `Payout.Card` (These fields were never populated, use `PayoutDestination.BankAccount` and `PayoutDestination.Card` instead)
- Remove `PlanParams.ProductID`. Use `PlanParams.Product.ID` instead.
- Remove `Shipping` and `ShippingRate` properties from `CheckoutSession` resource. Please use `ShippingCost` and `ShippingDetails` properties instead.
- Remove `DefaultCurrency` property from `Customer` resource. Please use `Currency` property instead.
- Remove `Updated` and `UpdatedBy` from `RadarValueList`
- Remove `Name` from `RadarValueListItem`
- Remove `ReviewReasonType` type from `Review` resource. Use `ReviewReason` instead
- Remove `SetupIntentCancellationReasonFailedInvoice` and `SetupIntentCancellationReasonFraudulent` values from `SetupIntentCancellationReason`
- Remove `SigmaScheduledQueryRun.Query`. The field was invalid
- Remove `SKUParams.Description` and `SKU.Description`
- Remove `SourceMandateAcceptanceStatus`, `SourceMandateAcceptanceStatusAccepted`, `SourceMandateAcceptanceStatusRefused`, `SourceMandateNotificationMethod`, `SourceMandateNotificationMethodEmail`, `SourceMandateNotificationMethodManual`, and `SourceMandateNotificationMethodNone`
- Remove `Source.TypeData` and SourceParams and replace with payment method-specific fields (AUBECSDebit, Bancontact, Card, CardPresent, EPS, Giropay, IDEAL, Klarna, Multibanco, P24, SEPACreditTransfer, SEPADebit, Sofort, ThreeDSecure, Wechat) and `Source.AppendTo` method
- Remove `SourceTransaction.CustomerData`. The field was deprecated
- Remove `SourceTransaction.TypeData` and `SourceTransaction.UnmarshalJSON`. Use payment specific fields - Remove `ACHCreditTransfer`, `CHFCreditTransfer`, `GBPCreditTransfer`, `PaperCheck`, and `SEPACreditTransfer`
- Remove `SubscriptionPaymentBehavior`, `SubscriptionPaymentBehaviorAllowIncomplete`, `SubscriptionPaymentBehaviorErrorIfIncomplete`, and `SubscriptionPaymentBehaviorPendingIfIncomplete`
- Remove `SubscriptionProrationBehavior`, `SubscriptionProrationBehaviorAlwaysInvoice`, `SubscriptionProrationBehaviorCreateProrations`, and `SubscriptionProrationBehaviorNone`
- Remove `SubscriptionStatusAll`
- Remove `SubscriptionParams.Card`, `SubscriptionParams.Plan`, and `SubscriptionParams.Quantity`
- Remove `Subscription.Plan` and `Subscription.Quantity`
- Remove `SubscriptionItemParams.ID`. The field was deprecated
- Remove `SubscriptionSchedulePhaseAddInvoiceItemPriceDataRecurringParams` and `SubscriptionSchedulePhaseAddInvoiceItemPriceDataParams`
- Remove `Del` method on `TaxRate`
- Remove `TerminalReaderGetParams`. Use `TerminalReaderParams` instead.
- Remove `TerminalReaderList.Location` and `TerminalReaderList.Status` (Not available for the list, but is available for individual `TerminalReader`s in `TerminalReaderList.Data`)
- Remove `Token.Email` and `TokenParams.Email`
- Remove `TopupParams.SetSource`
- Remove `WebhookEndpointListParams.Created` and `WebhookEndpointListParams.CreatedRange` (use `StartingAfter` from `ListParams`)
- Remove `WebhookEndpoint.Connected`
  • Loading branch information
yejia-stripe authored Aug 1, 2022
1 parent 38d1979 commit 04fd3c0
Show file tree
Hide file tree
Showing 148 changed files with 2,961 additions and 3,419 deletions.
377 changes: 143 additions & 234 deletions account.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions account/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestAccountNew(t *testing.T) {
Logo: stripe.String("file_234"),
},
CardPayments: &stripe.AccountSettingsCardPaymentsParams{
DeclineOn: &stripe.AccountDeclineSettingsParams{
DeclineOn: &stripe.AccountSettingsCardPaymentsDeclineOnParams{
AVSFailure: stripe.Bool(true),
CVCFailure: stripe.Bool(true),
},
Expand All @@ -89,9 +89,9 @@ func TestAccountNew(t *testing.T) {
},
Payouts: &stripe.AccountSettingsPayoutsParams{
DebitNegativeBalances: stripe.Bool(true),
Schedule: &stripe.PayoutScheduleParams{
Schedule: &stripe.AccountSettingsPayoutsScheduleParams{
DelayDaysMinimum: stripe.Bool(true),
Interval: stripe.String(string(stripe.PayoutIntervalManual)),
Interval: stripe.String(string(stripe.AccountSettingsPayoutsScheduleIntervalManual)),
},
StatementDescriptor: stripe.String("payout_descriptor"),
},
Expand All @@ -104,7 +104,7 @@ func TestAccountNew(t *testing.T) {

func TestAccountReject(t *testing.T) {
account, err := Reject("acct_123", &stripe.AccountRejectParams{
Reason: stripe.String(string(stripe.AccountRejectReasonFraud)),
Reason: stripe.String("fraud"),
})
assert.Nil(t, err)
assert.NotNil(t, account)
Expand All @@ -113,7 +113,7 @@ func TestAccountReject(t *testing.T) {
func TestAccountUpdate(t *testing.T) {
account, err := Update("acct_123", &stripe.AccountParams{
Company: &stripe.AccountCompanyParams{
Address: &stripe.AccountAddressParams{
Address: &stripe.AddressParams{
Country: stripe.String("CA"),
City: stripe.String("Montreal"),
PostalCode: stripe.String("H2Y 1C6"),
Expand Down
8 changes: 4 additions & 4 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestAccount_Unmarshal(t *testing.T) {
assert.Equal(t, "descriptor", account.Settings.Payments.StatementDescriptor)
assert.Equal(t, true, account.Settings.Payouts.DebitNegativeBalances)
assert.Equal(t, int64(2), account.Settings.Payouts.Schedule.DelayDays)
assert.Equal(t, PayoutIntervalWeekly, account.Settings.Payouts.Schedule.Interval)
assert.Equal(t, AccountSettingsPayoutsScheduleIntervalWeekly, account.Settings.Payouts.Schedule.Interval)

assert.Equal(t, int64(1528573382), account.TOSAcceptance.Date)
assert.Equal(t, "127.0.0.1", account.TOSAcceptance.IP)
Expand Down Expand Up @@ -193,10 +193,10 @@ func TestExternalAccount_UnmarshalJSON(t *testing.T) {
// decode
data := []byte(`{"id":"ba_123", "object":"bank_account"}`)

var v ExternalAccount
var v AccountExternalAccount
err := json.Unmarshal(data, &v)
assert.NoError(t, err)
assert.Equal(t, ExternalAccountTypeBankAccount, v.Type)
assert.Equal(t, AccountExternalAccountTypeBankAccount, v.Type)

// The external account has a field for each possible type, so the
// bank account is located one level down
Expand All @@ -206,7 +206,7 @@ func TestExternalAccount_UnmarshalJSON(t *testing.T) {

func TestPayoutScheduleParams_AppendTo(t *testing.T) {
{
params := &PayoutScheduleParams{DelayDaysMinimum: Bool(true)}
params := &AccountSettingsPayoutsScheduleParams{DelayDaysMinimum: Bool(true)}
body := &form.Values{}
form.AppendTo(body, params)
t.Logf("body = %+v", body)
Expand Down
2 changes: 1 addition & 1 deletion fee.go → applicationfee.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ApplicationFee struct {
// Amount in %s refunded (can be less than the amount attribute on the fee if a partial refund was issued)
AmountRefunded int64 `json:"amount_refunded"`
// ID of the Connect application that earned the fee.
Application string `json:"application"`
Application *Application `json:"application"`
// Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
BalanceTransaction *BalanceTransaction `json:"balance_transaction"`
// ID of the charge that the application fee was taken from.
Expand Down
4 changes: 2 additions & 2 deletions fee/client.go → applicationfee/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//

// Package fee provides the /application_fees APIs
package fee
// Package applicationfee provides the /application_fees APIs
package applicationfee

import (
"net/http"
Expand Down
2 changes: 1 addition & 1 deletion fee/client_test.go → applicationfee/client_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fee
package applicationfee

import (
"testing"
Expand Down
9 changes: 3 additions & 6 deletions balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ const (
BalanceSourceTypeFPX BalanceSourceType = "fpx"
)

// BalanceTransactionStatus is the list of allowed values for the balance transaction's status.
type BalanceTransactionStatus string

// Retrieves the current account balance, based on the authentication that was used to make the request.
// For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
type BalanceParams struct {
Expand All @@ -28,12 +25,12 @@ type BalanceParams struct {
// Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). The available balance for each currency and payment type can be found in the `source_types` property.
type Amount struct {
// Balance amount.
Value int64 `json:"amount"`
Amount int64 `json:"amount"`
// 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).
Currency Currency `json:"currency"`
SourceTypes map[BalanceSourceType]int64 `json:"source_types"`
}
type BalanceDetails struct {
type BalanceIssuing struct {
// Funds that are available for use.
Available []*Amount `json:"available"`
}
Expand All @@ -57,7 +54,7 @@ type Balance struct {
ConnectReserved []*Amount `json:"connect_reserved"`
// Funds that can be paid out using Instant Payouts.
InstantAvailable []*Amount `json:"instant_available"`
Issuing *BalanceDetails `json:"issuing"`
Issuing *BalanceIssuing `json:"issuing"`
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Livemode bool `json:"livemode"`
// String representing the object's type. Objects of the same type share the same value.
Expand Down
10 changes: 0 additions & 10 deletions balance/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ func (c Client) Get(params *stripe.BalanceParams) (*stripe.Balance, error) {
return balance, err
}

// Iter is an iterator for balance transactions.
type Iter struct {
*stripe.Iter
}

// BalanceTransaction returns the balance transaction which the iterator is currently pointing to.
func (i *Iter) BalanceTransaction() *stripe.BalanceTransaction {
return i.Current().(*stripe.BalanceTransaction)
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}
10 changes: 5 additions & 5 deletions balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ func TestBalance_Unmarshal(t *testing.T) {
err = json.Unmarshal(bytes, &balance)
assert.NoError(t, err)

assert.Equal(t, int64(111), balance.Available[0].Value)
assert.Equal(t, int64(111), balance.Available[0].Amount)
assert.Equal(t, CurrencyUSD, balance.Available[0].Currency)
assert.Equal(t, int64(222), balance.Available[1].Value)
assert.Equal(t, int64(222), balance.Available[1].Amount)
assert.Equal(t, CurrencyEUR, balance.Available[1].Currency)
assert.Equal(t, int64(222), balance.Available[1].Value)
assert.Equal(t, int64(222), balance.Available[1].Amount)

assert.Equal(t, int64(333), balance.Pending[0].Value)
assert.Equal(t, int64(333), balance.Pending[0].Amount)
assert.Equal(t, CurrencyUSD, balance.Pending[0].Currency)
assert.Equal(t, int64(444), balance.Pending[1].Value)
assert.Equal(t, int64(444), balance.Pending[1].Amount)
assert.Equal(t, CurrencyEUR, balance.Pending[1].Currency)

// Confirm source-type deserialization works
Expand Down
83 changes: 43 additions & 40 deletions balancetransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ const (
BalanceTransactionSourceTypeIssuingTransaction BalanceTransactionSourceType = "issuing.transaction"
BalanceTransactionSourceTypePayout BalanceTransactionSourceType = "payout"
BalanceTransactionSourceTypeRefund BalanceTransactionSourceType = "refund"
BalanceTransactionSourceTypeReversal BalanceTransactionSourceType = "reversal"
BalanceTransactionSourceTypeTopup BalanceTransactionSourceType = "topup"
BalanceTransactionSourceTypeTransfer BalanceTransactionSourceType = "transfer"
BalanceTransactionSourceTypeTransferReversal BalanceTransactionSourceType = "transfer_reversal"
)

// If the transaction's net funds are available in the Stripe balance yet. Either `available` or `pending`.
type BalanceTransactionStatus string

// List of values that BalanceTransactionStatus can take
const (
BalanceTransactionStatusAvailable BalanceTransactionStatus = "available"
Expand All @@ -71,38 +74,38 @@ type BalanceTransactionType string

// List of values that BalanceTransactionType can take
const (
BalanceTransactionTypeAdjustment BalanceTransactionType = "adjustment"
BalanceTransactionTypeAdvance BalanceTransactionType = "advance"
BalanceTransactionTypeAdvanceFunding BalanceTransactionType = "advance_funding"
BalanceTransactionTypeAnticipationRepayment BalanceTransactionType = "anticipation_repayment"
BalanceTransactionTypeApplicationFee BalanceTransactionType = "application_fee"
BalanceTransactionTypeApplicationFeeRefund BalanceTransactionType = "application_fee_refund"
BalanceTransactionTypeCharge BalanceTransactionType = "charge"
BalanceTransactionTypeConnectCollectionTransfer BalanceTransactionType = "connect_collection_transfer"
BalanceTransactionTypeContribution BalanceTransactionType = "contribution"
BalanceTransactionTypeIssuingAuthorizationHold BalanceTransactionType = "issuing_authorization_hold"
BalanceTransactionTypeIssuingAuthorizationRelease BalanceTransactionType = "issuing_authorization_release"
BalanceTransactionTypeIssuingAuthorizationDispute BalanceTransactionType = "issuing_dispute"
BalanceTransactionTypeIssuingAuthorizationTransaction BalanceTransactionType = "issuing_transaction"
BalanceTransactionTypePayment BalanceTransactionType = "payment"
BalanceTransactionTypePaymentFailureRefund BalanceTransactionType = "payment_failure_refund"
BalanceTransactionTypePaymentRefund BalanceTransactionType = "payment_refund"
BalanceTransactionTypePayout BalanceTransactionType = "payout"
BalanceTransactionTypePayoutCancel BalanceTransactionType = "payout_cancel"
BalanceTransactionTypePayoutFailure BalanceTransactionType = "payout_failure"
BalanceTransactionTypeRefund BalanceTransactionType = "refund"
BalanceTransactionTypeRefundFailure BalanceTransactionType = "refund_failure"
BalanceTransactionTypeReserveTransaction BalanceTransactionType = "reserve_transaction"
BalanceTransactionTypeReservedFunds BalanceTransactionType = "reserved_funds"
BalanceTransactionTypeStripeFee BalanceTransactionType = "stripe_fee"
BalanceTransactionTypeStripeFxFee BalanceTransactionType = "stripe_fx_fee"
BalanceTransactionTypeTaxFee BalanceTransactionType = "tax_fee"
BalanceTransactionTypeTopup BalanceTransactionType = "topup"
BalanceTransactionTypeTopupReversal BalanceTransactionType = "topup_reversal"
BalanceTransactionTypeTransfer BalanceTransactionType = "transfer"
BalanceTransactionTypeTransferCancel BalanceTransactionType = "transfer_cancel"
BalanceTransactionTypeTransferFailure BalanceTransactionType = "transfer_failure"
BalanceTransactionTypeTransferRefund BalanceTransactionType = "transfer_refund"
BalanceTransactionTypeAdjustment BalanceTransactionType = "adjustment"
BalanceTransactionTypeAdvance BalanceTransactionType = "advance"
BalanceTransactionTypeAdvanceFunding BalanceTransactionType = "advance_funding"
BalanceTransactionTypeAnticipationRepayment BalanceTransactionType = "anticipation_repayment"
BalanceTransactionTypeApplicationFee BalanceTransactionType = "application_fee"
BalanceTransactionTypeApplicationFeeRefund BalanceTransactionType = "application_fee_refund"
BalanceTransactionTypeCharge BalanceTransactionType = "charge"
BalanceTransactionTypeConnectCollectionTransfer BalanceTransactionType = "connect_collection_transfer"
BalanceTransactionTypeContribution BalanceTransactionType = "contribution"
BalanceTransactionTypeIssuingAuthorizationHold BalanceTransactionType = "issuing_authorization_hold"
BalanceTransactionTypeIssuingAuthorizationRelease BalanceTransactionType = "issuing_authorization_release"
BalanceTransactionTypeIssuingDispute BalanceTransactionType = "issuing_dispute"
BalanceTransactionTypeIssuingTransaction BalanceTransactionType = "issuing_transaction"
BalanceTransactionTypePayment BalanceTransactionType = "payment"
BalanceTransactionTypePaymentFailureRefund BalanceTransactionType = "payment_failure_refund"
BalanceTransactionTypePaymentRefund BalanceTransactionType = "payment_refund"
BalanceTransactionTypePayout BalanceTransactionType = "payout"
BalanceTransactionTypePayoutCancel BalanceTransactionType = "payout_cancel"
BalanceTransactionTypePayoutFailure BalanceTransactionType = "payout_failure"
BalanceTransactionTypeRefund BalanceTransactionType = "refund"
BalanceTransactionTypeRefundFailure BalanceTransactionType = "refund_failure"
BalanceTransactionTypeReserveTransaction BalanceTransactionType = "reserve_transaction"
BalanceTransactionTypeReservedFunds BalanceTransactionType = "reserved_funds"
BalanceTransactionTypeStripeFee BalanceTransactionType = "stripe_fee"
BalanceTransactionTypeStripeFxFee BalanceTransactionType = "stripe_fx_fee"
BalanceTransactionTypeTaxFee BalanceTransactionType = "tax_fee"
BalanceTransactionTypeTopup BalanceTransactionType = "topup"
BalanceTransactionTypeTopupReversal BalanceTransactionType = "topup_reversal"
BalanceTransactionTypeTransfer BalanceTransactionType = "transfer"
BalanceTransactionTypeTransferCancel BalanceTransactionType = "transfer_cancel"
BalanceTransactionTypeTransferFailure BalanceTransactionType = "transfer_failure"
BalanceTransactionTypeTransferRefund BalanceTransactionType = "transfer_refund"
)

// Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
Expand Down Expand Up @@ -133,8 +136,8 @@ type BalanceTransactionParams struct {
Params `form:"*"`
}

// Fees (in %s) paid for this transaction.
type BalanceTransactionFee struct {
// Detailed breakdown of fees (in %s) paid for this transaction.
type BalanceTransactionFeeDetail struct {
// Amount of the fee, in cents.
Amount int64 `json:"amount"`
// ID of the Connect application that earned the fee.
Expand Down Expand Up @@ -168,7 +171,7 @@ type BalanceTransaction struct {
// Fees (in %s) paid for this transaction.
Fee int64 `json:"fee"`
// Detailed breakdown of fees (in %s) paid for this transaction.
FeeDetails []*BalanceTransactionFee `json:"fee_details"`
FeeDetails []*BalanceTransactionFeeDetail `json:"fee_details"`
// Unique identifier for the object.
ID string `json:"id"`
// Net amount of the transaction, in %s.
Expand All @@ -195,12 +198,12 @@ type BalanceTransactionSource struct {
FeeRefund *FeeRefund `json:"-"`
IssuingAuthorization *IssuingAuthorization `json:"-"`
IssuingDispute *IssuingDispute `json:"-"`
IssuingTransaction *IssuingAuthorization `json:"-"`
IssuingTransaction *IssuingTransaction `json:"-"`
Payout *Payout `json:"-"`
Refund *Refund `json:"-"`
Reversal *Reversal `json:"-"`
Topup *Topup `json:"-"`
Transfer *Transfer `json:"-"`
TransferReversal *TransferReversal `json:"-"`
}

// BalanceTransactionList is a list of BalanceTransactions as retrieved from a list endpoint.
Expand Down Expand Up @@ -268,12 +271,12 @@ func (b *BalanceTransactionSource) UnmarshalJSON(data []byte) error {
err = json.Unmarshal(data, &b.Payout)
case BalanceTransactionSourceTypeRefund:
err = json.Unmarshal(data, &b.Refund)
case BalanceTransactionSourceTypeReversal:
err = json.Unmarshal(data, &b.Reversal)
case BalanceTransactionSourceTypeTopup:
err = json.Unmarshal(data, &b.Topup)
case BalanceTransactionSourceTypeTransfer:
err = json.Unmarshal(data, &b.Transfer)
case BalanceTransactionSourceTypeTransferReversal:
err = json.Unmarshal(data, &b.TransferReversal)
}
return err
}
12 changes: 8 additions & 4 deletions bankaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ type BankAccountParams struct {
AccountHolderName *string `form:"account_holder_name"`
// The type of entity that holds the account. This can be either `individual` or `company`.
AccountHolderType *string `form:"account_holder_type"`
AccountNumber *string `form:"account_number"`
// The account number for the bank account, in string form. Must be a checking account.
AccountNumber *string `form:"account_number"`
// The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`.
AccountType *string `form:"account_type"`
// City/District/Suburb/Town/Village.
Expand All @@ -75,16 +76,19 @@ type BankAccountParams struct {
AddressState *string `form:"address_state"`
// ZIP or postal code.
AddressZip *string `form:"address_zip"`
Country *string `form:"country"`
Currency *string `form:"currency"`
// The country in which the bank account is located.
Country *string `form:"country"`
// The currency the bank account is in. This must be a country/currency pairing that [Stripe supports](https://stripe.com/docs/payouts).
Currency *string `form:"currency"`
// When set to true, this becomes the default external account for its currency.
DefaultForCurrency *bool `form:"default_for_currency"`
// Two digit number representing the card's expiration month.
ExpMonth *string `form:"exp_month"`
// Four digit number representing the card's expiration year.
ExpYear *string `form:"exp_year"`
// Cardholder name.
Name *string `form:"name"`
Name *string `form:"name"`
// The routing number, sort code, or other country-appropriate institution number for the bank account. For US bank accounts, this is required and should be the ACH routing number, not the wire routing number. If you are providing an IBAN for `account_number`, this field is not required.
RoutingNumber *string `form:"routing_number"`
// ID is used when tokenizing a bank account for shared customers
ID *string `form:"*"`
Expand Down
Loading

0 comments on commit 04fd3c0

Please sign in to comment.