func (d *RecipientTransferDestination) UnmarshalJSON(data []byte) error {
	type dest RecipientTransferDestination
	var dd dest
	err := json.Unmarshal(data, &dd)
	if err == nil {
		*d = RecipientTransferDestination(dd)
		switch d.Type {
		case RecipientTransferDestinationBankAccount:
			err = json.Unmarshal(data, &d.BankAccount)
		case RecipientTransferDestinationCard:
			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 RecipientTransferDestination.
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 RecipientTransferDestinationType string
type RecipientTransferFailCode string
type RecipientTransferSourceType string
type RecipientTransferStatus string
type RecipientTransferType string
const (
	RecipientTransferDestinationBankAccount RecipientTransferDestinationType = "bank_account"
	RecipientTransferDestinationCard RecipientTransferDestinationType = "card"
)
type RecipientTransferMethodType string
const (
	RecipientTransferMethodInstant RecipientTransferMethodType = "instant"
	RecipientTransferMethodStandard RecipientTransferMethodType = "standard"
)
type RecipientTransferDestination struct {
	BankAccount *BankAccount                     `json:"-"`
	Card        *Card                            `json:"-"`
	ID          string                           `json:"id"`
	Type        RecipientTransferDestinationType `json:"object"`
}
type RecipientTransfer struct {
	Amount             int64                        `json:"amount"`
	AmountReversed     int64                        `json:"amount_reversed"`
	BalanceTransaction *Transaction                 `json:"balance_transaction"`
	Bank               *BankAccount                 `json:"bank_account"`
	Card               *Card                        `json:"card"`
	Created            int64                        `json:"created"`
	Currency           Currency                     `json:"currency"`
	Date               int64                        `json:"date"`
	Desc               string                       `json:"description"`
	Dest               RecipientTransferDestination `json:"destination"`
	FailCode           RecipientTransferFailCode    `json:"failure_code"`
	FailMsg            string                       `json:"failure_message"`
	ID                 string                       `json:"id"`
	Live               bool                         `json:"livemode"`
	Meta               map[string]string            `json:"metadata"`
	Method             RecipientTransferMethodType  `json:"method"`
	Recipient          *Recipient                   `json:"recipient"`
	Reversals          *ReversalList                `json:"reversals"`
	Reversed           bool                         `json:"reversed"`
	SourceTx           *TransactionSource           `json:"source_transaction"`
	SourceType         RecipientTransferSourceType  `json:"source_type"`
	Statement          string                       `json:"statement_descriptor"`
	Status             RecipientTransferStatus      `json:"status"`
	Type               RecipientTransferType        `json:"type"`
}
func (t *RecipientTransfer) UnmarshalJSON(data []byte) error {
	type transfer RecipientTransfer
	var tb transfer
	err := json.Unmarshal(data, &tb)
	if err == nil {
		*t = RecipientTransfer(tb)
	} else {
		t.ID = string(data[1 : len(data)-1])
	}
	return nil
}