CalculateTax

POST/billing/v1/tax/calculate

Request Body

required
application/json
{
  "$ref": "#/components/schemas/billing.v1.CalculateTaxRequest",
  "$ref-value": {
    "type": "object",
    "properties": {
      "org_id": {
        "type": "string",
        "examples": [
          "OR98234j23"
        ],
        "title": "org_id"
      },
      "plan_id": {
        "type": "string",
        "examples": [
          "Mn0bVc9xZ8"
        ],
        "title": "plan_id",
        "minLength": 1
      },
      "plan_name": {
        "type": "string",
        "examples": [
          "Pro"
        ],
        "title": "plan_name",
        "maxLength": 64,
        "minLength": 1
      },
      "amount": {
        "exclusiveMinimum": 0,
        "type": "number",
        "examples": [
          "29.99"
        ],
        "title": "amount",
        "format": "double"
      },
      "currency": {
        "type": "string",
        "examples": [
          "usd"
        ],
        "title": "currency",
        "minLength": 1
      },
      "billing_cycle": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingCycle",
            "$ref-value": {
              "type": "string",
              "title": "BillingCycle",
              "enum": [
                "BILLING_CYCLE_UNSPECIFIED",
                "BILLING_CYCLE_MONTHLY",
                "BILLING_CYCLE_YEARLY"
              ]
            }
          }
        ],
        "examples": [
          "BILLING_CYCLE_MONTHLY"
        ],
        "title": "billing_cycle"
      },
      "interval_count": {
        "type": "string",
        "examples": [
          "5"
        ],
        "title": "interval_count",
        "format": "int64"
      },
      "billing_address": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingAddress",
            "$ref-value": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "examples": [
                    "Jane Doe"
                  ],
                  "title": "name",
                  "minLength": 1
                },
                "line1": {
                  "type": "string",
                  "examples": [
                    "123 Main St"
                  ],
                  "title": "line1",
                  "minLength": 1
                },
                "line2": {
                  "type": "string",
                  "examples": [
                    "Apt 4B"
                  ],
                  "title": "line2"
                },
                "city": {
                  "type": "string",
                  "examples": [
                    "San Francisco"
                  ],
                  "title": "city",
                  "minLength": 1
                },
                "state": {
                  "type": "string",
                  "examples": [
                    "CA"
                  ],
                  "title": "state",
                  "minLength": 1
                },
                "postal_code": {
                  "type": "string",
                  "examples": [
                    "94105"
                  ],
                  "title": "postal_code",
                  "minLength": 1
                },
                "country": {
                  "type": "string",
                  "examples": [
                    "US"
                  ],
                  "title": "country",
                  "minLength": 1
                },
                "phone": {
                  "type": "string",
                  "examples": [
                    "+15551234567"
                  ],
                  "title": "phone"
                },
                "email": {
                  "type": "string",
                  "examples": [
                    "billing@example.com"
                  ],
                  "title": "email",
                  "format": "email"
                }
              },
              "title": "BillingAddress",
              "required": [
                "name",
                "line1",
                "city",
                "state",
                "postal_code",
                "country"
              ],
              "additionalProperties": false
            }
          }
        ],
        "title": "billing_address"
      },
      "line_items": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/billing.v1.TaxLineItem",
          "$ref-value": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "string",
                "examples": [
                  "2999"
                ],
                "title": "amount",
                "format": "int64"
              },
              "reference": {
                "type": "string",
                "title": "reference"
              },
              "tax_code": {
                "type": "string",
                "title": "tax_code"
              }
            },
            "title": "TaxLineItem",
            "additionalProperties": false
          }
        },
        "title": "line_items"
      },
      "metadata": {
        "type": "object",
        "title": "metadata",
        "additionalProperties": {
          "type": "string",
          "title": "value"
        }
      }
    },
    "title": "CalculateTaxRequest",
    "required": [
      "plan_id",
      "plan_name",
      "currency"
    ],
    "additionalProperties": false
  }
}

