Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dishant0406/quickleap/llms.txt

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

Subscription management

Manage user subscriptions including viewing current subscription details, canceling, and reactivating subscriptions.

Get current subscription

Retrieve the authenticated user’s current subscription details.
getCurrentSubscription(): Promise<GetSubscriptionResponse>
Route: GET /payment/subscription

Response

success
boolean
Whether the request was successful
data
object
message
string
Human-readable status message

Example

import { getCurrentSubscription } from '@/lib/api/payment';

const response = await getCurrentSubscription();

if (response.success && response.data.subscription) {
  const sub = response.data.subscription;
  console.log(`Plan: ${sub.plan.name}`);
  console.log(`Status: ${sub.status}`);
  console.log(`Renewal: ${sub.daysUntilRenewal} days`);
}

Cancel subscription

Cancel an active subscription. You can choose to cancel immediately or at the end of the billing period.
cancelSubscription(params?: CancelSubscriptionParams): Promise<CancelSubscriptionResponse>
Route: POST /payment/subscription/cancel

Parameters

immediately
boolean
If true, cancel and revoke access immediately. If false or omitted, cancel at period end.
reason
string
Optional reason for cancellation (for feedback)

Request body

interface CancelSubscriptionParams {
  immediately?: boolean;
  reason?: string;
}

Example

import { cancelSubscription } from '@/lib/api/payment';

const response = await cancelSubscription({
  immediately: false,
  reason: 'Switching to different service'
});

if (response.success) {
  console.log('Subscription will cancel at period end');
}
Immediate cancellation revokes access immediately and cannot be undone. Use “cancel at period end” to maintain access until the paid period expires.

Reactivate subscription

Reactivate a subscription that was set to cancel at period end.
reactivateSubscription(): Promise<ReactivateSubscriptionResponse>
Route: POST /payment/subscription/reactivate

Example

import { reactivateSubscription } from '@/lib/api/payment';

const response = await reactivateSubscription();

if (response.success) {
  console.log('Subscription reactivated successfully');
}
Reactivation only works for subscriptions set to cancel at period end. Immediately canceled subscriptions cannot be reactivated.

Create customer portal session

Generate a secure link to the Stripe Customer Portal where users can manage their billing information, payment methods, and invoices.
createPortalSession(params?: CreatePortalParams): Promise<PortalResponse>
Route: POST /payment/portal

Parameters

returnUrl
string
Optional URL to redirect user after they’re done in the portal. Defaults to your dashboard.

Example

import { createPortalSession } from '@/lib/api/payment';

const response = await createPortalSession({
  returnUrl: 'https://yourapp.com/billing'
});

if (response.success) {
  // Redirect to customer portal
  window.location.href = response.data.portalUrl;
}

Response

{
  "success": true,
  "data": {
    "portalUrl": "https://billing.stripe.com/p/session/...",
    "expiresAt": "2024-12-31T23:59:59Z"
  },
  "message": "Portal session created successfully"
}
Customer portal sessions are time-limited and expire after the user completes their session or after the expiration time.

Subscription statuses

  • active - Subscription is active and in good standing
  • trialing - In trial period, not yet charged
  • canceled - Canceled but still active until period end
  • revoked - Immediately canceled, access revoked
  • past_due - Payment failed, in grace period
  • incomplete - Initial payment incomplete
  • incomplete_expired - Initial payment expired without completion

Next steps

Create checkout

Start a new subscription

Payment history

View transaction history

Build docs developers (and LLMs) love