SIGN IN SIGN UP

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

0 0 83 Python

feat(billing): enable Stripe automatic tax on checkout sessions (#13058)

## Summary

Enables Stripe Tax automatic calculation on both the subscription
upgrade and credit top-up checkout sessions.

## Changes

**File:** `autogpt_platform/backend/backend/data/credit.py`

Added three parameters to both `stripe.checkout.Session.create` calls:

```python
automatic_tax={enabled: True},
billing_address_collection=auto,
customer_update={address: auto},
```

**Affected functions:**
- `create_subscription_checkout()` — "Upgrade to Max" / plan upgrade
flow
- `top_up_intent()` — "Add credits" top-up flow

## Why each parameter

| Parameter | Reason |
|---|---|
| `automatic_tax` | Activates Stripe Tax calculation at checkout |
| `billing_address_collection="auto"` | Collects country + postcode
(minimum required for tax rate lookup) |
| `customer_update={"address": "auto"}` | Saves address back to Stripe
Customer so repeat checkouts don't re-prompt |

## Prerequisites (Stripe Dashboard — before deploying)

1. Enable Stripe Tax: Dashboard → Tax → Enable
2. Set a default tax code on each product (e.g. `txcd_10000001` for
SaaS)
3. Set default tax behavior (`exclusive` or `inclusive`)
4. Register at least one tax nexus jurisdiction

## Testing

- Checkout in test mode with a US address (e.g. California) → should
show sales tax line item
- Checkout with a UK address → should show VAT
- Returning customer with saved address → should not be re-prompted for
address

Co-authored-by: Toran Bruce Richards <22963551+Torantulino@users.noreply.github.com>
T
Toran Bruce Richards committed
16ceb0917c61dbb544bfeab03b75a6623379287e
Parent: 8fd93ba
Committed by GitHub <noreply@github.com> on 5/8/2026, 2:52:49 PM