Class Transaction

All Implemented Interfaces:
HasId, StripeActiveObject, StripeObjectInterface

public class Transaction extends ApiResource implements HasId
A Tax Transaction records the tax collected from or refunded to your customer.

Related guide: Calculate tax in your custom payment flow

  • Constructor Details

    • Transaction

      public Transaction()
  • Method Details

    • createFromCalculation

      public static Transaction createFromCalculation(Map<String,Object> params) throws StripeException
      Creates a Tax Transaction from a calculation, if that calculation hasn’t expired. Calculations expire after 90 days.
      Throws:
      StripeException
    • createFromCalculation

      public static Transaction createFromCalculation(Map<String,Object> params, RequestOptions options) throws StripeException
      Creates a Tax Transaction from a calculation, if that calculation hasn’t expired. Calculations expire after 90 days.
      Throws:
      StripeException
    • createFromCalculation

      public static Transaction createFromCalculation(TransactionCreateFromCalculationParams params) throws StripeException
      Creates a Tax Transaction from a calculation, if that calculation hasn’t expired. Calculations expire after 90 days.
      Throws:
      StripeException
    • createFromCalculation

      public static Transaction createFromCalculation(TransactionCreateFromCalculationParams params, RequestOptions options) throws StripeException
      Creates a Tax Transaction from a calculation, if that calculation hasn’t expired. Calculations expire after 90 days.
      Throws:
      StripeException
    • createReversal

      public static Transaction createReversal(Map<String,Object> params) throws StripeException
      Partially or fully reverses a previously created Transaction.
      Throws:
      StripeException
    • createReversal

      public static Transaction createReversal(Map<String,Object> params, RequestOptions options) throws StripeException
      Partially or fully reverses a previously created Transaction.
      Throws:
      StripeException
    • createReversal

      public static Transaction createReversal(TransactionCreateReversalParams params) throws StripeException
      Partially or fully reverses a previously created Transaction.
      Throws:
      StripeException
    • createReversal

      public static Transaction createReversal(TransactionCreateReversalParams params, RequestOptions options) throws StripeException
      Partially or fully reverses a previously created Transaction.
      Throws:
      StripeException
    • listLineItems

      public TransactionLineItemCollection listLineItems() throws StripeException
      Retrieves the line items of a committed standalone transaction as a collection.
      Throws:
      StripeException
    • listLineItems

      public TransactionLineItemCollection listLineItems(Map<String,Object> params) throws StripeException
      Retrieves the line items of a committed standalone transaction as a collection.
      Throws:
      StripeException
    • listLineItems

      public TransactionLineItemCollection listLineItems(Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the line items of a committed standalone transaction as a collection.
      Throws:
      StripeException
    • listLineItems

      Retrieves the line items of a committed standalone transaction as a collection.
      Throws:
      StripeException
    • listLineItems

      Retrieves the line items of a committed standalone transaction as a collection.
      Throws:
      StripeException
    • retrieve

      public static Transaction retrieve(String transaction) throws StripeException
      Retrieves a Tax Transaction object.
      Throws:
      StripeException
    • retrieve

      public static Transaction retrieve(String transaction, RequestOptions options) throws StripeException
      Retrieves a Tax Transaction object.
      Throws:
      StripeException
    • retrieve

      public static Transaction retrieve(String transaction, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves a Tax Transaction object.
      Throws:
      StripeException
    • retrieve

      public static Transaction retrieve(String transaction, TransactionRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves a Tax Transaction object.
      Throws:
      StripeException
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      The tax type, such as vat or sales_tax.

      One of admissions_tax, amusement_tax, attendance_tax, communications_tax, digital_excise_tax, entertainment_tax, gross_receipts_tax, gst, hospitality_tax, hst, igst, jct, lease_tax, luxury_tax, mass_transit_parking_tax, parking_tax, pst, qst, recycling_fee, resort_tax, retail_delivery_fee, rst, sales_tax, service_tax, tourism_tax, utility_users_tax, or vat.

      Specified by:
      setResponseGetter in interface StripeActiveObject
      Overrides:
      setResponseGetter in class ApiResource
      Parameters:
      responseGetter - the StripeResponseGetter instance to use for making further requests.
    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getCurrency

      public String getCurrency()
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • getCustomer

      public String getCustomer()
      The ID of an existing Customer used for the resource.
    • getCustomerDetails

      public Transaction.CustomerDetails getCustomerDetails()
    • getLineItems

      public TransactionLineItemCollection getLineItems()
      The tax collected or refunded, by line item.
    • getLivemode

      public Boolean getLivemode()
      If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to tax.transaction.

    • getPostedAt

      public Long getPostedAt()
      The Unix timestamp representing when the tax liability is assumed or reduced.
    • getReference

      public String getReference()
      A custom unique identifier, such as 'myOrder_123'.
    • getReversal

      public Transaction.Reversal getReversal()
      If type=reversal, contains information about what was reversed.
    • getShipFromDetails

      public Transaction.ShipFromDetails getShipFromDetails()
      The details of the ship from location, such as the address.
    • getShippingCost

      public Transaction.ShippingCost getShippingCost()
      The shipping cost details for the transaction.
    • getTaxDate

      public Long getTaxDate()
      The calculation uses the tax rules and rates that are in effect at this timestamp. You can use a date up to 31 days in the past or up to 31 days in the future. If you use a future date, Stripe doesn't guarantee that the expected tax rules and rate being used match the actual rules and rate that will be in effect on that date. We deploy tax changes before their effective date, but not within a fixed window.
    • getType

      public String getType()
      If reversal, this transaction reverses an earlier transaction.

      One of reversal, or transaction.

    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setCurrency

      public void setCurrency(String currency)
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • setCustomer

      public void setCustomer(String customer)
      The ID of an existing Customer used for the resource.
    • setCustomerDetails

      public void setCustomerDetails(Transaction.CustomerDetails customerDetails)
    • setId

      public void setId(String id)
      Unique identifier for the transaction.
    • setLineItems

      public void setLineItems(TransactionLineItemCollection lineItems)
      The tax collected or refunded, by line item.
    • setLivemode

      public void setLivemode(Boolean livemode)
      If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to tax.transaction.

    • setPostedAt

      public void setPostedAt(Long postedAt)
      The Unix timestamp representing when the tax liability is assumed or reduced.
    • setReference

      public void setReference(String reference)
      A custom unique identifier, such as 'myOrder_123'.
    • setReversal

      public void setReversal(Transaction.Reversal reversal)
      If type=reversal, contains information about what was reversed.
    • setShipFromDetails

      public void setShipFromDetails(Transaction.ShipFromDetails shipFromDetails)
      The details of the ship from location, such as the address.
    • setShippingCost

      public void setShippingCost(Transaction.ShippingCost shippingCost)
      The shipping cost details for the transaction.
    • setTaxDate

      public void setTaxDate(Long taxDate)
      The calculation uses the tax rules and rates that are in effect at this timestamp. You can use a date up to 31 days in the past or up to 31 days in the future. If you use a future date, Stripe doesn't guarantee that the expected tax rules and rate being used match the actual rules and rate that will be in effect on that date. We deploy tax changes before their effective date, but not within a fixed window.
    • setType

      public void setType(String type)
      If reversal, this transaction reverses an earlier transaction.

      One of reversal, or transaction.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the transaction.
      Specified by:
      getId in interface HasId