Schedule API

Schedule API ใช้ในการสร้าง, เรียกดู และลบรายการรับชำระเงินหรือราย การโอนเงิน ที่ได้มีการตั้งค่าให้ดำเนินการแบบอัตโนมัติไว้ล่วงหน้า ตัวอย่างเช่น การรับชำระเงินค่าสมาชิกรายเดือนหรือการโอนเงินออกรายสัปดาห์

ในส่วนของการเรียกดูข้อมูลความถี่ในการดำเนินการที่ได้ตั้งค่าไว้ สามารถเรียกใช้ Occurrence API

Attributes

Name Type Description
object string

The string schedule.

id string

The schedule identifier matching /schd(_test)?_[0-9a-z]+/.

livemode boolean

Whether this is a live (true) or test (false) schedule.

location string

API path to retrieve the current schedule object.

active boolean

Whether schedule is status running or expiring.

charge charge_schedule
created_at string

UTC datetime of schedule creation in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

deleted boolean

Whether schedule is deleted.

end_on string

End date of schedule in ISO 8601 format.

ended_at string

Actual end date of schedule in ISO 8601 format.

every integer

How often schedule should run when applied to period. For example, if set to 3 and period is set to week, schedule should run every 3 weeks.

in_words string

Schedule expressed as an English sentence. E.g.: Every 2 months on the 15th, Every 3 days, Every week on monday and friday.

next_occurrences_on array

Up to 30 upcoming occurrence dates in ISO 8601 format. Empty in case of expired, suspended or deleted schedule.

occurrences list

List of occurrence objects.

on object

Object specifying schedule timing.

period string

Period to use for every. One of day, week or month. For example, if set to week and every is set to 3 schedule should run every 3 weeks.

start_on string

Start date of schedule in ISO 8601 format.

status string

One of:

  • running: The schedule is running.
  • expiring: The schedule's next occurrence is its last.
  • expired: The schedule has reached its last occurrence and is not running anymore.
  • deleted: The schedule has been deleted and is not running anymore.
  • suspended: The schedule could not be completed and was stopped.
.

transfer transfer_schedule

Example

  • JSON Response

Create a schedule

- POST https://api.omise.co/schedules

Creates and returns a new schedule.

Request Parameters

Name Type Description
end_date string

(required) End date of schedule in ISO 8601 format.

every integer

(required) How often schedule should run when applied to period. For example, if set to 3 and period is set to week, schedule should run every 3 weeks.

period string

(required, one of: day, week, month) Period to use for every. One of day, week or month. For example, if set to week and every is set to 3 schedule should run every 3 weeks.

start_date string

(required) Start date of schedule in ISO 8601 format.

charge object

(optional, but conditionally required) Charge schedule object. Use when creating a charge schedule.

on object

(optional) Object specifying schedule timing.

transfer object

(optional, but conditionally required) Transfer schedule object. Use when creating a transfer schedule.

Example

  • Charge a specific customer every 2 days

  • Transfer a fixed amount every 2 days

  • Charge on the 1st, 10th and 15th every 3 months

  • Charge on the second Monday every month

  • Transfer the whole balance on the second Monday every month

  • Transfer the whole balance on the 1st, 10th and 15th every 3 months

  • Charge every Monday and Friday

  • Transfer a percentage of the balance every Monday and Friday

Destroy a schedule

- DELETE https://api.omise.co/schedules/{id}

Destroys the schedule matching :id.

Example

  • Destroy a schedule

List schedules

- GET https://api.omise.co/schedules

Returns a list of charge and transfer schedules belonging to your account.

Request Parameters

Name Type Description
from string

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

limit integer

(optional, default: 20) Number of records returned.

offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

order string

(optional, default: chronological, one of: chronological, reverse_chronological) Order of records returned.

to string

(optional) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

Example

  • List all schedules

List charge schedules for customer

- GET https://api.omise.co/customers/{id}/schedules

Returns a list of schedules belonging to customer matching :id.

Request Parameters

Name Type Description
from string

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

limit integer

(optional, default: 20) Number of records returned.

offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

order string

(optional, default: chronological, one of: chronological, reverse_chronological) Order of records returned.

to string

(optional) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

Example

  • List all charge schedules for a customer

List transfer schedules for recipient

- GET https://api.omise.co/recipients/{id}/schedules

Returns a list of transfer schedules belonging to recipient matching :id.

Request Parameters

Name Type Description
from string

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

limit integer

(optional, default: 20) Number of records returned.

offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

order string

(optional, default: chronological, one of: chronological, reverse_chronological) Order of records returned.

to string

(optional) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

Example

  • List all transfer schedules for recipient

List transfer schedules

- GET https://api.omise.co/transfers/schedules

Returns a list of transfer schedules

Request Parameters

Name Type Description
from string

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

limit integer

(optional, default: 20) Number of records returned.

offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

order string

(optional, default: chronological, one of: chronological, reverse_chronological) Order of records returned.

to string

(optional) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

Retrieve a schedule

- GET https://api.omise.co/schedules/{id}

Returns the schedule matching :id.

Example

  • Retrieve a schedule

เว็ปไซต์นี้มีการใช้คุกกี้เพื่อวิเคราะห์การใช้และปรับการใช้งานให้เหมาะกับท่าน เมื่อกดยอมรับหรือยังคงเข้าชมเว็บไซต์ต่อ เราถือว่าท่านยินยอมในการใช้งานคุกกี้ของเว็บไซต์ อ่านนโยบายความเป็นส่วนตัว