All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.tax.Transaction Maven / Gradle / Ivy

There is a newer version: 28.2.0
Show newest version
// File generated from our OpenAPI spec
package com.stripe.model.tax;

import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.model.HasId;
import com.stripe.model.StripeObject;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.tax.TransactionCreateFromCalculationParams;
import com.stripe.param.tax.TransactionCreateReversalParams;
import com.stripe.param.tax.TransactionListLineItemsParams;
import com.stripe.param.tax.TransactionRetrieveParams;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
 * A Tax Transaction records the tax collected from or refunded to your customer.
 *
 * 

Related guide: Calculate tax in * your custom payment flow */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public class Transaction extends ApiResource implements HasId { /** Time at which the object was created. Measured in seconds since the Unix epoch. */ @SerializedName("created") Long created; /** * Three-letter ISO currency code, * in lowercase. Must be a supported currency. */ @SerializedName("currency") String currency; /** * The ID of an existing Customer used * for the resource. */ @SerializedName("customer") String customer; @SerializedName("customer_details") CustomerDetails customerDetails; /** Unique identifier for the transaction. */ @Getter(onMethod_ = {@Override}) @SerializedName("id") String id; /** The tax collected or refunded, by line item. */ @SerializedName("line_items") TransactionLineItemCollection lineItems; /** * Has the value {@code true} if the object exists in live mode or the value {@code false} if the * object exists in test mode. */ @SerializedName("livemode") Boolean livemode; /** * 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. */ @SerializedName("metadata") Map metadata; /** * String representing the object's type. Objects of the same type share the same value. * *

Equal to {@code tax.transaction}. */ @SerializedName("object") String object; /** A custom unique identifier, such as 'myOrder_123'. */ @SerializedName("reference") String reference; /** If {@code type=reversal}, contains information about what was reversed. */ @SerializedName("reversal") Reversal reversal; /** The shipping cost details for the transaction. */ @SerializedName("shipping_cost") ShippingCost shippingCost; /** Timestamp of date at which the tax rules and rates in effect applies for the calculation. */ @SerializedName("tax_date") Long taxDate; /** * If {@code reversal}, this transaction reverses an earlier transaction. * *

One of {@code reversal}, or {@code transaction}. */ @SerializedName("type") String type; /** Creates a Tax {@code Transaction} from a calculation. */ public static Transaction createFromCalculation(Map params) throws StripeException { return createFromCalculation(params, (RequestOptions) null); } /** Creates a Tax {@code Transaction} from a calculation. */ public static Transaction createFromCalculation( Map params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl( Stripe.getApiBase(), options, "/v1/tax/transactions/create_from_calculation"); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, Transaction.class, options); } /** Creates a Tax {@code Transaction} from a calculation. */ public static Transaction createFromCalculation(TransactionCreateFromCalculationParams params) throws StripeException { return createFromCalculation(params, (RequestOptions) null); } /** Creates a Tax {@code Transaction} from a calculation. */ public static Transaction createFromCalculation( TransactionCreateFromCalculationParams params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl( Stripe.getApiBase(), options, "/v1/tax/transactions/create_from_calculation"); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, Transaction.class, options); } /** Partially or fully reverses a previously created {@code Transaction}. */ public static Transaction createReversal(Map params) throws StripeException { return createReversal(params, (RequestOptions) null); } /** Partially or fully reverses a previously created {@code Transaction}. */ public static Transaction createReversal(Map params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl(Stripe.getApiBase(), options, "/v1/tax/transactions/create_reversal"); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, Transaction.class, options); } /** Partially or fully reverses a previously created {@code Transaction}. */ public static Transaction createReversal(TransactionCreateReversalParams params) throws StripeException { return createReversal(params, (RequestOptions) null); } /** Partially or fully reverses a previously created {@code Transaction}. */ public static Transaction createReversal( TransactionCreateReversalParams params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl(Stripe.getApiBase(), options, "/v1/tax/transactions/create_reversal"); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, Transaction.class, options); } /** Retrieves the line items of a committed standalone transaction as a collection. */ public TransactionLineItemCollection listLineItems() throws StripeException { return listLineItems((Map) null, (RequestOptions) null); } /** Retrieves the line items of a committed standalone transaction as a collection. */ public TransactionLineItemCollection listLineItems(Map params) throws StripeException { return listLineItems(params, (RequestOptions) null); } /** Retrieves the line items of a committed standalone transaction as a collection. */ public TransactionLineItemCollection listLineItems( Map params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl( Stripe.getApiBase(), options, String.format( "/v1/tax/transactions/%s/line_items", ApiResource.urlEncodeId(this.getId()))); return ApiResource.requestCollection(url, params, TransactionLineItemCollection.class, options); } /** Retrieves the line items of a committed standalone transaction as a collection. */ public TransactionLineItemCollection listLineItems(TransactionListLineItemsParams params) throws StripeException { return listLineItems(params, (RequestOptions) null); } /** Retrieves the line items of a committed standalone transaction as a collection. */ public TransactionLineItemCollection listLineItems( TransactionListLineItemsParams params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl( Stripe.getApiBase(), options, String.format( "/v1/tax/transactions/%s/line_items", ApiResource.urlEncodeId(this.getId()))); return ApiResource.requestCollection(url, params, TransactionLineItemCollection.class, options); } /** Retrieves a Tax {@code Transaction} object. */ public static Transaction retrieve(String transaction) throws StripeException { return retrieve(transaction, (Map) null, (RequestOptions) null); } /** Retrieves a Tax {@code Transaction} object. */ public static Transaction retrieve(String transaction, RequestOptions options) throws StripeException { return retrieve(transaction, (Map) null, options); } /** Retrieves a Tax {@code Transaction} object. */ public static Transaction retrieve( String transaction, Map params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl( Stripe.getApiBase(), options, String.format("/v1/tax/transactions/%s", ApiResource.urlEncodeId(transaction))); return ApiResource.request( ApiResource.RequestMethod.GET, url, params, Transaction.class, options); } /** Retrieves a Tax {@code Transaction} object. */ public static Transaction retrieve( String transaction, TransactionRetrieveParams params, RequestOptions options) throws StripeException { String url = ApiResource.fullUrl( Stripe.getApiBase(), options, String.format("/v1/tax/transactions/%s", ApiResource.urlEncodeId(transaction))); return ApiResource.request( ApiResource.RequestMethod.GET, url, params, Transaction.class, options); } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class CustomerDetails extends StripeObject { /** The customer's postal address (for example, home or business location). */ @SerializedName("address") Address address; /** * The type of customer address provided. * *

One of {@code billing}, or {@code shipping}. */ @SerializedName("address_source") String addressSource; /** The customer's IP address (IPv4 or IPv6). */ @SerializedName("ip_address") String ipAddress; /** The customer's tax IDs (for example, EU VAT numbers). */ @SerializedName("tax_ids") List taxIds; /** * The taxability override used for taxation. * *

One of {@code customer_exempt}, {@code none}, or {@code reverse_charge}. */ @SerializedName("taxability_override") String taxabilityOverride; @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class Address extends StripeObject { /** City, district, suburb, town, or village. */ @SerializedName("city") String city; /** * Two-letter country code (ISO * 3166-1 alpha-2). */ @SerializedName("country") String country; /** Address line 1 (e.g., street, PO Box, or company name). */ @SerializedName("line1") String line1; /** Address line 2 (e.g., apartment, suite, unit, or building). */ @SerializedName("line2") String line2; /** ZIP or postal code. */ @SerializedName("postal_code") String postalCode; /** * State/province as an ISO 3166-2 * subdivision code, without country prefix. Example: "NY" or "TX". */ @SerializedName("state") String state; } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class TaxId extends StripeObject { /** * The type of the tax ID, one of {@code ad_nrt}, {@code ar_cuit}, {@code eu_vat}, {@code * bo_tin}, {@code br_cnpj}, {@code br_cpf}, {@code cn_tin}, {@code co_nit}, {@code cr_tin}, * {@code do_rcn}, {@code ec_ruc}, {@code eu_oss_vat}, {@code pe_ruc}, {@code ro_tin}, {@code * rs_pib}, {@code sv_nit}, {@code uy_ruc}, {@code ve_rif}, {@code vn_tin}, {@code gb_vat}, * {@code nz_gst}, {@code au_abn}, {@code au_arn}, {@code in_gst}, {@code no_vat}, {@code * za_vat}, {@code ch_vat}, {@code mx_rfc}, {@code sg_uen}, {@code ru_inn}, {@code ru_kpp}, * {@code ca_bn}, {@code hk_br}, {@code es_cif}, {@code tw_vat}, {@code th_vat}, {@code * jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code li_uid}, {@code my_itn}, {@code us_ein}, * {@code kr_brn}, {@code ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, * {@code ca_pst_sk}, {@code my_sst}, {@code sg_gst}, {@code ae_trn}, {@code cl_tin}, {@code * sa_vat}, {@code id_npwp}, {@code my_frp}, {@code il_vat}, {@code ge_vat}, {@code ua_vat}, * {@code is_vat}, {@code bg_uic}, {@code hu_tin}, {@code si_tin}, {@code ke_pin}, {@code * tr_tin}, {@code eg_tin}, {@code ph_tin}, or {@code unknown}. */ @SerializedName("type") String type; /** The value of the tax ID. */ @SerializedName("value") String value; } } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class Reversal extends StripeObject { /** The {@code id} of the reversed {@code Transaction} object. */ @SerializedName("original_transaction") String originalTransaction; } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class ShippingCost extends StripeObject { /** * The shipping amount in integer cents. If {@code tax_behavior=inclusive}, then this amount * includes taxes. Otherwise, taxes were calculated on top of this amount. */ @SerializedName("amount") Long amount; /** The amount of tax calculated for shipping, in integer cents. */ @SerializedName("amount_tax") Long amountTax; /** * The ID of an existing ShippingRate. */ @SerializedName("shipping_rate") String shippingRate; /** * Specifies whether the {@code amount} includes taxes. If {@code tax_behavior=inclusive}, then * the amount includes taxes. * *

One of {@code exclusive}, or {@code inclusive}. */ @SerializedName("tax_behavior") String taxBehavior; /** * Detailed account of taxes relevant to shipping cost. (It is not populated for the transaction * resource object and will be removed in the next API version.) */ @SerializedName("tax_breakdown") List taxBreakdown; /** * The tax code ID used for shipping. */ @SerializedName("tax_code") String taxCode; @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class TaxBreakdown extends StripeObject { /** The amount of tax, in integer cents. */ @SerializedName("amount") Long amount; @SerializedName("jurisdiction") Jurisdiction jurisdiction; /** * Indicates whether the jurisdiction was determined by the origin (merchant's address) or * destination (customer's address). * *

One of {@code destination}, or {@code origin}. */ @SerializedName("sourcing") String sourcing; /** * Details regarding the rate for this tax. This field will be {@code null} when the tax is * not imposed, for example if the product is exempt from tax. */ @SerializedName("tax_rate_details") TaxRateDetails taxRateDetails; /** * The reasoning behind this tax, for example, if the product is tax exempt. The possible * values for this field may be extended as new tax rules are supported. * *

One of {@code customer_exempt}, {@code not_collecting}, {@code not_subject_to_tax}, * {@code not_supported}, {@code portion_product_exempt}, {@code portion_reduced_rated}, * {@code portion_standard_rated}, {@code product_exempt}, {@code product_exempt_holiday}, * {@code proportionally_rated}, {@code reduced_rated}, {@code reverse_charge}, {@code * standard_rated}, {@code taxable_basis_reduced}, or {@code zero_rated}. */ @SerializedName("taxability_reason") String taxabilityReason; /** The amount on which tax is calculated, in integer cents. */ @SerializedName("taxable_amount") Long taxableAmount; @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class Jurisdiction extends StripeObject { /** * Two-letter country code (ISO * 3166-1 alpha-2). */ @SerializedName("country") String country; /** A human-readable name for the jurisdiction imposing the tax. */ @SerializedName("display_name") String displayName; /** * Indicates the level of the jurisdiction imposing the tax. * *

One of {@code city}, {@code country}, {@code county}, {@code district}, or {@code * state}. */ @SerializedName("level") String level; /** * ISO 3166-2 subdivision code, * without country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") String state; } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class TaxRateDetails extends StripeObject { /** * A localized display name for tax type, intended to be human-readable. For example, * "Local Sales and Use Tax", "Value-added tax (VAT)", or * "Umsatzsteuer (USt.)". */ @SerializedName("display_name") String displayName; /** * The tax rate percentage as a string. For example, 8.5% is represented as "8.5". */ @SerializedName("percentage_decimal") String percentageDecimal; /** * The tax type, such as {@code vat} or {@code sales_tax}. * *

One of {@code amusement_tax}, {@code communications_tax}, {@code gst}, {@code hst}, * {@code igst}, {@code jct}, {@code lease_tax}, {@code pst}, {@code qst}, {@code rst}, * {@code sales_tax}, or {@code vat}. */ @SerializedName("tax_type") String taxType; } } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy