EYMINT

Software licensing API for keys, activations, floating seats, and signed offline files.

support@keymint.dev

Product

  • Features
  • Pricing
  • Compare platforms
  • Customer login
  • Offline license tester

Company

  • About
  • Blog
  • Contact

Developers

  • Documentation
  • Changelog
  • GitHub
  • Status

Trust

  • Security
  • GDPR
  • Privacy
  • Terms
  • SLA

© 2026 Keymint. All rights reserved.

Skip to content
EYMINT
FeaturesPricingCompareChangelogDocs
Back to all posts

Create Customer Records Automatically on Purchase

Clifford•2 min read
webhookscustomer managementautomationcrmkeymint

Every time you generate a license key — from the dashboard, via API, or from a Stripe checkout — you need that customer in your own database. Keymint's license.created webhook makes this automatic.

How It Works

  1. Your backend creates a license via admin.createKey() or POST /key
  2. Keymint emits license.created with the license details
  3. Your handler receives it, verifies the signature
  4. Your handler upserts the customer and license into your database
  5. Optionally sends a welcome email

Events to Sync

EventWhat to do
customer.createdInsert customer row
customer.updatedUpdate name, email
customer.disabled / customer.enabledToggle active status
license.createdInsert license row, send welcome email
license.updatedSync expiry, maxActivations
license.disabled / license.enabledToggle status
device.activatedIncrement activation count in UI
device.deactivatedDecrement activation count

The Handler (Essentials)

typescript
const event = JSON.parse(payload);

switch (event.type) {
  case 'customer.created': {
    const c = event.data?.customer || {};
    await db.customer.upsert({
      where: { keymintId: event.resource_id },
      create: { name: c.name, email: c.email, active: true },
      update: { name: c.name, email: c.email },
    });
    break;
  }
  case 'license.created': {
    const lic = event.data?.license || {};
    await db.license.upsert({
      where: { keymintId: event.resource_id },
      create: { productId: lic.productId, customerId: lic.customerId, status: 'active' },
      update: { status: 'active' },
    });
    // Send welcome email with license details
    if (lic.customerEmail) {
      await sendWelcomeEmail(lic.customerEmail, lic.productId);
    }
    break;
  }
}

Idempotency

Keymint may deliver webhooks more than once. Store event.id (a UUID) and skip duplicates:

typescript
const exists = await db.webhookEvents.findUnique({
  where: { keymintEventId: event.id },
});
if (exists) return Response.json({ received: true });

Going Further

  • Sync to a CRM: push to HubSpot, Salesforce, or Pipedrive instead of your database
  • Enrich with Stripe data: look up the Stripe customer by email and pull MRR, plan tier
  • Trigger a welcome sequence: combine with a transactional email provider (Resend, Postmark)

Full webhook event catalog: keymint.dev/docs/topics/webhooks

Related Posts

  • Discord Notifications for License Activations
  • Protecting Electron Apps from Piracy with Keymint
  • Revoking Software Licenses on Stripe Cancellation
  • Send Slack Notifications on License Revocations
  • Track Software License Activations in PostHog

Try Keymint

Simple software licensing API built for indie developers.

Get started free