Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.llmgenerator.com/llms.txt

Use this file to discover all available pages before exploring further.

POST /credits/checkout

This endpoint creates a Stripe checkout session to allow a user to purchase a credit package. Requires session-based authentication (JWT access token from login).
For third-party integrations: Use POST /credits/checkout/api with API Key authentication instead.

Request Body

packageId
string
required
The ID of the credit package to purchase. Get available packages from /credits/packages.
successUrl
string
The URL to redirect to after a successful purchase. Defaults to dashboard with success indicator.
cancelUrl
string
The URL to redirect to if the purchase is canceled. Defaults to dashboard with canceled indicator.

Response

sessionId
string
The ID of the Stripe checkout session.
url
string
The URL of the Stripe checkout page. Redirect the user here to complete purchase.
package
object
Details of the selected package.
curl -X POST https://api.llmgenerator.com/api/v1/credits/checkout \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "packageId": "pkg_pro",
        "successUrl": "https://example.com/success?session_id={CHECKOUT_SESSION_ID}",
        "cancelUrl": "https://example.com/cancel"
      }'
{
  "sessionId": "cs_test_a1b2c3d4e5f6g7h8i9j0",
  "url": "https://checkout.stripe.com/c/pay/cs_test_a1b2c3d4e5f6g7h8i9j0",
  "package": {
    "id": "pkg_pro",
    "name": "Pro Pack",
    "credits": 500,
    "priceCents": 1999
  }
}

POST /credits/checkout/api

This endpoint creates a Stripe checkout session using API Key authentication. Ideal for third-party integrations and external applications.

Authentication

Requires API Key authentication. Include your API key in the Authorization header:
Authorization: Bearer llmgen_your_api_key_here

Request Body

Same as /credits/checkout above.

Response

Same as /credits/checkout above.
curl -X POST https://api.llmgenerator.com/api/v1/credits/checkout/api \
  -H "Authorization: Bearer llmgen_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
        "packageId": "pkg_pro",
        "successUrl": "https://yourapp.com/success?session_id={CHECKOUT_SESSION_ID}",
        "cancelUrl": "https://yourapp.com/cancel"
      }'