func (d *PayoutDestination) UnmarshalJSON(data []byte) error {
	type dest PayoutDestination
	var dd dest
	err := json.Unmarshal(data, &dd)
	if err == nil {
		*d = PayoutDestination(dd)
		switch d.Type {
		case PayoutDestinationBankAccount:
			err = json.Unmarshal(data, &d.BankAccount)
		case PayoutDestinationCard:
			err = json.Unmarshal(data, &d.Card)
		}
		if err != nil {
			return err
		}
	} else {
		d.ID = string(data[1 : len(data)-1])
	}
	return nil
}
UnmarshalJSON handles deserialization of a PayoutDestination.
This custom unmarshaling is needed because the specific
type of destination it refers to is specified in the JSON
package stripe
import "encoding/json"
type PayoutDestinationType string
type PayoutFailureCode string
type PayoutSourceType string
type PayoutStatus string
type PayoutType string
const (
	PayoutDestinationBankAccount PayoutDestinationType = "bank_account"
	PayoutDestinationCard PayoutDestinationType = "card"
)
type PayoutMethodType string
const (
	PayoutMethodInstant PayoutMethodType = "instant"
	PayoutMethodStandard PayoutMethodType = "standard"
)
type PayoutDestination struct {
	BankAccount *BankAccount          `json:"-"`
	Card        *Card                 `json:"-"`
	ID          string                `json:"id"`
	Type        PayoutDestinationType `json:"object"`
}
type PayoutParams struct {
	Params              `form:"*"`
	Amount              int64            `form:"amount"`
	Currency            Currency         `form:"currency"`
	Destination         string           `form:"destination"`
	Method              PayoutMethodType `form:"method"`
	SourceType          PayoutSourceType `form:"source_type"`
	StatementDescriptor string           `form:"statement_descriptor"`
}
type PayoutListParams struct {
	ListParams       `form:"*"`
	ArrivalDate      int64             `form:"arrival_date"`
	ArrivalDateRange *RangeQueryParams `form:"arrival_date"`
	Created          int64             `form:"created"`
	CreatedRange     *RangeQueryParams `form:"created"`
	Destination      string            `form:"destination"`
	Status           PayoutStatus      `form:"status"`
}
type Payout struct {
	Amount                    int64             `json:"amount"`
	ArrivalDate               int64             `json:"arrival_date"`
	Automatic                 bool              `json:"automatic"`
	BalanceTransaction        *Transaction      `json:"balance_transaction"`
	Bank                      *BankAccount      `json:"bank_account"`
	Card                      *Card             `json:"card"`
	Created                   int64             `json:"created"`
	Currency                  Currency          `json:"currency"`
	Destination               PayoutDestination `json:"destination"`
	FailCode                  PayoutFailureCode `json:"failure_code"`
	FailMessage               string            `json:"failure_message"`
	FailureBalanceTransaction *Transaction      `json:"failure_balance_transaction"`
	ID                        string            `json:"id"`
	Live                      bool              `json:"livemode"`
	Meta                      map[string]string `json:"metadata"`
	Method                    PayoutMethodType  `json:"method"`
	SourceType                PayoutSourceType  `json:"source_type"`
	StatementDescriptor       string            `json:"statement_descriptor"`
	Status                    PayoutStatus      `json:"status"`
	Type                      PayoutType        `json:"type"`
}
type PayoutList struct {
	ListMeta
	Values []*Payout `json:"data"`
}
func (t *Payout) UnmarshalJSON(data []byte) error {
	type payout Payout
	var tb payout
	err := json.Unmarshal(data, &tb)
	if err == nil {
		*t = Payout(tb)
	} else {
		t.ID = string(data[1 : len(data)-1])
	}
	return nil
}