Fetch a Subscription Plan
Overview
Fetch the details of a single Subscription Plan by its unique ID. Use this endpoint to retrieve complete information about a specific plan template, including pricing, billing frequency, trial, and discount configurations.
Resource Access
- User Permissions: Admin users only
- Endpoint:
GET /subscription_plans/\{subscription_plan_id}
Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
| subscription_plan_id | string | Yes (path) | The unique ID of the Subscription Plan |
Example Request
curl -X GET \
'https://api.ahrvo.network/payments/na/subscription_plans/SPsubscriptionPlan001' \
-u username:password \
-H 'Content-Type: application/json'
Example Response
{
"id": "SPsubscriptionPlan001",
"created_at": "2023-11-01T10:00:00Z",
"updated_at": "2023-12-01T14:30:00Z",
"amount": 19900,
"currency": "USD",
"plan_name": "API Portal - Basic Plan",
"description": "Basic API portal account with essential features including 10,000 API calls per month, email support, and access to standard endpoints.",
"nickname": "Basic",
"linked_to": "MUmerchant123",
"linked_type": "MERCHANT",
"billing_interval": "MONTHLY",
"duration_type": "EVERGREEN",
"state": "ACTIVE",
"billing_defaults": {
"collection_method": "BILL_AUTOMATICALLY",
"send_invoice": true,
"send_receipt": true
},
"trial_defaults": {
"interval_type": "DAY",
"interval_count": 14
},
"discount_phase_defaults": null,
"tags": {
"tier": "basic",
"version": "v2",
"department": "sales",
"api_calls": "10000"
},
"_links": {
"self": {
"href": "https://api.ahrvo.network/payments/na/subscription_plans/SPsubscriptionPlan001"
},
"merchant": {
"href": "https://api.ahrvo.network/payments/na/merchants/MUmerchant123"
},
"subscriptions": {
"href": "https://api.ahrvo.network/payments/na/subscriptions?subscription_plan_id=SPsubscriptionPlan001"
}
}
}
Additional Information
- Plan Details: Complete template configuration
- Pricing and billing frequency
- Trial period setup
- Discount phase configuration
- Billing and notification preferences
- Current state (active/inactive)
- Amount: Base recurring price in cents
- Example: 19900 = $199.00
- Charged every billing_interval
- May be overridden during discount phase
- Currency always specified (typically USD)
- Billing Interval: Charging frequency
- MONTHLY: Charged once per month
- Most common for SaaS
- Lower commitment
- YEARLY: Charged once per year
- Better for retention
- Often discounted vs monthly
- WEEKLY: Charged every 7 days
- Useful for short-term services
- DAILY: Charged daily
- Rare, for very specific use cases
- MONTHLY: Charged once per month
- Duration Type:
- EVERGREEN: Renews indefinitely
- Standard for subscriptions
- Continues until canceled
- Most common
- FIXED_DURATION: Ends after set period
- For limited-time offers
- Contract-based services
- Specified number of billing cycles
- EVERGREEN: Renews indefinitely
- State: Plan availability
- ACTIVE: Available for new subscriptions
- Visible to customers
- Can create subscriptions
- Default for new plans
- INACTIVE: Archived/deprecated
- Not visible to customers
- Cannot create new subscriptions
- Existing subscriptions unaffected
- Good for legacy plan management
- ACTIVE: Available for new subscriptions
- Billing Defaults: Payment collection settings
- collection_method:
BILL_AUTOMATICALLY: Auto-charge on billing date- Credit card on file charged automatically
- Reduces churn, improves cash flow
- Standard for B2C, small B2B
SEND_INVOICE: Manual invoice payment- Invoice sent to customer
- Customer pays via wire, ACH, check
- Common for enterprise, large contracts
- send_invoice: Email invoice notification
- true: Send invoice even if auto-charging
- false: Skip invoice email
- send_receipt: Email receipt after payment
- true: Send receipt confirmation
- false: No receipt email
- collection_method:
- Trial Defaults: Free trial configuration
- interval_type: DAY, MONTH, or YEAR
- interval_count: Number of intervals
- null if no trial offered
- Examples:
- 14-day trial:
{interval_type: "DAY", interval_count: 14} - 1-month trial:
{interval_type: "MONTH", interval_count: 1} - No trial:
null
- 14-day trial:
- Customer not charged during trial
- After trial, regular billing begins
- Discount Phase Defaults: Introductory pricing
- amount: Discounted price in cents
- billing_interval_count: Number of billing cycles
- null if no discount phase
- Example:
- First 3 months at $99:
{
"amount": 9900,
"billing_interval_count": 3
} - After 3 months, regular amount ($199) charged
- First 3 months at $99:
- Cannot combine with trial (discount starts after trial)
- Linked To: Merchant owner
- Merchant ID who receives payments
- All subscriptions from this plan go to this merchant
- Cannot be changed after creation
- Tags: Custom metadata
- Organize and categorize plans
- Track features, limits, versions
- Examples:
tier: basic, pro, enterpriseapi_calls: monthly API limitversion: v1, v2 (for plan versioning)department: sales, marketing
- Searchable and filterable
- Not visible to end customers
- Use Cases:
-
Display Plan Details to Customer:
- Fetch plan before checkout
- Show pricing, features, trial info
- Display "14-day free trial" if trial_defaults present
- Show discount: "$99 for 3 months, then $199/month"
-
Subscription Creation Validation:
- Check plan state (must be ACTIVE)
- Verify plan exists and accessible
- Retrieve pricing for payment processing
- Get billing defaults for subscription config
-
Plan Comparison:
- Fetch multiple plans
- Compare amounts, intervals, features
- Show side-by-side comparison
- Highlight differences
-
Customer Support:
- Customer asks about their plan
- Fetch plan details
- Explain pricing, billing frequency
- Confirm trial or discount phase
-
Reporting & Analytics:
- Fetch plan to get pricing info
- Calculate MRR (Monthly Recurring Revenue)
- Track plan popularity
- Analyze pricing effectiveness
-
- Subscription Link: View active subscriptions
_links.subscriptions: List subscriptions using this plan- See how many customers on this plan
- Track plan adoption
- Identify popular plans
- Updated At: Track plan changes
- Last modification timestamp
- Compare to created_at to see if updated
- Audit trail for plan changes
- Important for pricing history
- Common Workflows:
-
Customer Selects Plan:
- Display list of plans (GET /subscription_plans)
- Customer clicks "Select Basic Plan"
- Fetch plan details (GET /subscription_plans/{id})
- Verify plan is ACTIVE
- Display plan details and trial info
- Create subscription (POST /subscriptions)
-
Plan Verification:
- Subscription references plan ID
- Fetch plan to verify still valid
- Check state is ACTIVE
- Confirm pricing hasn't changed
- Proceed with billing
-
Feature Gate Check:
- User tries to access feature
- Look up user's subscription
- Fetch subscription plan
- Check tags for feature limits
- Allow or deny based on plan tier
-
- Pricing Calculation Examples:
-
Standard Monthly:
- Amount: $199/month
- No trial, no discount
- Customer pays $199 every month
-
With Trial:
- Amount: $199/month
- Trial: 14 days
- Timeline:
- Days 1-14: $0 (trial)
- Day 15+: $199/month
-
With Discount Phase:
- Amount: $199/month (regular)
- Discount: $99 for 3 months
- Timeline:
- Months 1-3: $99/month
- Month 4+: $199/month
-
With Trial + Discount:
- Amount: $199/month (regular)
- Trial: 14 days
- Discount: $99 for 3 months
- Timeline:
- Days 1-14: $0 (trial)
- Months 1-3: $99/month (discount)
- Month 4+: $199/month (regular)
-
- Best Practices:
- Cache plan details to reduce API calls
- Verify plan state before creating subscriptions
- Display trial and discount info prominently
- Use tags to store plan features/limits
- Check updated_at to detect price changes
- Follow subscriptions link to track adoption
- Related Endpoints:
- GET /subscription_plans: List all plans
- PUT /subscription_plans/{id}: Update plan
- POST /subscriptions: Create subscription from plan
- GET /subscriptions?subscription_plan_id={id}: List subscriptions on this plan