Bag Docs
API ReferenceTax

Get a tax quote

Calculates applicable sales tax or VAT for a payment link based on the customer's address. Returns a signed quoteToken that must be passed to the checkout session creation endpoint.

Tax calculation is powered by Numeral. The quote is valid for the duration of the checkout session (30 minutes).

POST
/api/tax/quote

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.justusebag.xyz/api/tax/quote" \  -H "Content-Type: application/json" \  -d '{    "paymentLinkId": "d4e5f6a7-b8c9-4d0e-a1f2-b3c4d5e6f7a8",    "customerAddress": {      "address_line_1": "123 Main St",      "address_city": "San Francisco",      "address_province": "CA",      "address_postal_code": "94105",      "address_country": "US"    }  }'
{
  "status": "success",
  "data": {
    "subtotalCents": 2999,
    "taxCents": 262,
    "totalCents": 3261,
    "calculationId": "calc_7f8e9d0c1b2a3456",
    "quoteToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0YXgiLCJjYWxjIjoiY2FsY18xMjM0In0.abc123"
  }
}
{
  "status": "error",
  "message": "amount: Amount must be a positive number up to 999,999,999.99; network: Invalid enum value",
  "code": "BAD_REQUEST"
}
{
  "status": "error",
  "message": "Tax calculation timed out. Please retry.",
  "code": "TIMEOUT"
}