github.com/stripe/stripe-go/v76@v76.25.0/platformtaxfee.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 PlatformTaxFee struct {
    12  	// The Connected account that incurred this charge.
    13  	Account string `json:"account"`
    14  	// Unique identifier for the object.
    15  	ID string `json:"id"`
    16  	// String representing the object's type. Objects of the same type share the same value.
    17  	Object string `json:"object"`
    18  	// The payment object that caused this tax to be inflicted.
    19  	SourceTransaction string `json:"source_transaction"`
    20  	// The type of tax (VAT).
    21  	Type string `json:"type"`
    22  }
    23  
    24  // UnmarshalJSON handles deserialization of a PlatformTaxFee.
    25  // This custom unmarshaling is needed because the resulting
    26  // property may be an id or the full struct if it was expanded.
    27  func (p *PlatformTaxFee) UnmarshalJSON(data []byte) error {
    28  	if id, ok := ParseID(data); ok {
    29  		p.ID = id
    30  		return nil
    31  	}
    32  
    33  	type platformTaxFee PlatformTaxFee
    34  	var v platformTaxFee
    35  	if err := json.Unmarshal(data, &v); err != nil {
    36  		return err
    37  	}
    38  
    39  	*p = PlatformTaxFee(v)
    40  	return nil
    41  }