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
    • retrieve

      public static Calculation retrieve(String calculation) throws StripeException
      Retrieves a Tax Calculation object, if the calculation hasn’t expired.
      Throws:
      StripeException
    • retrieve

      public static Calculation retrieve(String calculation, RequestOptions options) throws StripeException
      Retrieves a Tax Calculation object, if the calculation hasn’t expired.
      Throws:
      StripeException
    • retrieve

      public static Calculation retrieve(String calculation, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves a Tax Calculation object, if the calculation hasn’t expired.
      Throws:
      StripeException
    • retrieve

      public static Calculation retrieve(String calculation, CalculationRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves a Tax Calculation object, if the calculation hasn’t expired.
      Throws:
      StripeException
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      Three-letter ISO currency code, in lowercase.
      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 amount after taxes in the smallest currency unit.
    • 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()
      If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
    • 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()
      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.
    • setAmountTotal

      public void setAmountTotal(Long amountTotal)
      Total amount after taxes in the smallest currency unit.
    • 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)
      If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
    • 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)
      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.
    • 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