trial-codes

Complete Signup With Code

Complete signup for a user who signed up with a trial code.

TECH-657: Called AFTER Clerk authentication. Handles two cases:

  1. User has no company yet: Creates company and subscription
  2. User already has company (from Clerk webhook): Updates existing subscription

The Clerk webhook typically creates the company before this endpoint is called, so case 2 is the common path. We check if the subscription is eligible for trial code application (free_trial, trialing, or incomplete status).

Transaction Flow:

  1. Validate code
  2. Get or create company and subscription
  3. Update subscription with target plan from code if specified
  4. Record redemption
  5. Commit only if ALL steps succeed
post/api/v1/billing/trial-codes/complete-signup-with-code

Request

  • Base URL: http://localhost:8000
  • URL: http://localhost:8000/api/v1/billing/trial-codes/complete-signup-with-code
  • Auth: none declared

Headers

Authorizationstring

Request body

codestring required

Trial code to redeem

company_namestring nullable

Optional company name. Defaults to email domain.

Response

Successful Response

successboolean required
dataunknown
messagestring nullable
errorstring nullable
metaobject nullable

Changes

No recorded changes to this operation across all 1 revision of this API.