Response Body

200application/json

Success

type: unknown

{
  "$ref": "#/components/schemas/billing.v1.PlanTaxCalculationResponse",
  "$ref-value": {
    "type": "object",
    "properties": {
      "calculation_id": {
        "type": "string",
        "title": "calculation_id"
      },
      "plan_id": {
        "type": "string",
        "examples": [
          "Mn0bVc9xZ8"
        ],
        "title": "plan_id"
      },
      "plan_name": {
        "type": "string",
        "examples": [
          "Pro"
        ],
        "title": "plan_name",
        "maxLength": 64
      },
      "billing_cycle": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingCycle",
            "$ref-value": {
              "type": "string",
              "title": "BillingCycle",
              "enum": [
                "BILLING_CYCLE_UNSPECIFIED",
                "BILLING_CYCLE_MONTHLY",
                "BILLING_CYCLE_YEARLY"
              ]
            }
          }
        ],
        "examples": [
          "BILLING_CYCLE_MONTHLY"
        ],
        "title": "billing_cycle"
      },
      "base_amount": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "base_amount",
        "format": "int64"
      },
      "amount_total": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "amount_total",
        "format": "int64"
      },
      "tax_amount_exclusive": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "tax_amount_exclusive",
        "format": "int64"
      },
      "tax_amount_inclusive": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "tax_amount_inclusive",
        "format": "int64"
      },
      "currency": {
        "type": "string",
        "examples": [
          "usd"
        ],
        "title": "currency"
      },
      "tax_percentage": {
        "type": "number",
        "title": "tax_percentage",
        "format": "double"
      },
      "billing_address": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingAddress",
            "$ref-value": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "examples": [
                    "Jane Doe"
                  ],
                  "title": "name",
                  "minLength": 1
                },
                "line1": {
                  "type": "string",
                  "examples": [
                    "123 Main St"
                  ],
                  "title": "line1",
                  "minLength": 1
                },
                "line2": {
                  "type": "string",
                  "examples": [
                    "Apt 4B"
                  ],
                  "title": "line2"
                },
                "city": {
                  "type": "string",
                  "examples": [
                    "San Francisco"
                  ],
                  "title": "city",
                  "minLength": 1
                },
                "state": {
                  "type": "string",
                  "examples": [
                    "CA"
                  ],
                  "title": "state",
                  "minLength": 1
                },
                "postal_code": {
                  "type": "string",
                  "examples": [
                    "94105"
                  ],
                  "title": "postal_code",
                  "minLength": 1
                },
                "country": {
                  "type": "string",
                  "examples": [
                    "US"
                  ],
                  "title": "country",
                  "minLength": 1
                },
                "phone": {
                  "type": "string",
                  "examples": [
                    "+15551234567"
                  ],
                  "title": "phone"
                },
                "email": {
                  "type": "string",
                  "examples": [
                    "billing@example.com"
                  ],
                  "title": "email",
                  "format": "email"
                }
              },
              "title": "BillingAddress",
              "required": [
                "name",
                "line1",
                "city",
                "state",
                "postal_code",
                "country"
              ],
              "additionalProperties": false
            }
          }
        ],
        "title": "billing_address"
      },
      "calculated_at": {
        "allOf": [
          {
            "$ref": "#/components/schemas/google.protobuf.Timestamp",
            "$ref-value": {
              "type": "string",
              "examples": [
                "2023-01-15T01:30:15.01Z",
                "2024-12-25T12:00:00Z"
              ],
              "format": "date-time",
              "description": "A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC."
            }
          }
        ],
        "examples": [
          "2026-01-15T10:30:00Z"
        ],
        "title": "calculated_at"
      }
    },
    "title": "PlanTaxCalculationResponse",
    "additionalProperties": false
  }
}
curl -X POST "https://api.rixl.com/billing/v1/tax/calculate" \
  -H "Content-Type: application/json" \
  -d '{
    "plan_id": "Mn0bVc9xZ8",
    "plan_name": "Pro",
    "currency": "usd"
  }'

