Add tax to a Stripe invoice
Calculate and write tax to a draft Stripe invoice.
Calculates tax for a draft Stripe invoice and writes it onto the invoice's line items, replacing the sequence of Stripe calls you would otherwise make yourself. Hold the draft (auto_advance: false) before calling, and finalize it once this returns. Safe to retry: an invoice that already carries the same calculation comes back as unchanged.
Request body for adding Sphere tax to a Stripe invoice.
nullThe outcome of a tax write. Amounts are deliberately absent: the tax is on the Stripe invoice, and finalizing it returns the updated totals.
nullValidation error, keyed by the failing field.
Missing, invalid, or inactive API key; the key is not on a Stripe connection enabled for Sphere tax calculation; or stripe_account_id does not match the key's account.
No such invoice on the key's Stripe account.
The invoice's current state rules out a tax write — it is no longer a draft, it has Stripe automatic tax or tax rates set, or it has no address to calculate from.
Rate limit exceeded. Carries Retry-After and RateLimit-* headers.
POST /v1/stripe/calculate_invoice_tax HTTP/1.1
Host: api.getsphere.com
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 49
{
"external_id": "text",
"stripe_account_id": "text"
}{
"external_id": "text",
"stripe_account_id": "text",
"status": "applied",
"reason": "text",
"calculation_id": "text"
}Last updated
Was this helpful?