Skip to main content

Overview

Sendook uses usage-based billing powered by Stripe. You only pay for the emails you send and receive.

Pricing Model

Sendook charges based on email usage with no upfront costs or monthly minimums.

What’s Metered

Billing is calculated on:
  • Messages sent - Each outbound email from your inboxes
  • Messages received - Each inbound email to your inboxes
Webhook deliveries, API calls, and dashboard usage are not metered or charged.

Billing Period

Charges are calculated monthly:
  • Billing period - First day to last day of each calendar month
  • Invoice generation - Invoices are created at the end of each billing period
  • Payment - Automatic payment from your saved payment method

Stripe Integration

Sendook is fully integrated with Stripe for secure payment processing.

Setting Up Billing

On Registration When you sign up, Sendook automatically:
  1. Creates a Stripe customer account
  2. Creates a subscription with usage-based pricing
  3. Links your organization to the Stripe customer
Adding a Payment Method
  1. Log in to the dashboard
  2. Navigate to Billing
  3. Click Add Payment Method
  4. Enter your card details in the Stripe form
  5. Add your billing address
  6. Click Add Payment Method
Sendook uses Stripe Elements for secure card collection. Your card details never touch Sendook’s servers.

Required Environment Variables

For self-hosted deployments, configure these Stripe environment variables:
STRIPE_SECRET_KEY=sk_test_... # Your Stripe secret key
STRIPE_WEBHOOK_SECRET=whsec_... # Stripe webhook signing secret
STRIPE_PRICE_ID=price_... # Your usage-based price ID
STRIPE_PRODUCT_ID=prod_... # Your product ID
STRIPE_METER_EVENT=email_sent # Meter event name for tracking usage

Usage Tracking

Sendook tracks usage in real-time using Stripe’s billing meters.

How It Works

  1. Message sent/received - Your application sends or receives an email
  2. Meter event created - Sendook sends a meter event to Stripe:
    stripe.billing.meterEvents.create({
      event_name: process.env.STRIPE_METER_EVENT,
      timestamp: Math.floor(Date.now() / 1000),
      payload: {
        stripe_customer_id: customerId,
        value: "1"
      }
    });
    
  3. Usage aggregated - Stripe aggregates all events for the billing period
  4. Invoice generated - At period end, Stripe creates an invoice based on total usage

Viewing Usage

In the dashboard:
  1. Navigate to Billing
  2. View Current Month Invoice
  3. See accumulated charges for the current period
Invoice details show:
  • Current status (Draft, Open, Paid)
  • Amount due
  • Billing period dates
  • Link to detailed invoice in Stripe

Payment Methods

Supported Payment Types

  • Credit cards (Visa, Mastercard, American Express)
  • Debit cards
  • Additional methods supported by Stripe

Managing Payment Methods

Updating Your Card
  1. Go to Billing in the dashboard
  2. Click Update next to your current payment method
  3. Enter new card details
  4. Submit the form
The new card becomes your default payment method immediately. Payment Method Details Your saved payment method shows:
  • Card brand and last 4 digits
  • Expiration date
  • Billing address
Keep your payment method up to date. Failed payments may result in service interruption.

Invoices

Invoice Lifecycle

  1. Draft - Invoice being calculated during billing period
  2. Open - Invoice finalized and awaiting payment
  3. Paid - Payment successfully processed
  4. Uncollectible - Payment failed after retries
  5. Void - Invoice cancelled

Accessing Invoices

Via Dashboard
  1. Navigate to Billing
  2. Click View Invoice to open in Stripe
  3. Download PDF or view details
Via API Retrieve the current month’s invoice:
curl https://api.sendook.com/organizations/{organization_id}/payment_methods/invoice/current \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "invoice": {
    "id": "in_abc123",
    "amount_due": 1500,
    "currency": "usd",
    "status": "paid",
    "period_start": 1709251200,
    "period_end": 1711929599,
    "hosted_invoice_url": "https://invoice.stripe.com/i/..."
  }
}

