Variants

Deprecated. Quote tax with POST /payment_quotes instead. Previews tax for a variant before checkout, based on the buyer's location.

post/variants/{id}/calculate_tax

Request

  • Base URL
    https://api.whop.com/api/v1
  • Auth
    HTTP bearer

Path parameters

id, string required

Variant ID, prefixed plan_.

Headers

Idempotency-Key, string
Example:d9105228-4a08-46b1-8b91-42fed586d383

A unique key that makes this request safe to retry. See Idempotent requests.

Request body

object required
address, object nullable

Buyer billing address used for tax calculation. Provide either address.country or ip_address; include state and postal code when available for more accurate results.

ip_address, string

Buyer IP address used to infer location when no billing address is provided.

tax_ids, object[] nullable

Optional buyer tax ID for B2B exemptions. At most one entry is supported.

Example request

{
  "address": {
    "country": "DE",
    "postal_code": "10115"
  }
}

Response

tax calculated

object required
currency, string required

Three-letter ISO 4217 currency code for the returned amounts.

status, 'calculated' | 'not_calculated' required

Whether Whop calculated tax for this preview. not_calculated means no tax could be determined, so tax_amount is 0 and total equals subtotal.

subtotal, integer required

Variant price in the currency's smallest unit, for example cents. For exclusive tax, this is the pre-tax amount; for inclusive tax, it already includes tax and equals the total.

tax_amount, integer required

Calculated tax amount in the currency's smallest unit. For exclusive tax, this is added on top of the subtotal; for inclusive tax, it is the portion of the subtotal that is tax.

tax_behavior, 'exclusive' | 'inclusive' required

Whether tax is added on top of the variant price or already included in it for this buyer's location.

total, integer required

Amount the buyer would pay in the currency's smallest unit.

Example response

{
  "currency": "usd",
  "status": "calculated",
  "subtotal": 1000,
  "tax_amount": 70,
  "tax_behavior": "exclusive",
  "total": 1070
}

Changes