Guide
15 min

Set Up Subscriptions

Create products, plans, and manage recurring billing for your customers with YardPay Pro. Supports monthly, annual, one-time, and usage-based billing.

Prerequisites
Key Concepts

Subscriptions in YardPay Pro are built around three resources:

Products

What you sell (e.g., "Pro Suite", "Starter Kit"). Products group related plans together.

Plans

Pricing & billing configuration (e.g., "$29.99/month", "$299.99/year"). Each product can have multiple plans.

Inventory

Physical or digital items tracked by serial number (e.g., device rentals, license keys).

1

Create a Product

Start by creating a product. The product type determines how it's categorized: Service, Digital, or Physical.

curl -X POST /v1/SubscriptionProduct \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_test_YOUR_API_KEY" \
  -d '{
    "name": "Business Suite",
    "description": "Complete business management toolkit",
    "subscriptionProductType": "Service"
  }'
// Response
{
  "id": 1,
  "merchantId": 10,
  "name": "Business Suite",
  "description": "Complete business management toolkit",
  "subscriptionProductType": "Service",
  "createdDateTime": "2026-03-28T10:00:00Z"
}
2

Add Subscription Plans

Create one or more pricing plans for your product. Set the billing interval using timeUnit and timeInterval.

Monthly Plan

curl -X POST /v1/SubscriptionPlan \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_test_YOUR_API_KEY" \
  -d '{
    "productId": 1,
    "name": "Monthly",
    "description": "Billed monthly",
    "amount": "29.99",
    "currency": "USD",
    "timeUnit": "Month",
    "timeInterval": 1,
    "subscriptionBillingType": "Recurring",
    "status": "Active"
  }'

Annual Plan (discounted)

curl -X POST /v1/SubscriptionPlan \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_test_YOUR_API_KEY" \
  -d '{
    "productId": 1,
    "name": "Annual",
    "description": "Billed yearly — save 17%",
    "amount": "299.99",
    "currency": "USD",
    "timeUnit": "Year",
    "timeInterval": 1,
    "subscriptionBillingType": "Recurring",
    "status": "Active"
  }'
Billing Types & Intervals
Billing TypeDescriptionExample
RecurringAutomatically charges at each interval$29.99/month
OneTimeSingle charge, no renewal$99 lifetime access
UsageCharges based on metered usage$0.10 per API call
Time UnitTime IntervalResult
Day7Weekly billing
Month1Monthly billing
Month3Quarterly billing
Year1Annual billing
3

Manage Inventory (Optional)

If your product involves physical items or tracked digital assets (e.g., device rentals, license keys), use inventory items to track them.

// Add inventory items
curl -X POST /v1/SubscriptionInventoryItem \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_test_YOUR_API_KEY" \
  -d '{
    "productId": 1,
    "serialNumber": "SN-001-ABC",
    "status": "Available"
  }'
StatusDescription
AvailableReady to be assigned
ReservedHeld for a pending order
RentedCurrently assigned to a subscriber
DiscontinuedNo longer available
4

List and Filter Resources

All subscription endpoints support OData filtering, sorting, and pagination.

List active plans for a product

GET /v1/SubscriptionPlan?$filter=productId eq 1 and status eq 'Active'&$count=true

List available inventory

GET /v1/SubscriptionInventoryItem?$filter=status eq 'Available'&$top=20

List all products with media

GET /v1/SubscriptionProduct?$expand=Media&$orderby=id desc
Complete Example (JavaScript)
import axios from 'axios';

const client = axios.create({
  baseURL: window.location.origin,
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'sk_test_YOUR_API_KEY',
  },
});

// 1. Create the product
const { data: product } = await client.post('/v1/SubscriptionProduct', {
  name: 'Business Suite',
  description: 'Complete business management toolkit',
  subscriptionProductType: 'Service',
});
console.log('Product created:', product.id);

// 2. Create a monthly plan
const { data: monthlyPlan } = await client.post('/v1/SubscriptionPlan', {
  productId: product.id,
  name: 'Monthly',
  amount: '29.99',
  currency: 'USD',
  timeUnit: 'Month',
  timeInterval: 1,
  subscriptionBillingType: 'Recurring',
  status: 'Active',
});
console.log('Monthly plan:', monthlyPlan.id);

// 3. Create an annual plan
const { data: annualPlan } = await client.post('/v1/SubscriptionPlan', {
  productId: product.id,
  name: 'Annual',
  amount: '299.99',
  currency: 'USD',
  timeUnit: 'Year',
  timeInterval: 1,
  subscriptionBillingType: 'Recurring',
  status: 'Active',
});
console.log('Annual plan:', annualPlan.id);

// 4. List plans for verification
const { data: plans } = await client.get('/v1/SubscriptionPlan', {
  params: {
    $filter: `productId eq ${product.id}`,
    $count: true,
  },
});
console.log(`${plans['@odata.count']} plans created for ${product.name}`);