Retrieves the current billing cycle number for a specific subscription contract. The cycle number represents how many successful billing attempts have occurred for this subscription, starting from 1 for the initial order.
What is a Billing Cycle? A billing cycle represents one completed billing period in a subscription’s lifetime. Each successful billing attempt increments the cycle count. This number is crucial for:
How Cycle Counting Works:
Initial Order:
Subsequent Orders:
Calculation Formula:
Current Cycle = 1 + (Number of Successful Billing Attempts)
Example Timeline:
Use Cases:
1. Cancellation Eligibility:
2. Pricing Adjustments:
3. Customer Retention:
4. Analytics & Reporting:
5. Customer Portal Display:
Response Format:
Returns a single integer representing the current cycle number:
3
Response Examples:
New subscription (just created):
1
After 5 successful billing attempts:
6
Note: Initial order (1) + 5 successful renewals = Cycle 6
Important Considerations:
Cycle vs. Billing Attempts:
Paused Subscriptions:
Minimum/Maximum Cycles:
minCycles: Minimum cycles before cancellation allowedmaxCycles: Subscription auto-expires after this many cyclesData Source:
Integration Example:
Check if customer can cancel:
// Get subscription details
const contract = await getSubscriptionContract(contractId);
const currentCycle = await fetch(
`/api/external/v2/subscription-contract-details/current-cycle/${contractId}`,
{ headers: { 'X-API-Key': 'your-key' } }
).then(r => r.json());
const minCycles = contract.minCycles || 0;
if (currentCycle >= minCycles) {
console.log('Customer can cancel now');
showCancelButton();
} else {
const cyclesRemaining = minCycles - currentCycle;
console.log(`Must complete ${cyclesRemaining} more orders before canceling`);
showMinimumCommitmentMessage(cyclesRemaining);
}
Display progress to max cycles:
const currentCycle = await getCycleNumber(contractId);
const maxCycles = contract.maxCycles;
if (maxCycles) {
const progress = (currentCycle / maxCycles) * 100;
console.log(`Subscription ${progress.toFixed(0)}% complete (${currentCycle}/${maxCycles})`);
if (currentCycle === maxCycles) {
console.log('This is the final cycle - subscription will expire after this order');
}
}
Performance Characteristics:
Fast Query:
Best Practices:
Common Misunderstandings:
Myth: Cycle = Months Subscribed
Myth: First order is Cycle 0
Related Fields:
minCycles: Minimum cycles before cancellation (from contract)maxCycles: Maximum cycles before auto-expiry (from contract)billingInterval: Frequency between cycles (from contract)Authentication: Requires valid X-API-Key header
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contract-details/current-cycle/{contractId} \
--header 'X-API-Key: <x-api-key>'1Documentation Index
Fetch the complete documentation index at: https://appstleinc-aeca3e0a.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contract-details/current-cycle/{contractId} \
--header 'X-API-Key: <x-api-key>'1