Payment

Create a Stripe Checkout Session for subscription purchase

Creates a Stripe Checkout Session for purchasing a subscription plan. The user will be redirected to the checkout URL to complete payment.

post/payments/stripe/purchasePlan

Request

  • Base URL: https://api.tinyhumans.ai
  • URL: https://api.tinyhumans.ai/payments/stripe/purchasePlan
  • Auth: HTTP bearer

Request body

plan'BASIC_MONTHLY' | 'BASIC_YEARLY' | 'PRO_MONTHLY' | 'PRO_YEARLY' required

Subscription plan identifier

couponCodestring

Optional promotion code (case-insensitive). If the code is unknown, inactive, expired, exhausted, or rejected by Stripe (e.g. a first-time customer only restriction that does not match this customer), the request fails with 400 / errorCode PROMO_CODE_INVALID so the client can surface the rejection. Previously these were silently ignored and the session was created at full price (see #3899).

Example request

{
  "plan": "PRO_MONTHLY",
  "couponCode": "EARLYBIRDY"
}

Response

Checkout session created successfully

successboolean

Example response

{
  "success": true,
  "data": {
    "checkoutUrl": "https://checkout.stripe.com/c/pay/cs_test_...",
    "sessionId": "cs_test_1234567890"
  }
}

Changes

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