Skip to main content

Overview

Ionic provides comprehensive recurring billing and subscription management capabilities, allowing you to set up automatic payments, manage customer subscriptions, and process recurring charges without manual intervention.
Recurring billing integrates seamlessly with the Customer Vault to securely store payment methods and process automatic charges on schedule.
Key Features:
  • Flexible Scheduling - Daily, weekly, monthly, or custom frequency billing
  • Subscription Plans - Create and manage reusable billing plans
  • Automatic Retry - Smart retry logic for failed payments
  • Customer Management - Integrated with Customer Vault for payment storage
  • Real-Time Notifications - Webhook events for all subscription activities
  • Lifecycle Management - Add, update, pause, and cancel subscriptions via API

How Recurring Billing Works

1

Store Payment Method

Save customer payment information securely in the Customer Vault
2

Create Subscription

Set up a subscription with billing frequency, amount, and schedule
3

Automatic Charging

Ionic automatically charges the stored payment method on schedule
4

Webhook Notifications

Receive real-time notifications for successful charges, failures, and subscription changes
5

Manage Subscription

Update amounts, change frequency, pause, or cancel subscriptions as needed

Subscription Types

Pre-Defined Plans

Create reusable subscription plans with standard pricing and frequency.Use Cases:
  • SaaS subscriptions (Basic, Pro, Enterprise tiers)
  • Membership fees
  • Monthly service packages
  • Standard billing cycles
Benefits:
  • Consistent pricing across customers
  • Easy plan upgrades/downgrades
  • Simplified subscription management
  • Quick customer onboarding
recurring=add_subscription
plan_id=PRO_MONTHLY
customer_vault_id=CUST123
start_date=20251101

Creating Subscriptions

API Variables

VariableDescriptionFormatRequired
recurringSubscription actionadd_subscription, update_subscription, delete_subscription✅ Yes
customer_vault_idCustomer identifierString✅ Yes
plan_idPlan identifier (for plan-based)StringOptional
plan_amountRecurring charge amountx.xx✅ Yes (if no plan_id)
plan_paymentsNumber of paymentsNumeric (0=unlimited)✅ Yes
start_dateFirst charge dateYYYYMMDDOptional
day_frequencyDays between chargesNumericOptional*
month_frequencyMonths between chargesNumericOptional*
day_of_monthDay to charge each month1-31Optional
*Either day_frequency or month_frequency is required to set billing frequency.

Implementation Examples

curl -X POST https://api.ionicfi.com/api/transact.php \
  -d "security_key=YOUR_API_KEY" \
  -d "recurring=add_subscription" \
  -d "customer_vault_id=CUST123" \
  -d "plan_amount=29.99" \
  -d "plan_payments=0" \
  -d "month_frequency=1" \
  -d "start_date=20251101"

Managing Subscriptions

Update Subscription

Change subscription amount, frequency, or plan:
curl -X POST https://api.ionicfi.com/api/transact.php \
  -d "security_key=YOUR_API_KEY" \
  -d "recurring=update_subscription" \
  -d "subscription_id=SUB123456" \
  -d "plan_amount=39.99" \
  -d "plan_id=PRO_PLAN"

Cancel Subscription

Delete a subscription to stop future charges:
curl -X POST https://api.ionicfi.com/api/transact.php \
  -d "security_key=YOUR_API_KEY" \
  -d "recurring=delete_subscription" \
  -d "subscription_id=SUB123456"

Pause and Resume

To temporarily pause a subscription, update it with a future start date:
recurring=update_subscription
subscription_id=SUB123456
start_date=20260101  # Resume January 1, 2026
To resume immediately, update with today’s or tomorrow’s date:
recurring=update_subscription
subscription_id=SUB123456
start_date=20251101  # Resume November 1, 2025

Billing Frequencies

Common Frequency Patterns

day_frequency=1   # Every day
day_frequency=7   # Every week
day_frequency=14  # Every 2 weeks

Webhook Events

Monitor subscription activity with real-time webhook notifications:

Subscription Lifecycle Events

Triggered when a new subscription is created.
{
  "event": "subscription.added",
  "subscription_id": "SUB123456",
  "customer_vault_id": "CUST123",
  "plan_id": "PLAN001",
  "amount": "29.99",
  "frequency": "monthly",
  "start_date": "2025-11-01",
  "total_payments": 0,
  "timestamp": "2025-10-30T10:30:00Z"
}
Use Cases:
  • Send welcome email
  • Provision account access
  • Update CRM records
  • Track subscription metrics

Payment Events

Triggered when a recurring payment is processed successfully.
{
  "event": "recurring.payment.success",
  "subscription_id": "SUB123456",
  "transaction_id": "123456789",
  "customer_vault_id": "CUST123",
  "amount": "29.99",
  "payment_number": 3,
  "next_charge_date": "2025-12-01",
  "timestamp": "2025-10-30T10:30:00Z"
}
Use Cases:
  • Send payment receipt
  • Extend service access
  • Update billing history
  • Track successful charges

Webhook Implementation

<?php
// Receive webhook
$payload = file_get_contents('php://input');
$data = json_decode($payload, true);

switch ($data['event']) {
    case 'subscription.added':
        handleNewSubscription($data);
        break;

    case 'subscription.updated':
        handleSubscriptionUpdate($data);
        break;

    case 'subscription.deleted':
        handleSubscriptionCancellation($data);
        break;

    case 'recurring.payment.success':
        handleSuccessfulPayment($data);
        break;

    case 'recurring.payment.failed':
        handleFailedPayment($data);
        break;
}

http_response_code(200);
?>

Failed Payment Handling

Automatic Retry Logic

