Plans Module

Manage subscription plans

Plans Module

The plans module provides functionality for managing subscription plans and assigning them to platforms or users.

Import

import { plans } from 'cilantro-sdk';

Basic Operations

findAll()

Get all plans.

const allPlans = await plans.findAll();

findOne(planId)

Get plan by ID.

const plan = await plans.findOne('plan-id');

update(planId, options)

Update plan.

await plans.update('plan-id', {
  planName: 'Updated Plan Name',
  description: 'New description',
  isActive: true
});

remove(planId)

Remove (deactivate) a plan.

await plans.remove('plan-id');

Assignment Operations

assignToPlatform(planId, platformId, options)

Assign plan to platform.

await plans.assignToPlatform('plan-id', 'platform-id', {
  startDate: '2024-01-01T00:00:00Z',
  billingCycle: 'monthly'
});

assignToUser(planId, userId, options)

Assign plan to user.

await plans.assignToUser('plan-id', 'user-id', {
  startDate: '2024-01-01T00:00:00Z',
  billingCycle: 'monthly'
});
Plans Module | Cilantro Smart Wallet Docs | Cilantro Smart Wallet