func (s *TransactionSource) UnmarshalJSON(data []byte) error {
	type source TransactionSource
	var ss source
	err := json.Unmarshal(data, &ss)
	if err == nil {
		*s = TransactionSource(ss)
		switch s.Type {
		case TransactionSourceCharge:
			err = json.Unmarshal(data, &s.Charge)
		case TransactionSourceDispute:
			err = json.Unmarshal(data, &s.Dispute)
		case TransactionSourceFee:
			err = json.Unmarshal(data, &s.Fee)
		case TransactionSourcePayout:
			err = json.Unmarshal(data, &s.Payout)
		case TransactionSourceRecipientTransfer:
			err = json.Unmarshal(data, &s.RecipientTransfer)
		case TransactionSourceRefund:
			err = json.Unmarshal(data, &s.Refund)
		case TransactionSourceReversal:
			err = json.Unmarshal(data, &s.Reversal)
		case TransactionSourceTransfer:
			err = json.Unmarshal(data, &s.Transfer)
		}
		if err != nil {
			return err
		}
	} else {
		s.ID = string(data[1 : len(data)-1])
	}
	return nil
}
UnmarshalJSON handles deserialization of a TransactionSource.
This custom unmarshaling is needed because the specific
type of transaction source it refers to is specified in the JSON
package stripe
import "encoding/json"
type TransactionStatus string
type TransactionType string
type TransactionSourceType string
const (
	TransactionSourceCharge TransactionSourceType = "charge"
	TransactionSourceDispute TransactionSourceType = "dispute"
	TransactionSourceFee TransactionSourceType = "application_fee"
	TransactionSourcePayout TransactionSourceType = "payout"
	TransactionSourceRecipientTransfer TransactionSourceType = "recipient_transfer"
	TransactionSourceRefund TransactionSourceType = "refund"
	TransactionSourceReversal TransactionSourceType = "reversal"
	TransactionSourceTransfer TransactionSourceType = "transfer"
)
type TransactionSource struct {
	Charge            *Charge               `json:"-"`
	Dispute           *Dispute              `json:"-"`
	Fee               *Fee                  `json:"-"`
	ID                string                `json:"id"`
	Payout            *Payout               `json:"-"`
	RecipientTransfer *RecipientTransfer    `json:"-"`
	Refund            *Refund               `json:"-"`
	Reversal          *Reversal             `json:"-"`
	Transfer          *Transfer             `json:"-"`
	Type              TransactionSourceType `json:"object"`
}
type BalanceParams struct {
	Params `form:"*"`
}
type TxParams struct {
	Params `form:"*"`
}
type TxListParams struct {
	ListParams     `form:"*"`
	Available      int64             `form:"available_on"`
	AvailableRange *RangeQueryParams `form:"available_on"`
	Created        int64             `form:"created"`
	CreatedRange   *RangeQueryParams `form:"created"`
	Currency       string            `form:"currency"`
	Payout         string            `form:"payout"`
	Src            string            `form:"source"`
	Type           TransactionType   `form:"type"`
}
type Balance struct {
	Available []Amount `json:"available"`
	Live      bool     `json:"livemode"`
	Pending   []Amount `json:"pending"`
}
type Transaction struct {
	Amount     int64             `json:"amount"`
	Available  int64             `json:"available_on"`
	Created    int64             `json:"created"`
	Currency   Currency          `json:"currency"`
	Desc       string            `json:"description"`
	ID         string            `json:"id"`
	Fee        int64             `json:"fee"`
	FeeDetails []TxFee           `json:"fee_details"`
	Net        int64             `json:"net"`
	Recipient  string            `json:"recipient"`
	Src        TransactionSource `json:"source"`
	Status     TransactionStatus `json:"status"`
	Type       TransactionType   `json:"type"`
}
type TransactionList struct {
	ListMeta
	Values []*Transaction `json:"data"`
}
type Amount struct {
	Value    int64    `json:"amount"`
	Currency Currency `json:"currency"`
}
type TxFee struct {
	Application string   `json:"application"`
	Amount      int64    `json:"amount"`
	Currency    Currency `json:"currency"`
	Desc        string   `json:"description"`
	Type        string   `json:"type"`
}
func (t *Transaction) UnmarshalJSON(data []byte) error {
	type transaction Transaction
	var tt transaction
	err := json.Unmarshal(data, &tt)
	if err == nil {
		*t = Transaction(tt)
	} else {
		t.ID = string(data[1 : len(data)-1])
	}
	return nil
}