Billing & Usage

AS2aaS uses account-based billing with tenant limits and overage charges. This enterprise-friendly model provides consolidated billing while maintaining detailed usage tracking and operational efficiency through master partner sharing.

Account-Based Billing

All billing is handled at the account level, providing several advantages:

  • Single Invoice: One consolidated invoice per account instead of per tenant
  • Volume Discounts: Aggregate usage across all tenants for better pricing
  • Master Partner Sharing: Shared trading partners reduce operational overhead
  • Enterprise Budgeting: Simplified procurement and budget management

Pricing Plans

Startup Account - $99/month

  • Up to 3 tenants
  • Up to 10 master partners
  • 5,000 messages per month
  • Email support
  • 14-day trial

Business Account - $299/month

  • Up to 10 tenants
  • Up to 50 master partners
  • 25,000 messages per month
  • Priority support
  • 30-day trial

Enterprise Account - $999/month

  • Unlimited tenants
  • Unlimited master partners
  • 100,000+ messages per month
  • 24/7 phone support
  • 60-day trial

Custom Enterprise

  • Fully negotiated pricing
  • Volume discounts available
  • Multi-year agreements
  • Dedicated account management

Overage Billing

When accounts exceed plan limits, overage charges apply:

PlanTenant OverageMessage OverageStorage Overage
Startup$29/tenant/month$0.05/message$2.00/GB/month
Business$19/tenant/month$0.03/message$1.50/GB/month
EnterpriseIncluded$0.01/message$1.00/GB/month

Subscription Management

Retrieve Account Billing Information

curl -X GET https://api.as2aas.com/v1/accounts/{account}/billing \
  -H "Authorization: Bearer pk_live_your_api_key"

Response:

{
  "customer_id": "cus_enterprise_customer",
  "subscription": {
    "id": "sub_enterprise_plan",
    "status": "active",
    "current_period_start": "2024-01-01T00:00:00Z",
    "current_period_end": "2024-02-01T00:00:00Z",
    "trial_ends_at": null,
    "cancel_at_period_end": false
  },
  "billing_plan": {
    "name": "Enterprise Plan",
    "model": "base_plus_usage",
    "base_fee": 299.00,
    "message_rate": 0.05
  },
  "payment_method": {
    "type": "card",
    "last4": "4242",
    "exp_month": 12,
    "exp_year": 2025
  },
  "has_payment_method": true
}

Account-Based Billing Implementation

AS2aaS implements account-based billing where:

  • Single Billing Entity: Each account represents one billing relationship
  • Consolidated Invoicing: All tenant usage rolls up to the account level
  • Master Partner Efficiency: Shared master partners reduce operational costs
  • Volume Pricing: Aggregate usage across tenants for better pricing tiers

Billing Hierarchy

Account (Billing Entity)
├── Subscription Plan
├── Payment Method
├── Consolidated Invoice
├── Tenants (Usage Sources)
│   ├── Tenant A Messages
│   ├── Tenant B Messages
│   └── Tenant C Messages
└── Master Partners (Shared Costs)
    ├── Certificate Management
    └── Partner Maintenance

Billing Integration

Webhook Events

The platform sends billing-related webhook notifications:

{
  "type": "billing.usage_threshold",
  "data": {
    "account_id": "acc_000001",
    "threshold_type": "monthly_messages",
    "threshold_percentage": 80,
    "current_usage": 80000,
    "plan_limit": 100000,
    "period": "2024-01"
  }
}

Account Billing Webhook Events

EventDescription
billing.usage_thresholdUsage reaches threshold (75%, 90%, 100%)
billing.limit_exceededAccount exceeds plan limits
billing.payment_failedPayment processing failed
billing.subscription_updatedPlan or subscription changed
billing.invoice_generatedNew invoice created

Payment Processing

Failed Payment Handling

{
  "type": "billing.payment_failed",
  "data": {
    "invoice_id": "in_123",
    "amount": 842.00,
    "failure_reason": "insufficient_funds",
    "retry_date": "2024-02-05T00:00:00Z"
  }
}

