Class Calculation

All Implemented Interfaces:
HasId, StripeActiveObject, StripeObjectInterface

public class Calculation extends ApiResource implements HasId
A Tax Calculation allows you to calculate the tax to collect from your customer.

Related guide: Calculate tax in your custom payment flow

  • Constructor Details

    • Calculation

      public Calculation()
  • Method Details

    • create

      public static Calculation create(Map<String,Object> params) throws StripeException
      Calculates tax based on the input and returns a Tax Calculation object.
      Throws:
      StripeException
    • create

      public static Calculation create(Map<String,Object> params, RequestOptions options) throws StripeException
      Calculates tax based on the input and returns a Tax Calculation object.
      Throws:
      StripeException
    • create

      public static Calculation create(CalculationCreateParams params) throws StripeException
      Calculates tax based on the input and returns a Tax Calculation object.
      Throws:
      StripeException
    • create

      public static Calculation create(CalculationCreateParams params, RequestOptions options) throws StripeException
      Calculates tax based on the input and returns a Tax Calculation object.
      Throws:
      StripeException
    • listLineItems

      public CalculationLineItemCollection listLineItems() throws StripeException
      Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
      Throws:
      StripeException
    • listLineItems

      public CalculationLineItemCollection listLineItems(Map<String,Object> params) throws StripeException
      Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
      Throws:
      StripeException
    • listLineItems

      public CalculationLineItemCollection listLineItems(Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
      Throws:
      StripeException
    • listLineItems

      Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
      Throws:
      StripeException
    • listLineItems

      Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
      Throws:
      StripeException
    • setResponseGetter

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

      One of amusement_tax, communications_tax, gst, hst, igst, jct, lease_tax, pst, qst, rst, sales_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.
    • getAmountTotal

      public Long getAmountTotal()
      Total after taxes.
    • 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 Calculation.CustomerDetails getCustomerDetails()
    • getExpiresAt

      public Long getExpiresAt()
      Timestamp of date at which the tax calculation will expire.
    • getLineItems

      public CalculationLineItemCollection getLineItems()
      The list of items the customer is purchasing.
    • getLivemode

      public Boolean getLivemode()
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • getObject

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

      Equal to tax.calculation.

    • getShipFromDetails

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

      public Calculation.ShippingCost getShippingCost()
      The shipping cost details for the calculation.
    • getTaxAmountExclusive

      public Long getTaxAmountExclusive()
      The amount of tax to be collected on top of the line item prices.
    • getTaxAmountInclusive

      public Long getTaxAmountInclusive()
      The amount of tax already included in the line item prices.
    • getTaxBreakdown

      public List<Calculation.TaxBreakdown> getTaxBreakdown()
      Breakdown of individual tax amounts that add up to the total.
    • getTaxDate

      public Long getTaxDate()
      Timestamp of date at which the tax rules and rates in effect applies for the calculation.
    • setAmountTotal

      public void setAmountTotal(Long amountTotal)
      Total after taxes.
    • 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(Calculation.CustomerDetails customerDetails)
    • setExpiresAt

      public void setExpiresAt(Long expiresAt)
      Timestamp of date at which the tax calculation will expire.
    • setId

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

      public void setLineItems(CalculationLineItemCollection lineItems)
      The list of items the customer is purchasing.
    • setLivemode

      public void setLivemode(Boolean livemode)
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • setObject

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

      Equal to tax.calculation.

    • setShipFromDetails

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

      public void setShippingCost(Calculation.ShippingCost shippingCost)
      The shipping cost details for the calculation.
    • setTaxAmountExclusive

      public void setTaxAmountExclusive(Long taxAmountExclusive)
      The amount of tax to be collected on top of the line item prices.
    • setTaxAmountInclusive

      public void setTaxAmountInclusive(Long taxAmountInclusive)
      The amount of tax already included in the line item prices.
    • setTaxBreakdown

      public void setTaxBreakdown(List<Calculation.TaxBreakdown> taxBreakdown)
      Breakdown of individual tax amounts that add up to the total.
    • setTaxDate

      public void setTaxDate(Long taxDate)
      Timestamp of date at which the tax rules and rates in effect applies for the calculation.
    • 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 calculation.
      Specified by:
      getId in interface HasId