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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  import "encoding/json"
    10  
    11  type ConnectCollectionTransfer struct {
    12  	// Amount transferred, in cents (or local equivalent).
    13  	Amount int64 `json:"amount"`
    14  	// 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).
    15  	Currency Currency `json:"currency"`
    16  	// ID of the account that funds are being collected for.
    17  	Destination *Account `json:"destination"`
    18  	// Unique identifier for the object.
    19  	ID string `json:"id"`
    20  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    21  	Livemode bool `json:"livemode"`
    22  	// String representing the object's type. Objects of the same type share the same value.
    23  	Object string `json:"object"`
    24  }
    25  
    26  // UnmarshalJSON handles deserialization of a ConnectCollectionTransfer.
    27  // This custom unmarshaling is needed because the resulting
    28  // property may be an id or the full struct if it was expanded.
    29  func (c *ConnectCollectionTransfer) UnmarshalJSON(data []byte) error {
    30  	if id, ok := ParseID(data); ok {
    31  		c.ID = id
    32  		return nil
    33  	}
    34  
    35  	type connectCollectionTransfer ConnectCollectionTransfer
    36  	var v connectCollectionTransfer
    37  	if err := json.Unmarshal(data, &v); err != nil {
    38  		return err
    39  	}
    40  
    41  	*c = ConnectCollectionTransfer(v)
    42  	return nil
    43  }