Payment Success Confirmation

{
  "type": "billing.payment_succeeded", 
  "data": {
    "invoice_id": "in_123",
    "amount_paid": 842.00,
    "payment_method": "card_ending_4242",
    "paid_at": "2024-02-01T08:30:00Z"
  }
}
Real-time Billing
Usage is tracked in real-time and reported to billing systems hourly. This ensures accurate billing without end-of-month surprises.

Cost Management

Usage Monitoring

Implement usage monitoring to control costs:

// Monitor daily usage
async function checkDailyUsage(apiKey) {
  const response = await fetch('https://api.as2aas.com/v1/billing/usage/current', {
    headers: {
      'Authorization': `Bearer ${apiKey}`
    }
  });
  
  const usage = await response.json();
  
  if (usage.usage_to_date.estimated_charges > DAILY_BUDGET_LIMIT) {
    await sendBudgetAlert(usage);
  }
  
  return usage;
}

Cost Allocation

def allocate_costs_by_department(usage_data):
    """Allocate AS2 costs to departments based on partner usage"""
    
    department_mapping = {
        'prt_supplier_001': 'Procurement',
        'prt_supplier_002': 'Procurement', 
        'prt_customer_001': 'Sales',
        'prt_customer_002': 'Sales'
    }
    
    allocation = {}
    
    for partner_usage in usage_data['partner_breakdown']:
        partner_id = partner_usage['partner_id']
        department = department_mapping.get(partner_id, 'Unallocated')
        
        if department not in allocation:
            allocation[department] = {
                'message_count': 0,
                'cost': 0.0
            }
        
        allocation[department]['message_count'] += partner_usage['message_count']
        allocation[department]['cost'] += partner_usage['message_count'] * 0.05
    
    return allocation

Enterprise Reporting

Budget Alerts

{
  "type": "billing.budget_alert",
  "data": {
    "budget_name": "Monthly AS2 Budget",
    "threshold_percentage": 75,
    "current_usage": 1500.00,
    "budget_limit": 2000.00,
    "period_remaining_days": 8
  }
}

Enterprise Integration

ERP System Integration

class ERPBillingIntegration:
    def __init__(self, as2_api_key, erp_config):
        self.as2_client = AS2Client(as2_api_key)
        self.erp_config = erp_config
    
    def sync_monthly_billing(self, year, month):
        """Sync AS2 billing data with ERP system"""
        
        # Get AS2 usage data
        usage_data = self.as2_client.get_monthly_usage(year, month)
        
        # Transform for ERP format
        erp_entries = self.transform_usage_for_erp(usage_data)
        
        # Post to ERP system
        for entry in erp_entries:
            self.post_to_erp(entry)
    
    def transform_usage_for_erp(self, usage_data):
        """Transform AS2 usage data to ERP journal entries"""
        entries = []
        
        for partner_usage in usage_data['partner_breakdown']:
            entries.append({
                'account': '6100-AS2-MESSAGING',
                'department': self.get_partner_department(partner_usage['partner_id']),
                'amount': partner_usage['cost'],
                'description': f"AS2 messaging - {partner_usage['partner_name']}",
                'reference': f"AS2-{usage_data['period']['start'][:7]}"
            })
        
        return entries

Compliance and Auditing

Compliance Support
AS2aaS provides detailed billing records and audit trails to support financial compliance requirements and internal cost allocation processes.

Best Practices

Cost Control

  • Monitor usage patterns and trends regularly
  • Set up budget alerts for proactive cost management
  • Review partner utilization for optimization opportunities
  • Implement department-level cost allocation

Financial Planning

  • Use historical data for accurate budget forecasting
  • Consider annual plans for cost savings
  • Plan for seasonal usage variations
  • Factor in business growth when selecting plans

Integration

  • Integrate billing data with enterprise financial systems
  • Automate monthly reconciliation processes
  • Implement approval workflows for plan changes
  • Maintain audit trails for compliance requirements