Core

Testing

Test safely with sandbox environment

Sandbox is the default environment - completely isolated from production.

Test Cards

Successful payments:

CardBrand
4242 4242 4242 4242Visa
5555 5555 5555 4444Mastercard

Use any future expiry and any 3-digit CVC.

Failed payments:

CardScenario
4000 0000 0000 9995Insufficient funds
4000 0000 0000 0002Card declined

3D Secure:

CardDescription
4000 0025 0000 3155Requires authentication

Test Flow

// 1. Create customer
const customer = await commet.customers.create({
  email: 'test@example.com',
  externalId: `test_${Date.now()}`,
})

// 2. Create subscription
const subscription = await commet.subscriptions.create({
  externalId: customer.data.externalId,
  planCode: 'pro',
})

// 3. Pay with test card at checkoutUrl

// 4. Track usage
await commet.usage.track({
  externalId: customer.data.externalId,
  eventType: 'api_call',
})

Production

const commet = new Commet({
  apiKey: process.env.COMMET_PRODUCTION_KEY!,
  environment: 'production',
})

How is this guide?