github.com/stripe/stripe-go/v76@v76.25.0/issuing_transaction.go (about) 1 // 2 // 3 // File generated from our OpenAPI spec 4 // 5 // 6 7 package stripe 8 9 import "encoding/json" 10 11 // The type of fuel that was purchased. One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. 12 type IssuingTransactionPurchaseDetailsFuelType string 13 14 // List of values that IssuingTransactionPurchaseDetailsFuelType can take 15 const ( 16 IssuingTransactionPurchaseDetailsFuelTypeDiesel IssuingTransactionPurchaseDetailsFuelType = "diesel" 17 IssuingTransactionPurchaseDetailsFuelTypeOther IssuingTransactionPurchaseDetailsFuelType = "other" 18 IssuingTransactionPurchaseDetailsFuelTypeUnleadedPlus IssuingTransactionPurchaseDetailsFuelType = "unleaded_plus" 19 IssuingTransactionPurchaseDetailsFuelTypeUnleadedRegular IssuingTransactionPurchaseDetailsFuelType = "unleaded_regular" 20 IssuingTransactionPurchaseDetailsFuelTypeUnleadedSuper IssuingTransactionPurchaseDetailsFuelType = "unleaded_super" 21 ) 22 23 // The units for `volume_decimal`. One of `us_gallon` or `liter`. 24 type IssuingTransactionPurchaseDetailsFuelUnit string 25 26 // List of values that IssuingTransactionPurchaseDetailsFuelUnit can take 27 const ( 28 IssuingTransactionPurchaseDetailsFuelUnitLiter IssuingTransactionPurchaseDetailsFuelUnit = "liter" 29 IssuingTransactionPurchaseDetailsFuelUnitUSGallon IssuingTransactionPurchaseDetailsFuelUnit = "us_gallon" 30 ) 31 32 // The nature of the transaction. 33 type IssuingTransactionType string 34 35 // List of values that IssuingTransactionType can take 36 const ( 37 IssuingTransactionTypeCapture IssuingTransactionType = "capture" 38 IssuingTransactionTypeRefund IssuingTransactionType = "refund" 39 ) 40 41 // The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. 42 type IssuingTransactionWallet string 43 44 // List of values that IssuingTransactionWallet can take 45 const ( 46 IssuingTransactionWalletApplePay IssuingTransactionWallet = "apple_pay" 47 IssuingTransactionWalletGooglePay IssuingTransactionWallet = "google_pay" 48 IssuingTransactionWalletSamsungPay IssuingTransactionWallet = "samsung_pay" 49 ) 50 51 // Returns a list of Issuing Transaction objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. 52 type IssuingTransactionListParams struct { 53 ListParams `form:"*"` 54 // Only return transactions that belong to the given card. 55 Card *string `form:"card"` 56 // Only return transactions that belong to the given cardholder. 57 Cardholder *string `form:"cardholder"` 58 // Only return transactions that were created during the given date interval. 59 Created *int64 `form:"created"` 60 // Only return transactions that were created during the given date interval. 61 CreatedRange *RangeQueryParams `form:"created"` 62 // Specifies which fields in the response should be expanded. 63 Expand []*string `form:"expand"` 64 // Only return transactions that have the given type. One of `capture` or `refund`. 65 Type *string `form:"type"` 66 } 67 68 // AddExpand appends a new field to expand. 69 func (p *IssuingTransactionListParams) AddExpand(f string) { 70 p.Expand = append(p.Expand, &f) 71 } 72 73 // Retrieves an Issuing Transaction object. 74 type IssuingTransactionParams struct { 75 Params `form:"*"` 76 // Specifies which fields in the response should be expanded. 77 Expand []*string `form:"expand"` 78 // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. 79 Metadata map[string]string `form:"metadata"` 80 } 81 82 // AddExpand appends a new field to expand. 83 func (p *IssuingTransactionParams) AddExpand(f string) { 84 p.Expand = append(p.Expand, &f) 85 } 86 87 // AddMetadata adds a new key-value pair to the Metadata. 88 func (p *IssuingTransactionParams) AddMetadata(key string, value string) { 89 if p.Metadata == nil { 90 p.Metadata = make(map[string]string) 91 } 92 93 p.Metadata[key] = value 94 } 95 96 // Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). 97 type IssuingTransactionAmountDetails struct { 98 // The fee charged by the ATM for the cash withdrawal. 99 ATMFee int64 `json:"atm_fee"` 100 // The amount of cash requested by the cardholder. 101 CashbackAmount int64 `json:"cashback_amount"` 102 } 103 104 // Details about the transaction, such as processing dates, set by the card network. 105 type IssuingTransactionNetworkData struct { 106 // A code created by Stripe which is shared with the merchant to validate the authorization. This field will be populated if the authorization message was approved. The code typically starts with the letter "S", followed by a six-digit number. For example, "S498162". Please note that the code is not guaranteed to be unique across authorizations. 107 AuthorizationCode string `json:"authorization_code"` 108 // The date the transaction was processed by the card network. This can be different from the date the seller recorded the transaction depending on when the acquirer submits the transaction to the network. 109 ProcessingDate string `json:"processing_date"` 110 // Unique identifier for the authorization assigned by the card network used to match subsequent messages, disputes, and transactions. 111 TransactionID string `json:"transaction_id"` 112 } 113 114 // The legs of the trip. 115 type IssuingTransactionPurchaseDetailsFlightSegment struct { 116 // The three-letter IATA airport code of the flight's destination. 117 ArrivalAirportCode string `json:"arrival_airport_code"` 118 // The airline carrier code. 119 Carrier string `json:"carrier"` 120 // The three-letter IATA airport code that the flight departed from. 121 DepartureAirportCode string `json:"departure_airport_code"` 122 // The flight number. 123 FlightNumber string `json:"flight_number"` 124 // The flight's service class. 125 ServiceClass string `json:"service_class"` 126 // Whether a stopover is allowed on this flight. 127 StopoverAllowed bool `json:"stopover_allowed"` 128 } 129 130 // Information about the flight that was purchased with this transaction. 131 type IssuingTransactionPurchaseDetailsFlight struct { 132 // The time that the flight departed. 133 DepartureAt int64 `json:"departure_at"` 134 // The name of the passenger. 135 PassengerName string `json:"passenger_name"` 136 // Whether the ticket is refundable. 137 Refundable bool `json:"refundable"` 138 // The legs of the trip. 139 Segments []*IssuingTransactionPurchaseDetailsFlightSegment `json:"segments"` 140 // The travel agency that issued the ticket. 141 TravelAgency string `json:"travel_agency"` 142 } 143 144 // Information about fuel that was purchased with this transaction. 145 type IssuingTransactionPurchaseDetailsFuel struct { 146 // The type of fuel that was purchased. One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. 147 Type IssuingTransactionPurchaseDetailsFuelType `json:"type"` 148 // The units for `volume_decimal`. One of `us_gallon` or `liter`. 149 Unit IssuingTransactionPurchaseDetailsFuelUnit `json:"unit"` 150 // The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. 151 UnitCostDecimal float64 `json:"unit_cost_decimal,string"` 152 // The volume of the fuel that was pumped, represented as a decimal string with at most 12 decimal places. 153 VolumeDecimal float64 `json:"volume_decimal,string"` 154 } 155 156 // Information about lodging that was purchased with this transaction. 157 type IssuingTransactionPurchaseDetailsLodging struct { 158 // The time of checking into the lodging. 159 CheckInAt int64 `json:"check_in_at"` 160 // The number of nights stayed at the lodging. 161 Nights int64 `json:"nights"` 162 } 163 164 // The line items in the purchase. 165 type IssuingTransactionPurchaseDetailsReceipt struct { 166 // The description of the item. The maximum length of this field is 26 characters. 167 Description string `json:"description"` 168 // The quantity of the item. 169 Quantity float64 `json:"quantity"` 170 // The total for this line item in cents. 171 Total int64 `json:"total"` 172 // The unit cost of the item in cents. 173 UnitCost int64 `json:"unit_cost"` 174 } 175 176 // Additional purchase information that is optionally provided by the merchant. 177 type IssuingTransactionPurchaseDetails struct { 178 // Information about the flight that was purchased with this transaction. 179 Flight *IssuingTransactionPurchaseDetailsFlight `json:"flight"` 180 // Information about fuel that was purchased with this transaction. 181 Fuel *IssuingTransactionPurchaseDetailsFuel `json:"fuel"` 182 // Information about lodging that was purchased with this transaction. 183 Lodging *IssuingTransactionPurchaseDetailsLodging `json:"lodging"` 184 // The line items in the purchase. 185 Receipt []*IssuingTransactionPurchaseDetailsReceipt `json:"receipt"` 186 // A merchant-specific order number. 187 Reference string `json:"reference"` 188 } 189 190 // [Treasury](https://stripe.com/docs/api/treasury) details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts 191 type IssuingTransactionTreasury struct { 192 // The Treasury [ReceivedCredit](https://stripe.com/docs/api/treasury/received_credits) representing this Issuing transaction if it is a refund 193 ReceivedCredit string `json:"received_credit"` 194 // The Treasury [ReceivedDebit](https://stripe.com/docs/api/treasury/received_debits) representing this Issuing transaction if it is a capture 195 ReceivedDebit string `json:"received_debit"` 196 } 197 198 // Any use of an [issued card](https://stripe.com/docs/issuing) that results in funds entering or leaving 199 // your Stripe account, such as a completed purchase or refund, is represented by an Issuing 200 // `Transaction` object. 201 // 202 // Related guide: [Issued card transactions](https://stripe.com/docs/issuing/purchases/transactions) 203 type IssuingTransaction struct { 204 APIResource 205 // The transaction amount, which will be reflected in your balance. This amount is in your currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). 206 Amount int64 `json:"amount"` 207 // Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). 208 AmountDetails *IssuingTransactionAmountDetails `json:"amount_details"` 209 // The `Authorization` object that led to this transaction. 210 Authorization *IssuingAuthorization `json:"authorization"` 211 // ID of the [balance transaction](https://stripe.com/docs/api/balance_transactions) associated with this transaction. 212 BalanceTransaction *BalanceTransaction `json:"balance_transaction"` 213 // The card used to make this transaction. 214 Card *IssuingCard `json:"card"` 215 // The cardholder to whom this transaction belongs. 216 Cardholder *IssuingCardholder `json:"cardholder"` 217 // Time at which the object was created. Measured in seconds since the Unix epoch. 218 Created int64 `json:"created"` 219 // 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). 220 Currency Currency `json:"currency"` 221 // If you've disputed the transaction, the ID of the dispute. 222 Dispute *IssuingDispute `json:"dispute"` 223 // Unique identifier for the object. 224 ID string `json:"id"` 225 // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. 226 Livemode bool `json:"livemode"` 227 // The amount that the merchant will receive, denominated in `merchant_currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). It will be different from `amount` if the merchant is taking payment in a different currency. 228 MerchantAmount int64 `json:"merchant_amount"` 229 // The currency with which the merchant is taking payment. 230 MerchantCurrency Currency `json:"merchant_currency"` 231 MerchantData *IssuingAuthorizationMerchantData `json:"merchant_data"` 232 // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. 233 Metadata map[string]string `json:"metadata"` 234 // Details about the transaction, such as processing dates, set by the card network. 235 NetworkData *IssuingTransactionNetworkData `json:"network_data"` 236 // String representing the object's type. Objects of the same type share the same value. 237 Object string `json:"object"` 238 // Additional purchase information that is optionally provided by the merchant. 239 PurchaseDetails *IssuingTransactionPurchaseDetails `json:"purchase_details"` 240 // [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this transaction. If a network token was not used for this transaction, this field will be null. 241 Token *IssuingToken `json:"token"` 242 // [Treasury](https://stripe.com/docs/api/treasury) details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts 243 Treasury *IssuingTransactionTreasury `json:"treasury"` 244 // The nature of the transaction. 245 Type IssuingTransactionType `json:"type"` 246 // The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. 247 Wallet IssuingTransactionWallet `json:"wallet"` 248 } 249 250 // IssuingTransactionList is a list of Transactions as retrieved from a list endpoint. 251 type IssuingTransactionList struct { 252 APIResource 253 ListMeta 254 Data []*IssuingTransaction `json:"data"` 255 } 256 257 // UnmarshalJSON handles deserialization of an IssuingTransaction. 258 // This custom unmarshaling is needed because the resulting 259 // property may be an id or the full struct if it was expanded. 260 func (i *IssuingTransaction) UnmarshalJSON(data []byte) error { 261 if id, ok := ParseID(data); ok { 262 i.ID = id 263 return nil 264 } 265 266 type issuingTransaction IssuingTransaction 267 var v issuingTransaction 268 if err := json.Unmarshal(data, &v); err != nil { 269 return err 270 } 271 272 *i = IssuingTransaction(v) 273 return nil 274 }