Ionic automatically retries failed recurring payments:
AttemptTimingAction
1ImmediateFirst charge attempt
23 days laterFirst retry
33 days laterSecond retry
43 days laterFinal retry
After all retry attempts fail, the subscription remains active but requires manual intervention. Monitor recurring.payment.failed webhooks to implement your own retry or cancellation logic.

Dunning Management

Implement dunning workflows to recover failed payments:
1

Detect Failed Payment

Receive recurring.payment.failed webhook notification
2

Notify Customer

Send email requesting payment method update
Subject: Payment Failed - Action Required

Your payment of $29.99 failed. Please update your payment
method to continue your subscription.
3

Restrict Access

Optionally pause service access until payment succeeds
4

Allow Update

Provide customer portal to update payment method via Customer Vault
5

Cancel if Unresolved

Cancel subscription after grace period if payment not recovered

Testing Subscriptions

Test Scenarios

Test standard subscription flow:
curl -X POST https://api.ionicfi.com/api/transact.php \
  -d "security_key=YOUR_API_KEY" \
  -d "test_mode=1" \
  -d "recurring=add_subscription" \
  -d "customer_vault_id=TEST_CUST_1" \
  -d "plan_amount=29.99" \
  -d "plan_payments=3" \
  -d "day_frequency=1" \
  -d "start_date=20251031"

# Creates subscription charging $29.99 for 3 days
# Day 1: First charge
# Day 2: Second charge
# Day 3: Final charge (subscription completes)

Testing Checklist

  • Create monthly subscription
  • Create weekly subscription
  • Create annual subscription
  • Create fixed-term subscription (6 payments)
  • Create ongoing subscription (unlimited)
  • Verify subscription_id returned
  • Verify start_date handling
  • Update subscription amount
  • Change billing frequency
  • Update payment method
  • Pause subscription (future start date)
  • Resume subscription
  • Upgrade plan
  • Downgrade plan
  • Successful recurring payment
  • Failed payment handling
  • Retry logic testing
  • Multiple payment methods
  • Expired card handling
  • Insufficient funds handling
  • subscription.added received
  • subscription.updated received
  • subscription.deleted received
  • recurring.payment.success received
  • recurring.payment.failed received
  • Webhook signature verification
  • Cancel subscription
  • Reactivate canceled subscription
  • Subscription completion (fixed-term)
  • Handle customer vault deletion
  • Prorated charges (if applicable)

Best Practices

Use Customer Vault

Always store payment methods in Customer Vault before creating subscriptions for PCI compliance

Set Start Dates

Specify start_date to control when first charge occurs, allowing time for account setup

Monitor Webhooks

Implement webhook handlers for all subscription events to keep your system in sync

Handle Failures Gracefully

Build dunning workflows to recover failed payments and reduce involuntary churn

Test Thoroughly

Test all subscription scenarios in test mode before going live

Provide Self-Service

Allow customers to update payment methods and manage subscriptions themselves

Communicate Clearly

Send confirmation emails for subscription changes and upcoming charges

Plan for Edge Cases

Handle expired cards, failed payments, and subscription upgrades/downgrades

Common Use Cases

SaaS Subscription Tiers

# Basic Plan - $9/month
recurring=add_subscription
plan_id=BASIC_MONTHLY
plan_amount=9.00
plan_payments=0
month_frequency=1
customer_vault_id=CUST123

# Pro Plan - $29/month
recurring=add_subscription
plan_id=PRO_MONTHLY
plan_amount=29.00
plan_payments=0
month_frequency=1
customer_vault_id=CUST456

# Enterprise Plan - $99/month
recurring=add_subscription
plan_id=ENTERPRISE_MONTHLY
plan_amount=99.00
plan_payments=0
month_frequency=1
customer_vault_id=CUST789

Membership Fees

# Annual gym membership
recurring=add_subscription
plan_amount=599.00
plan_payments=0
month_frequency=12
start_date=20251101
customer_vault_id=MEMBER001

Payment Plans

# $1,200 product paid over 12 months
recurring=add_subscription
plan_amount=100.00
plan_payments=12
month_frequency=1
start_date=20251101
customer_vault_id=CUST555

Installment Billing

# 4 quarterly payments
recurring=add_subscription
plan_amount=250.00
plan_payments=4
month_frequency=3
start_date=20251101
customer_vault_id=CUST777

Troubleshooting

Common Causes:
  • Invalid customer_vault_id
  • Missing required fields (plan_amount, plan_payments, frequency)
  • Invalid date format for start_date
  • Customer vault payment method expired
Solution:
  • Verify customer exists in vault
  • Check all required fields are present
  • Use YYYYMMDD format for dates
  • Verify payment method is valid
Common Causes:
  • Subscription paused (future start_date)
  • Payment method expired
  • Customer vault deleted
  • Subscription completed (reached plan_payments)
Solution:
  • Check subscription status via Query API
  • Verify payment method in Customer Vault
  • Review subscription configuration
Common Causes:
  • Webhook URL not configured
  • Endpoint returning errors
  • Firewall blocking requests
  • SSL certificate issues
Solution:
  • Verify webhook URL in merchant portal
  • Test endpoint returns 200 OK
  • Check webhook logs in portal
  • Verify SSL certificate is valid
Common Causes:
  • Insufficient funds
  • Expired card
  • Card declined by issuer
  • Account closed
Solution:
  • Implement dunning workflow
  • Request updated payment method
  • Send customer notifications
  • Provide self-service update option

API Endpoint

All subscription operations use the Transaction API:
POST https://api.ionicfi.com/api/transact.php
Authentication: Include security_key parameter in all requests

Next Steps