Emergency pause.
fn pause(env: soroban_sdk::Env) -> Result<(), FactoryError>
Resume after pause.
fn unpause(env: soroban_sdk::Env) -> Result<(), FactoryError>
Get a plan by its ID.
fn get_plan(
env: soroban_sdk::Env,
plan_id: soroban_sdk::String,
) -> Result
Initialize the Subscription Factory with an admin address.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), FactoryError>
Create a new subscription plan.
merchant — The merchant creating the planname — Human-readable plan namedescription — Plan descriptionamount — Price per billing periodtoken — Token contract addressinterval — Billing interval in secondsmax_payments — Maximum number of payments (0 = infinite)metadata_uri — IPFS URI for additional metadatafn create_plan(
env: soroban_sdk::Env,
merchant: soroban_sdk::Address,
name: soroban_sdk::String,
description: soroban_sdk::String,
amount: i128,
token: soroban_sdk::Address,
interval: u64,
max_payments: u32,
metadata_uri: soroban_sdk::String,
) -> Result
Get total number of plans.
fn total_plans(env: soroban_sdk::Env) -> u32
Update an existing plan. Only the plan owner (merchant) can update.
fn update_plan(
env: soroban_sdk::Env,
merchant: soroban_sdk::Address,
plan_id: soroban_sdk::String,
name: soroban_sdk::String,
description: soroban_sdk::String,
amount: i128,
interval: u64,
max_payments: u32,
metadata_uri: soroban_sdk::String,
) -> Result
Deactivate a plan — prevents new subscriptions but existing ones continue.
fn deactivate_plan(
env: soroban_sdk::Env,
merchant: soroban_sdk::Address,
plan_id: soroban_sdk::String,
) -> Result<(), FactoryError>
Reactivate a previously deactivated plan.
fn reactivate_plan(
env: soroban_sdk::Env,
merchant: soroban_sdk::Address,
plan_id: soroban_sdk::String,
) -> Result<(), FactoryError>
List all plans for a merchant.
fn list_merchant_plans(
env: soroban_sdk::Env,
merchant: soroban_sdk::Address,
) -> soroban_sdk::Vec
Decrement subscriber count (called by Payment Engine on cancellation).
fn decrement_subscribers(
env: soroban_sdk::Env,
plan_id: soroban_sdk::String,
) -> Result<(), FactoryError>
Increment subscriber count (called by Payment Engine on new subscription).
fn increment_subscribers(
env: soroban_sdk::Env,
plan_id: soroban_sdk::String,
) -> Result<(), FactoryError>