Skip to main content
Version: 2019-05-29 (Current)

Charge Schedules API

The Charge Schedules API allows you to create and manage recurring charge schedules in bulk. This API is designed for high-volume operations, enabling you to upload CSV files to create multiple schedules at once, and manage existing schedules through batch pause, resume, and delete operations.

Available Endpointsโ€‹

Overviewโ€‹

The Charge Schedules API provides bulk operations for managing recurring charges:

  • CSV Upload - Create hundreds or thousands of charge schedules from a single CSV file
  • Progress Monitoring - Track the status of bulk creation jobs in real-time
  • Status Reports - Download detailed reports with success/failure status for each schedule
  • Bulk Pause - Pause multiple active schedules simultaneously
  • Bulk Resume - Resume multiple paused schedules at once
  • Bulk Delete - Permanently delete multiple schedules in a single operation

Common Use Casesโ€‹

  • Migrating subscription customers from another platform
  • Setting up recurring payments for a large customer base
  • Seasonal schedule management (pause/resume for holidays)
  • Batch cancellation of schedules for churned customers
  • Initial setup of recurring billing for enterprise clients

How Bulk Creation Worksโ€‹

  1. Prepare a CSV file with customer and schedule details
  2. Upload the CSV file to create a bulk creation job
  3. Monitor the job progress using the recurring_id
  4. Download the status report to review results and handle errors
  5. Successful schedules begin executing automatically

CSV File Formatโ€‹

When creating schedules in bulk, your CSV file must include the following columns:

ColumnRequiredDescription
customer_keyYesUnique identifier for the customer row (for tracking)
customerYesCustomer ID (cust_*) with an attached card
cardNoSpecific card ID to charge (uses default if not specified)
amountYesCharge amount in smallest currency unit
descriptionNoDescription for each charge
everyYesFrequency multiplier (e.g., 1 for every month)
periodYesTime unit: day, week, or month
days_of_monthConditionalDays to charge (required for monthly period)
start_dateNoSchedule start date (YYYY-MM-DD)
end_dateNoSchedule end date (YYYY-MM-DD)

Example CSVโ€‹

customer_key,customer,card,amount,description,every,period,days_of_month,start_date,end_date
sub_001,cust_test_abc123,,100000,Monthly premium plan,1,month,1,2025-02-01,2026-01-31
sub_002,cust_test_def456,card_test_xyz789,50000,Basic subscription,1,month,15,2025-02-01,
sub_003,cust_test_ghi012,,200000,Enterprise plan,1,month,1;15,2025-02-01,2025-12-31

Authenticationโ€‹

All Charge Schedules API endpoints require authentication using your secret key.

Bulk Operation Limitsโ€‹

OperationLimit
CSV file size10MB maximum
Schedules per CSV10,000 rows maximum
Schedule IDs per bulk pause/resume/delete100 IDs maximum
Concurrent bulk creation jobs5 per account

Job Status Lifecycleโ€‹

Bulk creation jobs progress through these statuses:

  1. pending - Job is queued and waiting to start
  2. processing - Job is actively creating schedules
  3. completed - Job finished (check report for individual results)
  4. failed - Job encountered a fatal error

Error Handlingโ€‹

Bulk Creation Errorsโ€‹

Bulk creation jobs are designed to be resilient. If individual rows fail:

  • The job continues processing remaining rows
  • Failed rows are logged in the status report
  • Download the report to see specific error messages per row

Common CSV Errorsโ€‹

ErrorDescriptionResolution
invalid_customerCustomer ID not foundVerify customer exists and has a card attached
invalid_cardCard not found or expiredUse a valid card ID or remove to use default
invalid_amountAmount is zero or negativeProvide a positive integer amount
invalid_periodInvalid period valueUse day, week, or month
missing_days_of_monthRequired for monthly periodSpecify days (e.g., 1 or 1;15)

Bulk Pause/Resume/Delete Errorsโ€‹

ErrorDescriptionResolution
schedule_not_foundOne or more schedule IDs invalidVerify all schedule IDs exist
invalid_statusSchedule in wrong state for operationCheck current schedule status
too_many_idsExceeded maximum IDs per requestSplit into multiple requests (max 100)

Best Practicesโ€‹

1. Validate CSV Before Uploadโ€‹

Check your CSV file for:

  • Correct column headers
  • Valid customer IDs
  • Proper date formats (YYYY-MM-DD)
  • Amount values as integers (not decimals)

2. Monitor Job Progressโ€‹

Poll the monitor endpoint periodically:

// Check every 5 seconds until complete
const checkStatus = async (recurringId) => {
const status = await getJobStatus(recurringId);
if (status.state === 'completed') {
return await downloadReport(recurringId);
}
setTimeout(() => checkStatus(recurringId), 5000);
};

3. Handle Partial Failuresโ€‹

Always download and review the status report:

  • Retry failed rows individually or in a new CSV
  • Log errors for investigation
  • Notify affected customers if needed

4. Use Unique Customer Keysโ€‹

Include meaningful customer_key values to easily identify rows in status reports and match results back to your system.