Create a secure checkout session for upgrading to Pro or Scale plans. This endpoint generates a Stripe-hosted checkout URL for seamless subscription management.
Your redirect URLs should handle the checkout outcome appropriately:
<!-- https://yourapp.com/success --><div class="success-page"> <h1>Welcome to AgenticPencil Pro!</h1> <p>Your account has been upgraded successfully.</p> <a href="/dashboard">Go to Dashboard</a></div>
{ "status": "error", "error": "Invalid plan", "message": "Plan must be either 'pro' or 'scale'", "code": "INVALID_PLAN"}
Solution: Use “pro” or “scale” as the plan value
INVALID_URL - Malformed redirect URLs
{ "status": "error", "error": "Invalid URL", "message": "success_url must be a valid HTTPS URL", "code": "INVALID_URL"}
Solution: Ensure URLs are valid HTTPS URLs
PROMO_CODE_INVALID - Invalid promotional code
{ "status": "error", "error": "Invalid promo code", "message": "The promotional code 'INVALID123' is not valid or has expired", "code": "PROMO_CODE_INVALID"}
Solution: Check the promo code or proceed without it
ALREADY_SUBSCRIBED - User already has active subscription
{ "status": "error", "error": "Already subscribed", "message": "User already has an active subscription to this plan", "code": "ALREADY_SUBSCRIBED"}
Solution: User can manage their subscription in the dashboard instead