Success

application/json

{
  "$ref": "#/components/schemas/billing.v1.PlanTaxCalculationResponse",
  "$ref-value": {
    "type": "object",
    "properties": {
      "calculation_id": {
        "type": "string",
        "title": "calculation_id"
      },
      "plan_id": {
        "type": "string",
        "examples": [
          "Mn0bVc9xZ8"
        ],
        "title": "plan_id"
      },
      "plan_name": {
        "type": "string",
        "examples": [
          "Pro"
        ],
        "title": "plan_name",
        "maxLength": 64
      },
      "billing_cycle": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingCycle",
            "$ref-value": {
              "type": "string",
              "title": "BillingCycle",
              "enum": [
                "BILLING_CYCLE_UNSPECIFIED",
                "BILLING_CYCLE_MONTHLY",
                "BILLING_CYCLE_YEARLY"
              ]
            }
          }
        ],
        "examples": [
          "BILLING_CYCLE_MONTHLY"
        ],
        "title": "billing_cycle"
      },
      "base_amount": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "base_amount",
        "format": "int64"
      },
      "amount_total": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "amount_total",
        "format": "int64"
      },
      "tax_amount_exclusive": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "tax_amount_exclusive",
        "format": "int64"
      },
      "tax_amount_inclusive": {
        "type": "string",
        "examples": [
          "2999"
        ],
        "title": "tax_amount_inclusive",
        "format": "int64"
      },
      "currency": {
        "type": "string",
        "examples": [
          "usd"
        ],
        "title": "currency"
      },
      "tax_percentage": {
        "type": "number",
        "title": "tax_percentage",
        "format": "double"
      },
      "billing_address": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingAddress",
            "$ref-value": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "examples": [
                    "Jane Doe"
                  ],
                  "title": "name",
                  "minLength": 1
                },
                "line1": {
                  "type": "string",
                  "examples": [
                    "123 Main St"
                  ],
                  "title": "line1",
                  "minLength": 1
                },
                "line2": {
                  "type": "string",
                  "examples": [
                    "Apt 4B"
                  ],
                  "title": "line2"
                },
                "city": {
                  "type": "string",
                  "examples": [
                    "San Francisco"
                  ],
                  "title": "city",
                  "minLength": 1
                },
                "state": {
                  "type": "string",
                  "examples": [
                    "CA"
                  ],
                  "title": "state",
                  "minLength": 1
                },
                "postal_code": {
                  "type": "string",
                  "examples": [
                    "94105"
                  ],
                  "title": "postal_code",
                  "minLength": 1
                },
                "country": {
                  "type": "string",
                  "examples": [
                    "US"
                  ],
                  "title": "country",
                  "minLength": 1
                },
                "phone": {
                  "type": "string",
                  "examples": [
                    "+15551234567"
                  ],
                  "title": "phone"
                },
                "email": {
                  "type": "string",
                  "examples": [
                    "billing@example.com"
                  ],
                  "title": "email",
                  "format": "email"
                }
              },
              "title": "BillingAddress",
              "required": [
                "name",
                "line1",
                "city",
                "state",
                "postal_code",
                "country"
              ],
              "additionalProperties": false
            }
          }
        ],
        "title": "billing_address"
      },
      "calculated_at": {
        "allOf": [
          {
            "$ref": "#/components/schemas/google.protobuf.Timestamp",
            "$ref-value": {
              "type": "string",
              "examples": [
                "2023-01-15T01:30:15.01Z",
                "2024-12-25T12:00:00Z"
              ],
              "format": "date-time",
              "description": "A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC."
            }
          }
        ],
        "examples": [
          "2026-01-15T10:30:00Z"
        ],
        "title": "calculated_at"
      }
    },
    "title": "PlanTaxCalculationResponse",
    "additionalProperties": false
  }
}