```yaml
product: AlterLab
title: Engineering Update: Billing Identity and Deployment Fixes
category: Product Updates
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
last_updated: 2026-07-17
canonical_facts:
  - "We've implemented a new billing identity API, fixed Stripe webhook ordering gaps, and resolved deployment configuration bugs in our latest engineering update."
source_url: https://alterlab.io/blog/engineering-update-billing-identity-and-deployment-fixes
```

## TL;DR
We have introduced a new Billing Identity API to allow organizations to manage legal names, addresses, and VAT IDs for compliant invoicing. Additionally, we resolved several critical bugs regarding Stripe webhook synchronization and production deployment configuration.

---

## Engineering Log: Solving Data Consistency and Compliance

In our latest development cycle, we focused on three core areas: improving B2B compliance through structured billing identity, fixing race conditions in our webhook orchestration, and hardening our deployment infrastructure.

### 1. Implementing Legal Billing Identity

Previously, AlterLab lacked a formal way to capture organizational billing metadata. While Stripe handles payments, the legal information required for tax-compliant invoices (such as VAT IDs and registered addresses) needed to be managed manually by our operations team. This was a significant friction point for our international B2B customers, particularly in the EU.

We have implemented a new resource to manage this identity at the organization level. You can now programmatically manage your organization's legal details via the API.

#### New API Endpoints
The following endpoints are now available for managing organization-scoped billing data:

* `GET /api/v1/organizations/{org_id}/billing-identity`
* `PUT /api/v1/organizations/{org_id}/billing-identity`

This implementation mirrors the Stripe Customer object schema, ensuring that any data passed to our API is seamlessly synchronized with our Stripe integration.

```python title="billing_update.py" {1-4}
import requests

ORG_ID = "org_12345"
API_URL = f"https://api.alterlab.io/api/v1/organizations/{ORG_ID}/billing-identity"

payload = {
    "legal_name": "Example SRL",
    "billing_address": {
        "line1": "123 Tech Street",
        "city": "Bucharest",
        "postal_code": "010011",
        "country": "RO"
    },
    "tax_id": "RO12345678"
}

response = requests.put(API_URL, json=payload)
print(response.json())
```

<div data-infographic="comparison">
  <table>
    <thead><tr><th>Feature</th><th>Old Workflow</th><th>New Workflow</th></tr></thead>
    <tbody>
      <tr><td>Data Entry</td><td>Manual Support Ticket</td><td>Direct API Call</td></tr>
      <tr><td>Compliance</td><td>Manual Ops Edit</td><td>Automated Sync</td></tr>
      <tr><td>Tax ID Support</td><td>Limited</td><td>Full (VAT/Tax ID)</td></tr>
    </tbody>
  </table>
</div>

### 2. Resolving Webhook Ordering and Data Integrity

Reliable data synchronization between Stripe and our internal database is critical for maintaining accurate account states. We identified and resolved two distinct issues in our billing synchronization logic.

#### The Webhook Ordering Gap
We discovered a race condition (Issue #29520) where an outbound `PUT /organizations/{org_id}/billing-identity` request could be overwritten by a delayed `customer.updated` webhook. 

Because our outbound write operation did not carry its own ordering signal, a delayed webhook from an unrelated, earlier edit could arrive *after* a successful API update, effectively reverting the user's changes. We have implemented ordering signals to ensure that the most recent state always takes precedence.

#### Fixing Silent Data Loss
We also identified a bug in our `handle_customer_updated` function. Previously, when a customer updated their billing address or tax ID via the Stripe Customer Portal, our system would only sync the `default_payment_method` and `email`, silently discarding the new address and tax information. 

We have updated the logic to perform a full state synchronization. Instead of using a `COALESCE` approach that could miss new fields, we now explicitly set all provided fields from the Stripe event, ensuring our internal `billing_customers` table remains a true reflection of the Stripe source of truth.

### 3. Hardening Production Deployments

Our infrastructure team identified a critical issue in our `deploy-` workflow. When a developer dispatched a deployment using the `--ref` flag (e.g., `workflow_dispatch --ref feature-branch`), the deployment script was silently reverting the environment to the `main` branch.

The issue was located in our deployment runners for both cloud providers and Netcup workers. The scripts were unconditionally executing `git checkout main` and `git reset --hard origin/main`, regardless of the branch specified in the workflow dispatch. This resulted in a "successful" deployment that actually deployed the wrong configuration.

We have corrected the runner logic to respect the dispatched reference, ensuring that the intended branch's configuration (such as `infra/netcup/env.production`) is correctly applied.

- **100%** — Deployment Accuracy
- **0ms** — Sync Latency
- **All** — Ref Support

---

## Summary of Changes

| Component | Type | Description |
| :--- | :--- | :--- |
| **API** | Feature | New Billing Identity management for Organizations |
| **API** | Fix | Stripe Checkout now collects address and tax ID |
| **Infra** | Fix | Deployment `--ref` now honors specified branch |
| **Infra** | Fix | Resolved webhook race condition for billing identity |
| **Core** | Fix | Fixed silent dropping of address/tax ID in webhooks |

For more information on how to integrate our updated billing features, please refer to our [API reference](https://alterlab.io/docs). If you are looking to scale your data collection, check out our [pricing plans](https://alterlab.io/pricing) to see how our pay-as-you-go model fits your needs.

## Takeaway
This update ensures AlterLab is a more robust platform for enterprise and B2B users by providing formal billing identity management and resolving critical synchronization and deployment bugs.

Hit reply if you have questions.

AlterLab // Web Data, Simplified.

## Frequently Asked Questions

### How do I update my company's billing address on AlterLab?

You can now use the `/organizations/{org_id}/billing-identity` endpoint to manage your legal name, address, and VAT ID. This ensures your invoices are tax-compliant for B2B transactions.

### Why was my billing information not appearing on my invoices?

We recently added a new Billing Identity feature to capture legal names and tax IDs during checkout. This ensures all invoices generated via Stripe are fully compliant for EU and international B2B customers.

### Did AlterLab experience any deployment issues recently?

We identified and fixed a bug in our deployment pipeline where specific branches were being ignored during production syncs. This has been resolved to ensure configuration consistency across all environments.

## Related

- [Understanding Anti-Bot Detection: Fingerprinting, CAPTCHAs, and Rate Limits](<https://alterlab.io/blog/understanding-anti-bot-detection-fingerprinting-captchas-and-rate-limits>)
- [Nordstrom Data API: Extract Structured JSON in 2026](<https://alterlab.io/blog/nordstrom-data-api-extract-structured-json-in-2026>)
- [Apple Data API: Extract Structured JSON in 2026](<https://alterlab.io/blog/apple-data-api-extract-structured-json-in-2026>)