Invoice History

Access past invoices:
curl https://api.sendook.com/organizations/{organization_id}/payment_methods/invoices?limit=10 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Stripe Customer Management

Each organization is linked to a Stripe customer.

Customer Creation

When you register, Sendook creates a Stripe customer:
const customer = await stripe.customers.create({
  name: organizationName,
  email: userEmail
});

Subscription Creation

A subscription is automatically created with your usage-based price:
const subscription = await stripe.subscriptions.create({
  customer: customerId,
  items: [{ price: process.env.STRIPE_PRICE_ID }]
});

Payment Method Attachment

When you add a payment method:
  1. Create a Setup Intent:
    const setupIntent = await stripe.setupIntents.create({
      customer: customerId,
      payment_method_types: ['card']
    });
    
  2. Confirm on client side with Stripe Elements
  3. Attach the payment method:
    await stripe.paymentMethods.attach(paymentMethodId, {
      customer: customerId
    });
    

Self-Hosting Billing

If you’re self-hosting Sendook, you’ll need to set up your own Stripe account.

Prerequisites

  1. Stripe Account - Sign up at stripe.com
  2. Product & Price - Create a product with usage-based pricing
  3. Billing Meter - Set up a meter for tracking email usage
  4. Webhook Endpoint - Configure webhook for payment events

Setup Steps

1. Create Stripe Product In your Stripe dashboard:
  • Go to Products
  • Click “Add product”
  • Select “Usage based” pricing
  • Set your per-unit price
  • Save the product ID and price ID
2. Create Billing Meter
  • Go to Billing → Meters
  • Create a new meter (e.g., “email_sent”)
  • Note the meter event name
3. Configure Environment Variables Add to your .env file:
STRIPE_SECRET_KEY=sk_live_your_key
STRIPE_WEBHOOK_SECRET=whsec_your_secret
STRIPE_PRICE_ID=price_your_price_id
STRIPE_PRODUCT_ID=prod_your_product_id
STRIPE_METER_EVENT=email_sent
4. Set Up Webhooks Configure Stripe webhook to point to:
https://your-domain.com/webhook/stripe
Subscribe to events:
  • invoice.payment_succeeded
  • invoice.payment_failed
  • customer.subscription.updated
  • customer.subscription.deleted
The webhook secret is required to verify webhook signatures. Never commit it to version control.

API Integration

Get Payment Method

curl https://api.sendook.com/organizations/{organization_id}/payment_methods \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Create Setup Intent

curl -X POST https://api.sendook.com/organizations/{organization_id}/payment_methods/setup-intent \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Attach Payment Method

curl -X POST https://api.sendook.com/organizations/{organization_id}/payment_methods/attach \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"paymentMethodId": "pm_abc123"}'

Troubleshooting

If a payment fails:
  1. Check that your card is valid and has sufficient funds
  2. Update your payment method in the dashboard
  3. Contact your bank if the card is declined
  4. Stripe will automatically retry failed payments
  • Invoices are generated at the end of each billing period
  • During the month, you’ll see a “Draft” invoice
  • If no usage, no invoice will be generated
  • Check the meter events in Stripe dashboard
  • Verify STRIPE_METER_EVENT is set correctly
  • Look for failed meter event submissions in logs
  • Ensure Stripe publishable key is configured
  • Check browser console for Stripe errors
  • Verify billing address is complete
  • Try a different card or payment method

Cost Optimization

Monitor Usage

Regularly check your current month invoice to track spending trends.

Set Up Alerts

Configure Stripe billing alerts to notify you when spending exceeds thresholds.

Optimize Workflows

Review your email workflows to reduce unnecessary messages.

Test in Development

Use a separate organization with a test Stripe account for development.

Next Steps

Dashboard

Learn how to manage billing in the dashboard

API Reference

Integrate billing into your application

Self-Hosting

Set up billing for self-hosted deployments

Authentication

Secure your API access

Build docs developers (and LLMs) love