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

Create a schedule

Create a new recurring schedule for automated charges or transfers. Schedules allow you to set up subscription billing, recurring payments, and automated fund transfers with flexible frequency options (daily, weekly, or monthly).


Request Parametersโ€‹

Required - 3 fieldsSchedule Configuration
โ–ผ
`every`INTEGER(required)
Frequency multiplier for the schedule period. For example, every=2 with period=week means every 2 weeks.
Example:1
Constraints:Minimum: 1
`period`STRING(required)
Time unit for the schedule frequency.
Example:"month"
Values:day, week, month
`on`OBJECT(required)
Specifies when during the period the schedule should run. Required fields depend on the period type.
Example:"{\"days_of_month\": [1, 15]}"
Optional - 2 fieldsSchedule Duration
โ–ผ
`start_date`STRING(optional)
Start date for the schedule in ISO 8601 format (YYYY-MM-DD). Defaults to today if not specified.
Example:"2025-01-01"
`end_date`STRING(optional)
End date for the schedule in ISO 8601 format (YYYY-MM-DD). Schedule will expire after this date.
Example:"2025-12-31"
Conditional - Use charge OR transferCharge Configuration
โ–ผ
`charge`OBJECT(optional)
Configuration for recurring charges. Required if not using transfer.
Example:"{\"amount\": 100000, \"currency\": \"THB\", \"customer\": \"cust_test_xxx\"}"
Conditional - Use charge OR transferTransfer Configuration

Responsesโ€‹

200

Schedule created

Returns the newly created schedule object with all configuration details and upcoming occurrence dates.

Schedule object includes:
  • id - Schedule identifier (schd_*)
  • livemode - Live or test mode
  • location - API path to object
  • status - Initial status (typically "active")
  • active - Whether schedule is currently running
  • every - Frequency multiplier
  • period - Time unit (day, week, month)
  • on - Timing configuration
  • in_words - Human-readable description of the schedule
  • start_on - Schedule start date
  • end_on - Schedule end date
  • next_occurrences_on - Array of up to 30 upcoming execution dates
  • occurrences - List of occurrence objects
  • charge or transfer - Operation parameters
  • created_at - Schedule creation timestamp (ISO 8601)
  • deleted - Whether schedule has been deleted

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Missing required parameters (every, period, on)
  • Invalid period value
  • Invalid on configuration for the specified period
  • Neither charge nor transfer specified
  • Invalid customer or recipient ID
  • Start date is in the past
  • End date is before start date

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key
  • Incorrect HTTP Basic Auth format

404

Not found

Referenced resource not found.

Common causes:
  • Invalid customer ID in charge configuration
  • Invalid recipient ID in transfer configuration
  • Invalid card ID specified
  • Customer has no default card

5xx

Server error

Server-side error occurred. These are rare but should be handled gracefully.

How to handle:

Code samplesโ€‹

Create a Charge Scheduleโ€‹

# Monthly charge schedule on the 1st and 15th
curl https://api.omise.co/schedules \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d every=1 \
-d period=month \
-d "on[days_of_month][]=1" \
-d "on[days_of_month][]=15" \
-d start_date=2025-01-01 \
-d end_date=2025-12-31 \
-d "charge[amount]=100000" \
-d "charge[currency]=THB" \
-d "charge[customer]=cust_test_5xuy4w91xqz7d1w9u0t" \
-d "charge[description]=Monthly subscription"

Create a Transfer Scheduleโ€‹

# Weekly transfer schedule - every Monday, 75% of balance
curl https://api.omise.co/schedules \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d every=1 \
-d period=week \
-d "on[weekdays][]=monday" \
-d start_date=2025-01-01 \
-d end_date=2025-12-31 \
-d "transfer[recipient]=recp_test_5xuy4w91xqz7d1w9u0t" \
-d "transfer[percentage_of_balance]=75"

# Monthly fixed amount transfer on the 1st
curl https://api.omise.co/schedules \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d every=1 \
-d period=month \
-d "on[days_of_month][]=1" \
-d start_date=2025-01-01 \
-d "transfer[recipient]=recp_test_5xuy4w91xqz7d1w9u0t" \
-d "transfer[amount]=1000000"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
authentication_failureInvalid API keyVerify your secret key is correct
invalid_scheduleInvalid schedule configurationCheck every, period, and on parameters
invalid_customerCustomer not foundVerify customer ID exists
invalid_recipientRecipient not foundVerify recipient ID exists
invalid_cardCard not found or expiredVerify card ID or use customer default

Schedule Period Configurationโ€‹

PeriodRequired on ParameterExample
dayNone requiredRuns every N days
weekweekdays{"weekdays": ["monday", "friday"]}
monthdays_of_month or weekday_of_month{"days_of_month": [1, 15]}

๐Ÿ”‘API Credentials

Try it outโ€‹

Required - 3 fields
โ–ผ
Your IP: ...Loading...