Skip to main content

Subscriptions

Subscriptions let you set up recurring billing. You define a plan with an amount and interval, then customers subscribe to it. ZendFi automatically creates payments when they are due and sends webhook events so you can track the lifecycle.

Subscription Plans

Create a Subscription Plan

name
string
required
Plan name shown to customers.
description
string
Plan description.
amount
number
required
Recurring amount per billing cycle.
currency
string
default:"USD"
Currency code.
billing_interval
string
required
Billing interval: daily, weekly, monthly, yearly.
interval_count
integer
default:"1"
Number of intervals between billings. For example, billing_interval: "monthly" with interval_count: 3 bills quarterly.
trial_days
integer
default:"0"
Number of trial days before the first billing.
max_cycles
integer
Maximum number of billing cycles. Omit for unlimited.
metadata
object
Arbitrary key-value pairs.

Example

Response

List Subscription Plans

Returns all plans for the authenticated merchant.

Get a Subscription Plan

This endpoint is public — no authentication required. This allows customers to view plan details before subscribing.

Customer Subscriptions

Create a Subscription

Subscribes a customer to a plan.
plan_id
string
required
The subscription plan ID (UUID).
customer_wallet
string
required
Customer’s Solana wallet address.
customer_email
string
Customer email for notifications and receipts.
metadata
object
Arbitrary key-value pairs.

Example

Get a Subscription

Returns subscription details including current period and status.

Cancel a Subscription

Cancels the subscription. The customer retains access until the end of the current billing period.

Pay a Subscription

Creates a payment for the current billing period. ZendFi calls this automatically, but you can trigger it manually if needed.

Subscription Lifecycle

StatusDescription
activeSubscription is active and billing normally
trialingSubscription is in its trial period
past_dueMost recent payment failed, retrying
pausedTemporarily paused
cancelledSubscription has been cancelled
expiredSubscription has expired

Webhook Events

EventWhen
SubscriptionCreatedNew subscription created
SubscriptionRenewedSubscription renewed for next billing period
SubscriptionCancelledSubscription cancelled
SubscriptionPaymentFailedRecurring payment attempt failed
See the Subscriptions guide for an end-to-end implementation walkthrough.